Skip to content

Instantly share code, notes, and snippets.

@aearly
aearly / async1.js
Created April 27, 2017 01:50
Async exaxmple 1
async.eachLimit(files, 3, function (file, callback) {
fs.readFile(file, function(err, contents) {
if (err) return callback(err)
doSomethingWith(contents)
callback();
})
}, function (err) {
// hooray we're done
})
@aearly
aearly / keybase.md
Created April 12, 2017 19:09
keybase.md

Keybase proof

I hereby claim:

  • I am aearly on github.
  • I am aearly (https://keybase.io/aearly) on keybase.
  • I have a public key ASCYWSsEQQlBwEa7eM-I42XwIs3UcAMkYuJXEyIpai5R8go

To claim this, I am signing this object:

@aearly
aearly / index.js
Last active August 29, 2015 14:13
requirebin sketch
var async = require("async");
var functions = [];
for(var i = 0; i < 10000; i++) {
functions.push(function leaky(next) {
function func1(cb) {return cb(); }
function func2(callback) {
if (true) {
@aearly
aearly / Gruntfile.js
Last active June 24, 2016 06:43
Annotated Browserify Gruntfile
/**
* Annotated Gruntfile.
* This builds a Backbone/Marionette application using Dust.js (Linkedin fork) as a
* templating system, as well as some helpers from Foundation, with Browserify.
* It also configures a watcher and static server with live reload.
*/
module.exports = function (grunt) {
// This automatically loads grunt tasks from node_modules
require("load-grunt-tasks")(grunt);
@aearly
aearly / Gruntfile.js
Last active December 22, 2015 21:08
Yeoman modified for CommonJS/Browserify
"use strict";
var LIVERELOAD_PORT = 35729;
var lrSnippet = require("connect-livereload")({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
return connect.static(require("path").resolve(dir));
};
// # Globbing
// for performance reasons we"re only matching one level down:
// "test/spec/{,*/}*.js"
@aearly
aearly / mapFunctions.js
Created May 21, 2013 18:15
async.mapFunctions - map a list of functions to a single item
function asyncify(fn) {
return function (option, callback) {
var res;
try {
res = fn(option);
} catch (err) {
return callback(err);
}
callback(null, res);
}