Skip to content

Instantly share code, notes, and snippets.

View bard's full-sized avatar

Massimiliano Mirra bard

View GitHub Profile
const partition = <T>(array: T[], pred: (item: T) => boolean) =>
array.reduce<[T[], T[]]>(
([leftSet, rightSet], item) =>
pred(item)
? [[...leftSet, item], rightSet]
: [leftSet, [...rightSet, item]],
[[], []],
)
@bard
bard / SketchSystems.spec
Last active June 19, 2019 20:03
# Trivia
# Trivia
Start*
mounted -> RetrievingToken
RetrievingToken
tokenRetrieved -> Home
tokenFailure -> Error
Error
backHomeClicked -> Home
@bard
bard / SketchSystems.spec
Last active June 28, 2019 14:40
# HelpMatch
# HelpMatch
Start*
mounted -> LoadingLocalState
LoadingLocalState
localStateLoaded -> CheckingForSession
localStateAbsent -> CheckingForSession
CheckingForSession
sessionAbsent -> Welcome
Start*
mounted -> Init
Init
verificationCodeProvided -> VerifyingCode
rootRouteImplicitlyNavigated -> CheckingForExistingSession
VerifyingCode
success -> Ready
failure -> Setup
CheckingForExistingSession
success -> Ready
@bard
bard / dompurify.d.ts
Last active April 10, 2019 14:46
DOMPurify typings
interface Config {
ADD_ATTR?: string[];
ADD_TAGS?: string[];
ALLOW_DATA_ATTR?: boolean;
ALLOWED_ATTR?: string[];
ALLOWED_TAGS?: string[];
FORBID_ATTR?: string[];
FORBID_TAGS?: string[];
FORCE_BODY?: boolean;
KEEP_CONTENT?: boolean;
@bard
bard / package.json
Created May 20, 2018 19:43
ParcelJS - hack to post-process entire bundles
{
"dependencies": {
"es3ify": "^0.2.2",
"parcel-bundler": "^1.8.1"
}
}
keycode 8 =
keycode 9 = Escape NoSymbol Escape
keycode 10 = 1 exclam 1 exclam
keycode 11 = 2 at 2 at
keycode 12 = 3 numbersign 3 numbersign
keycode 13 = 4 dollar 4 dollar
keycode 14 = 5 percent 5 percent
keycode 15 = 6 asciicircum 6 asciicircum dead_circumflex dead_circumflex dead_circumflex
keycode 16 = 7 ampersand 7 ampersand
keycode 17 = 8 asterisk 8 asterisk