Skip to content

Instantly share code, notes, and snippets.

@pgte
Created January 7, 2011 16:48
Show Gist options
  • Save pgte/769716 to your computer and use it in GitHub Desktop.
Save pgte/769716 to your computer and use it in GitHub Desktop.
setup.js
(function setup(how_many, callback) {
var successful_ones = 0;
for (var i=0; i < how_many; i++) {
db.some_call('name', 'value', function(err) {
if (err) { callback (err); return; };
successful_ones ++;
if (successful_ones == how_many) {
callback();
}
});
}
})(3, callback);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment