View auto-bisect.sh
#!/usr/bin/env bash
# https://lwn.net/Articles/317154/
# USAGE:
# git bisect start <badSHA> <goodSHA>
# chmod +x ../auto-bisect.sh
# git bisect run ../auto-bisect.sh
yarn;
yarn storybook:static;
View gist:628fc5be4a0c49894dae6f6203a5aba5
While such costs might be negligable for cold code, in the sort code comparator was invocated millions of times which made overheads of arguments adaptation quite pronounced.
View kk
#!/usr/bin/env bash
notify "kk."
View label.js
// Jests dont write to file in chron order, prefix with number helps
let count = 0;
const label = (tmpl, ...val) => {
val.reverse();
return `${
count++ // eslint-disable-line
}. ${
tmpl.reduce((p, c) => p + c + (val.length ? val.pop() : ''), '')
}`;
View createNumberFormatFromNumberToLocalString.js
// The following must be executed in browser, and can be pasted into
//
// WHY?
// 1. Browser support is a bit spotty
// 2. Testing with node framework made harder as node doesn't come with internationalistion (full-icu) data by default
// 3. Int shim is ~56Kb https://github.com/andyearnshaw/Intl.js/blob/master/dist/Intl.min.js. This is ~7kb
var getNumberFormatFromIso2 = (iso) => {
let thousandsSeparatorSymbol;
View Snippets.md

Glob

python << EOF
import glob
for name in glob.glob('/*'):
  print(name)
EOF
View findAllTests.sh
# Easy to use mocha globs to find test files in this structure:
#
# └─src
# │ └─index.spec.js
# └─.dist
# │ └─index.spec.js
# └─node_modules
# └─(...various...)
#
# With this structure, it got very difficult with include+exclude globs (perhaps impossible)
View Jenkins cheat sheet.md

Sections

Contains Directives or Steps

  • agent - where env will execute
  • post - run once Pipeline or stage has run. Supports blocks always (regardless), changed (different completion status), failure, success, unstable (Pipeline or stage run status == "unstable" e.g. test failures), aborted
View jest.md

Jest cheat shiiiit

Expect

expect.any(constructor) // expect(callback).toBe(expect.any(Function))
expect.assertions(number) // total count of expected assertions, useful for async tests
.not
.resolves
.rejects
.toBe(value)
.toHaveBeenCalled()