Skip to content

Instantly share code, notes, and snippets.

View meredian's full-sized avatar
🦆
Because ducks can!

Anton Sidelnikov meredian

🦆
Because ducks can!
View GitHub Profile
@meredian
meredian / collections.js
Created September 21, 2015 11:03
Short example for working with async massively
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 = {
@meredian
meredian / junk.js
Created April 12, 2015 04:18
molecule usage project
// 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'
@meredian
meredian / index.js
Created January 19, 2015 10:31
Short test for bunyan-syslog module
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',
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