.data:hover { fill: #B10000; opacity: 1; } /* data = RED */
.datum:hover { fill: #00B100; opacity: 1; } /* datum= GREEN */
This file contains 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() { | |
var M = this && this.__extends || function() { | |
var a = Object.setPrototypeOf || { | |
__proto__: [] | |
}instanceof Array && function(a, h) { | |
a.__proto__ = h | |
} | |
|| function(a, h) { | |
for (var f in h) | |
h.hasOwnProperty(f) && (a[f] = h[f]) |
This file contains 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
/** | |
* FAST PACKING / UNPACKING JSON | |
* | |
* If all objects in a collection follows a similar schema, | |
* then there is gain in changing the representation from a dictionary to a simple array. | |
* | |
* It is known results used in database, protocols, in v8 itself with shadow maps and IRL. | |
* | |
* In this example, we expect our final exchange to be equivalent to this literal representation: | |
* [ |
This file contains 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
/// Hack it ? | |
function sandbox(code) { | |
// Disable private functions not listed in window object | |
var blackList = [ | |
'Function', // avoid using (new Function("code"))(); to get window access | |
'eval', // ... | |
'self', // return window object | |
'window', // ... | |
]; |
This file contains 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 appReducer(state={}, action) { | |
const {meta, ...rest} = action; | |
const {app, ...mrest} = meta; | |
if (!app) { | |
return state; | |
} | |
return { | |
...state, |
This file contains 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"; | |
var [BRA, KET, IDENT] = ['BRA', 'KET', 'IDENT']; | |
function last(arr){ return arr[arr.length -1] }; | |
export default function act(src, prefix){ | |
var tree = src.split('').reduce((tokens, char)=> { | |
if(char==='{'){ | |
tokens.push({type: BRA}); |
This file contains 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
/* global fetch*/ | |
import {Dis, act} from 'disto'; | |
let {dispatch, register} = new Dis(); | |
function timeout(t){ | |
return new Promise(resolve => | |
setTimeout(()=> resolve(true), t)); | |
} |
This file contains 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
import React from 'react'; | |
export class Sto extends React.Component{ | |
static defaultProps = { | |
store: x => x | |
} | |
state = { | |
value: this.props.store() | |
} | |
dispatch = action => this.setState({ |
This file contains 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
// murmurhash2 via https://gist.github.com/raycmorgan/588423 | |
export default function doHash(str, seed) { | |
var m = 0x5bd1e995; | |
var r = 24; | |
var h = seed ^ str.length; | |
var length = str.length; | |
var currentIndex = 0; | |
while (length >= 4) { |
This file contains 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
import Expedite from './'; | |
const getTest = async (testContext) => ({true: true, test: 'Hello World', testContext}); // pretend async thing thats not really | |
const pretendCreatePromise = ({uuid, name}) => Promise.resolve({uuid, name}); | |
export default class Test extends Expedite { | |
// req: express request object | |
// context: dependency injection (added at class initialise to avoid singletons) | |
async get(req, context) { // magically wrapped in try catch in the middleware, checks for this.error then defaults back to the next item in express | |
const res = await getTest(context); // database or whatever promise |
NewerOlder