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
/** | |
* Minimal implementation of Redux createStore, with thunkish behavior. | |
*/ | |
import subject from './micro-subject' // see micro-subject.js gist | |
/** | |
* @template T | |
* @typedef {import('./subject').Subject<T>} Subject | |
*/ | |
/** |
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
/** | |
* Provide basic subscribe/notify/unsubscribe functionality in a | |
* dozen or so lines of code. | |
*/ | |
/** | |
* @template T | |
* @typedef {(value?: T) => void} ObserverFn | |
*/ |
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
function keyframeInterpolate(keyframes, time, timing, lib) { | |
const first = 0 | |
const last = keyframes.length - 1 | |
// Clamp time to [0, 1] | |
time = Math.max(Math.min(time, 1), 0) | |
if (!Array.isArray(keyframes) || !keyframes.length) { | |
return lib.zero() | |
} |
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
// The default comparator is for any values that can be | |
// compared with '==', '<', '<=', '>', '>='. | |
function defaultComparator(candidate, target) { | |
if (target < candidate) { | |
return -1 | |
} else if (target > candidate) { | |
return 1 | |
} else { | |
return 0 | |
} |
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
import os | |
import re | |
import gzip | |
import base64 | |
import json | |
from glob import glob | |
from argparse import ArgumentParser | |
from KnoDB.crawler.scc import case_parser | |
from KnoDB.crawler import bcca |
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
// Return the post-transform coords of an element, | |
// assuming that proper pre-transform coords are supplied. | |
function getElementCoords(element, coords) { | |
var ctm = element.getCTM(), | |
xn = ctm.e + coords.x*ctm.a, | |
yn = ctm.f + coords.y*ctm.d; | |
return { x: xn, y: yn }; | |
}; | |
var circle = document.getElementById('svgCircle'), |
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
(function() { | |
'use strict'; | |
// Create a factory function (a function that returns an object). | |
function aFactory() { | |
// Create a data store. | |
var _data = []; | |
// Add supplied arguments to the data store. | |
if (arguments.length) |
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
""" | |
Generate fontawesome icon set in JSON format from website cheatsheet. | |
http://fortawesome.github.io/Font-Awesome/cheatsheet/ | |
Usage: python gen_fontawesome.py | |
Output: font-awesome.json | |
{icon_name: entity_reference, ...} | |
Author: James Abney | |
Date: 2015-05-21 |
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
{"cc": "", "bookmark": "", "venus-mars": "", "arrow-circle-o-down": "", "comment-o": "", "long-arrow-left": "", "arrow-right": "", "delicious": "", "chevron-circle-left": "", "bullhorn": "", "outdent": "", "jpy": "", "drupal": "", "hdd-o": "", "hand-o-left": "", "pinterest": "", "plane": "", "question": "", "child": "", "circle-o": "", "italic": "", "meanpath": "", "subway": "", "google-plus": "", "angle-up": "", "star": "", "star-half-empty": "", "facebook-official": "", "youtube-square": "", "rss": "", "toggle-off": "", "list-ol": "", "dot-circle-o": "", "copyright": "", "user": "", "key": "", "minus-square-o": "", "mobile": "", "table": "", "columns": "", "bolt": "", "fighter-jet": "& |
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
// This augmentation style is appropriate for a factory-style function, | |
// which might be something that was imported as part of a library. | |
var factory = function factory() { | |
var data = []; | |
// Return an object with one or more methods. | |
return { | |
init: function() { | |
data.push.apply(data, arguments); |