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 Foo (emitter, expectedPerson) { | |
this.waitForSomething = function(callback) { | |
emitter.on('something_happened', function(person) { | |
if (expectedPerson === person) { | |
callback(person); | |
} | |
}); | |
}; | |
return this; | |
}; |
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 client, payment; | |
return clientDao.get(id) | |
.then(function (foundClient) { | |
client = foundClient; | |
return paymentDao.get(paymentId); | |
}).then(function(foundPayment) { | |
client.credit(payment.amount); | |
payment.cancel(); | |
return clientDao.save(client); | |
}).then(function() { |
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 Rx = require('rx'); | |
var EventEmitter = require('events').EventEmitter; | |
var emitter = new EventEmitter(); | |
var observable1 = new Rx.Subject(); | |
var buffer = new Rx.ReplaySubject(); | |
var observable2 = Rx.Observable.fromEvent(emitter, 'test'); |
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'; | |
const fs = require('fs'); | |
const co = require('co'); | |
const files = ['./plan.md', './karma.conf.js', './package.json', './LICENSE']; | |
function checkFile(file) { | |
return new Promise((fulfill, reject) => { | |
console.log('checking file', file); | |
fs.stat(file, (error) => { |
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
Rx.Observable.prototype.debounceDistinct = function debounceDistinct(delay, keySelector = value => value) { | |
var source = this; | |
return Rx.Observable.create((observer) => { | |
const allKeys = {}; | |
function reinitDelayFor(key) { | |
allKeys[key] = false; | |
setTimeout(() => allKeys[key] = true, delay); | |
} |
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
/somewhere/yield.js:14 | |
throw reason; | |
^ | |
Error: test value a has some problems | |
at Promise (/somewhere/yield.js:19:12) | |
at display (/somewhere/yield.js:18:10) | |
at Array.map (native) | |
at /somewhere/yield.js:10:28 | |
at next (native) |
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
{ | |
settings: { | |
number_of_shards: 1, | |
analysis: { | |
filter: { | |
autocomplete_filter: { | |
type: 'ngram', | |
min_gram: 3, | |
max_gram: 15 | |
} |
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'; | |
const _ = require('lodash'); | |
const chai = require('chai'); | |
const should = chai.should(); | |
describe('filter groups behavior', () => { | |
const X = [ | |
{name: 'a'}, | |
{name: 'b'}, |
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 O = (a) => { | |
let compose = function* () { | |
for (let v of a) { | |
yield v; | |
} | |
}; | |
const filter = function(p) { | |
let rest = compose; | |
compose = function* () { |
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
{ | |
"action":"edited", | |
"number":1, | |
"pull_request":{ | |
"url":"https://api.github.com/repos/design-all-the-things/test-repo/pulls/1", | |
"id":321655669, | |
"node_id":"MDExOlB1bGxSZXF1ZXN0MzIxNjU1NjY5", | |
"html_url":"https://github.com/design-all-the-things/test-repo/pull/1", | |
"diff_url":"https://github.com/design-all-the-things/test-repo/pull/1.diff", | |
"patch_url":"https://github.com/design-all-the-things/test-repo/pull/1.patch", |
OlderNewer