This is supposed to be served next to a fonts.css file defining one or more font-families, ex:
@font-face {
font-family: "American Captain";
src: url("./American-Captain.woff") format("woff");
}| export function spy(fn: Function, prot = fn.prototype) { | |
| function proxyFn() { | |
| const args = Array.prototype.slice.call(arguments); | |
| const call = { args, result: undefined, error: undefined, real: true }; | |
| proxyFn.calls.push(call); | |
| let responded = false; | |
| // check if preparedCalls can answer |
| type SortableType = number | string | boolean; | |
| type SortFn<T> = (el: T) => SortableType; | |
| interface SortHelperApi<T> { | |
| sortBy(fn: SortFn<T>, decrescent?: boolean): SortHelperApi<T>; | |
| execute(): T[]; | |
| } | |
| /** |
This is supposed to be served next to a fonts.css file defining one or more font-families, ex:
@font-face {
font-family: "American Captain";
src: url("./American-Captain.woff") format("woff");
}| const ignoreKeys = new Set([ | |
| 'parent', | |
| 'transform', | |
| ]); | |
| const numberKeyRgx = /^[0-9]+$/; | |
| const simpleKeyRgx = /^[a-zA-Z_\$][a-zA-Z0-9_\$]*$/; | |
| const getExpr = function (key: string) { | |
| if (numberKeyRgx.test(key)) return `[${key}]`; | |
| return (simpleKeyRgx.test(key)) ? `.${key}` : `['${key}']`; |
| { config, pkgs, ... }: | |
| { | |
| imports = | |
| [ | |
| ./hardware-configuration.nix | |
| ]; | |
| boot.loader.systemd-boot.enable = true; | |
| boot.loader.efi.canTouchEfiVariables = true; |
| import { expect } from 'chai'; | |
| import { ArrayUtils } from './ArrayUtils'; | |
| function sortByNumericAttribute() { | |
| const arr = [ | |
| { a: 'a', n: 3 }, | |
| { a: 'b', n: 2 }, | |
| { a: 'c', n: 6 }, | |
| ]; | |
| expect(ArrayUtils.sortByNumericAttribute(arr, 'n', false)).to.deep.eq([ |
| // to capture actual responses | |
| let i = 0; | |
| global.fetch = jest.fn(async (url, options) => { | |
| console.log(`#${i++}: ${options.method || 'GET'} ${url}`); | |
| const resp = await originalFetch(url, options); | |
| const body = await resp.json(); | |
| console.log(` status: ${resp.status}, body: ${JSON.stringify(body, null, 2)}`); | |
| return body; | |
| }); |
| mysql -h localhost -u USER -P 3306 -p --protocol=TCP |
| function clamp(v, m, M) { | |
| return v < m ? m : v > M ? M : v; | |
| } | |
| function average(arr) { | |
| return arr.reduce((prev, curr) => prev + curr, 0) / arr.length; | |
| } | |
| // triangle m0 x l of area 1 (linear degradation) | |
| function averageWithDegradation(arr) { |