This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
ruby '3.3.4' | |
gem 'prime' | |
gem 'rspec' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rows.sort((a, b) => { | |
const amountTypeSort = a.amountType.localeCompare(b.amountType); | |
if (amountTypeSort !== 0) { | |
return amountTypeSort; | |
} | |
const laborCostTypeDisplayNameSort = a.costTypeDisplayName.localeCompare(b.costTypeDisplayName); | |
if (laborCostTypeDisplayNameSort !== 0) { | |
return laborCostTypeDisplayNameSort; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string Tag(string name, IEnumerable<Tuple<string, string>> attributes, string contents = "") | |
{ | |
var attributeString = attributes.Any() ? " " + string.Join(' ', attributes.Select(a => @$"{a.Item1}=""{a.Item2}""")) : string.Empty; | |
var hasContents = !string.IsNullOrEmpty(contents); | |
if (!hasContents) { | |
return | |
@$"<{name}{attributeString}/>"; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Subscribable { | |
constructor(name) { | |
this._name = name | |
this._subscribers = [] | |
this._state = undefined | |
} | |
getState() { | |
return this._state | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- TITLE FILE --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Created by Anders Lyman, uploaded with permission | |
// Usage: class MyMethods { @LogPerformance() slowMethod() { ... } } | |
// If slowMethod exceeds 50 invocations or 30ms total run time, a statement like the following will be logged: | |
// 35ms | total: 35ms | calls: 1 | MyMethods:slowMethod | |
import {isDevMode} from '@angular/core'; | |
export function LogPerformance(whenExceedsTimeInMs: number = 30, whenExceedsCalls: number = 50): any { | |
return function<T>(target: T, key: keyof T, descriptor?): any { | |
descriptor = | |
descriptor || Object.getOwnPropertyDescriptor(target, key) || Object.getOwnPropertyDescriptor(Object.getPrototypeOf(target), key); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function testSpeed() { | |
const stack = []; | |
function assignValue(index) { | |
stack[index] = 'bob ' + index; | |
} | |
const t0 = performance.now() | |
for (let ix = 0; ix < 15000; ix++) { | |
assignValue(ix); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function orderPromises (promiseFns) { | |
if (!Array.isArray(promiseFns) || (promiseFns.length && typeof promiseFns[0] !== 'function')) { | |
throw new TypeError('orderPromises expects an array of functions. Received: ' + JSON.stringify(promiseFns)) | |
} | |
if (!promiseFns.length) { | |
return Promise.resolve() | |
} | |
const promise = promiseFns[0]() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cloc . --exclude-dir=node_modules,dist --not-match-f=package-lock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"editor.tabSize": 2, | |
"explorer.autoReveal": false, | |
"workbench.editor.enablePreview": false, | |
"workbench.editor.enablePreviewFromQuickOpen": false | |
} |
NewerOlder