Skip to content

Instantly share code, notes, and snippets.

Jed Watson JedWatson

View GitHub Profile
@JedWatson
JedWatson / async.js
Last active Jan 3, 2016 — forked from getify/async.js
Another refactor of a refactor, this time w/o all original comments but w/ proposals. Not currently possible with asynquence, but maybe? *nudge*
View async.js
var transform = function(contents, doneTransform) {
var authExpiry = 60 * 60 * 1000,
authId = uuid.v4(),
authKey = 'file:auth:' + authId;
redis.client.set(authKey, JSON.stringify({
userId: req.user.id
}));
redis.client.expire(authKey, authExpiry);
@JedWatson
JedWatson / async.js
Last active Jan 3, 2016 — forked from getify/gist:8459026
Comparison between (my) old callback-structured code, @getify's asynquence refactor, and my async refactor
View async.js
var doQuery = function() {
// passing an object to async.parallel will cause it to collect their results
// and provide them to the callback in an object with the same keys.
async.parallel({
// functions are passed a callback with the standard argument pattern of fn(err, result)
count: count.exec,
query: query.exec
}, function(err, results) {
You can’t perform that action at this time.