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 asynchronousIterator(limit, f1) { | |
var sum = 0; | |
var limit = 3; | |
fAsync(limit, function(res) { | |
console.log("Intermediate result", res); | |
sum += res; | |
limit--; | |
if(limit === 0){ | |
f1(sum); |
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 _ = require('lodash'); | |
var async = require('async'); | |
var db = require('../lib/mongoskin'); | |
async.waterfall([ | |
function(cb) { db.collections(cb); }, | |
function(collections, cb) { | |
async.map(collections, function(collection, cb) { | |
var data = { |
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
// DEFINITION: | |
// Can be used with generals functions | |
// x.js | |
module.exports = function(a, b, $container) { // If has $container property, container will be passed | |
$container.injectProperties(this); // Can be used list from $injectProperties to reduce constructor param list | |
}; | |
exports.$require = [ // preloads modules - BEFORE init. Already accessible in $container | |
__dirname + '/subfolder_1' |
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 bunyan = require('bunyan'); | |
var syslog = require('bunyan-syslog'); | |
var bunyanInstance = bunyan.createLogger({ | |
name: 'bunyan-syslog-test', | |
streams: [{ | |
level: 'trace', | |
type: 'raw', | |
stream: syslog.createBunyanStream({ | |
type: 'sys', |
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
module Models | |
module CommandRunner | |
def self.included(base) | |
base.class_eval do | |
@commands = [] | |
class << self; | |
attr_reader :commands; | |
def command name, options=nil | |
commands.add_command name, options | |
end |
NewerOlder