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 SidewaysCallback() { | |
var cb = null; | |
return { | |
listen: function (_cb) { | |
cb = _cb; | |
return function () { cb = null; } | |
}, | |
trigger: function () { | |
if (cb === null) { return; } | |
cb.apply(null, arguments); |
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 items = this.state.items.map(item => { | |
var data = item.value; | |
return ( | |
<Fadeable key={data.id} | |
onComplete={() => Actions.remove(data.id)} | |
transition="opacity 0.5s ease-in" | |
style={{opacity: 0, color: 'red'}}> | |
<li> |
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 DocumentEdit = React.createClass({ | |
mixins: [CoerceDocumentMixin, PerfMixin], | |
.... | |
}); |
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 config = require('./config')('/tmp/etc/new.conf') |
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
string | |
= a:(token / quotedtoken)* { return a; } | |
quotedtoken | |
= '"' foo:(token+) '"' space* { return foo.join(' '); } | |
token | |
= foo:chars space* { return foo.join(''); } | |
chars = foo:[a-z]+ { return foo; } |
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"; | |
function bagGenerator(pieces, exclusions) { | |
var buf = pieces.slice(), | |
size = pieces.length, | |
ptr = -1; | |
var shuffle = function () { | |
for (var t, j, i = 1; i < size; i++) { | |
j = Math.random() * (i+1) |0; | |
t = buf[i]; |
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'; | |
var assert = require('assert'), | |
debug = require('debug')('get-connection'), | |
FibonacciBackoff = require('simple-backoff').FibonacciBackoff; | |
module.exports = function (opts) { | |
opts = opts || { }; | |
assert(opts.hasOwnProperty('net'), 'getConnection: opts.net is required'); |
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
private String cleanHTML(String str) { | |
Element element = Jsoup.parse(str); | |
final StringBuilder buffer = new StringBuilder(); | |
new NodeTraversor(new NodeVisitor() { | |
boolean isNewline = true; | |
@Override | |
public void head(Node node, int depth) { |
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
project/node_modules/loader - can require('foo') but not require('bar') | |
project/node_modules/foo | |
project/node_modules/foo/node_modules/bar |
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 readFileAsync = Promise.promisify(fs.readFile, fs); | |
module.exports = { | |
init: function(env) { | |
if (!env) throw new Error(ERRENV); | |
var self = this; | |
if (!env.proto) env.proto = 'http'; | |
self.env = env; | |
self.url = str.url(env); |