//puredom.js
//@flow
//@jsx domsx
//@jsxFrag 'fragment'
const handlers = (global.handlers = [])
initDOM()
const ClickMe = (props, childs) => (
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
'use strict'; | |
'use exports {Semaphore, ExclusiveSemaphore, SharedSemaphor}'; | |
const ERR_LOCKED = `Semaphore is already fully locked`; | |
class Semaphore { | |
constructor() {} | |
/** | |
* Creates a controller to manually control locking & unlocking | |
* the Semaphore. | |
* |
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
class Tree { | |
constructor(root) { | |
this.root = null | |
this.root = root | |
} | |
buildFromLinks(links) { | |
const nodes = new Array(26) | |
const forest = new Array(26) |
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
//@flow | |
export const EMIT: "emit" = "emit"; | |
export const MAP: "map" = "map"; | |
export const WATCH: "watch" = "watch"; | |
export const SCOPE: "scope" = "scope"; | |
export const STOP: "stop" = "stop"; | |
export const MOV: "mov" = "mov"; | |
export const COPY: "copy" = "copy"; | |
export const THREAD: "thread" = "thread"; |
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
// @flow | |
/** | |
* Simple function for formatting strings. | |
* Replaces placeholders with values passed as extra arguments | |
*/ | |
export default function sprintf(format: string, ...args: mixed[]) { | |
let index = 0; | |
return format.replace(/%s/g, match => String(args[index++])); | |
} |
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
{ | |
"BTTGestureNotes" : "switch to english", | |
"BTTTriggerType" : 624, | |
"BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut", | |
"BTTPredefinedActionType" : -1, | |
"BTTPredefinedActionName" : "No Action", | |
"BTTAdditionalConfiguration" : "131074", | |
"BTTEnabled2" : 1, | |
"BTTUUID" : "4C75140A-7C83-4D71-9317-9E986458F307", | |
"BTTTriggerOnDown" : 1, |
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
{ | |
"BTTTriggerType" : 624, | |
"BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut", | |
"BTTPredefinedActionType" : -1, | |
"BTTPredefinedActionName" : "No Action", | |
"BTTEnabled2" : 1, | |
"BTTUUID" : "D7CCEBE4-EDE1-4DAB-A67B-8634AA87F28C", | |
"BTTTriggerOnDown" : 0, | |
"BTTEnabled" : 1, | |
"BTTShortcutKeyCode" : -1, |
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
const generatePermutations = (items, process) => { | |
const mutableItems = items.slice(); | |
const isEven = n => (n & 1) === 0; | |
const permute = (itemArray, x, last) => { | |
if (isEven(last)) { x = 0; } | |
const temp = itemArray[x]; | |
itemArray[x] = itemArray[last]; | |
itemArray[last] = temp; |
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
var colors = { | |
aqua: '#7fdbff', | |
blue: '#0074d9', | |
lime: '#01ff70', | |
navy: '#001f3f', | |
teal: '#39cccc', | |
olive: '#3d9970', | |
green: '#2ecc40', | |
red: '#ff4136', | |
maroon: '#85144b', |
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
/* @flow */ | |
class Lock { | |
release: () => void | |
sustain = new Promise<void>(resolve => { | |
this.release = resolve | |
}) | |
} | |
export type Releaser<Key> = Promise<() => void> |