Skip to content

Instantly share code, notes, and snippets.

View markwhitfeld's full-sized avatar

Mark Whitfeld markwhitfeld

View GitHub Profile
@markwhitfeld
markwhitfeld / remove-many-items.ts
Created July 12, 2021 11:26
Gist backup of mailok/todo-ngxs
import { Predicate } from '@ngxs/store/operators/internals';
import { isPredicate, findIndices, isArrayNumber, invalidIndexs } from './utils';
/**
* @param selector - indices or predicate to remove multiple items from an array by
*/
export function removeManyItems<T>(selector: number[] | Predicate<T>) {
return function removeItemsOperator(existing: Readonly<T[]>): T[] {
let indices = [];
@markwhitfeld
markwhitfeld / project.code-snippets.json
Last active November 23, 2023 16:27
VsCode Snippet for converting Camel/Pascal Case to kebab-case
{
"Camel as Kebab": {
"prefix": "x-kebab",
"body": [
"${1} -> ${1/([a-z]*)(([A-Z])+([a-z]+))?/${1:/downcase}${2:+-}${3:/downcase}${4:/downcase}/g}"
],
"description": "dash separators"
},
"lowerFirstLetter": {
"prefix": "x-lower-first",
const state = getState();
setState({ …state, loading: true });
NgxsModule.forRoot([ FooState, BarState ], {
compatibility: {
strictContentSecurityPolicy: true
}
})