Regex to match a C-style multiline comment

The best multiline comment regex is an unrolled version of (?s)/\*.*?\*/ that looks like String pat = “/\\*[^*]*\\*+(?:[^/*][^*]*\\*+)*/”; See the regex demo and explanation at regex101.com. In short, /\* – match the comment start /* [^*]*\*+ – match 0+ characters other than * followed with 1+ literal * (?:[^/*][^*]*\*+)* – 0+ sequences of: [^/*][^*]*\*+ – … Read more

NPM run * doesn’t do anything

npm has a ignore-scripts configuration key. It’s expected value is a Boolean and it’s set to false by default. Perhaps it has inadvertently been set to true. To get/set the ignore-scripts configuration you can utilize the npm-config command: Check its current setting by running: npm config get ignore-scripts If the aforementioned command returns true then … Read more

AngularJS: ng-model not binding to ng-checked for checkboxes

ngModel and ngChecked are not meant to be used together. ngChecked is expecting an expression, so by saying ng-checked=”true”, you’re basically saying that the checkbox will always be checked by default. You should be able to just use ngModel, tied to a boolean property on your model. If you want something else, then you either … Read more

Understanding NSString comparison

The reason why == works is because of pointer comparison. When you define a constant NSString using @””, the compiler uniquifies the reference. When the same constants are defined in other places in your code, they will all point to the same actual location in memory. When comparing NSString instances, you should use the isEqualToString: … Read more

Why do the :before and :after pseudo-elements require a ‘content’ property?

Here are some references to various W3C specifications and drafts: Selectors Level 3 The :before and :after pseudo-elements can be used to insert generated content before or after an element’s content. The :before and :after pseudo-elements Authors specify the style and location of generated content with the :before and :after pseudo-elements. As their names indicate, … Read more