This file contains 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 app = require('express')() | |
, server = require('http').createServer(app) | |
, io = require('socket.io').listen(server); | |
server.listen(80); | |
var subscribers = {}; | |
var publishMessage = function(channel, message) { | |
var sockets = subscribers[channel]; |
This file contains 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 Promise = require('es6-promise').Promise; | |
// idea borrowed from Q.spread | |
Promise.prototype.spread = function(fn) { | |
return this.then(function() { | |
if (!arguments || arguments.length === 0) { | |
return fn.apply(); | |
} | |
return fn.apply(null, arguments[0]); | |
}); |
This file contains 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 Promise = require('es6-promise').Promise; | |
var promisify = function (obj, func) { | |
return function () { | |
var args = Array.prototype.slice.call(arguments, 0); | |
return new Promise(function (resolve, reject) { | |
args.push(function (err, result) { | |
if (err) { | |
reject(err); | |
} else { |
This file contains 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 bootstrapRow = function(cols, names) { | |
var snippets = _.map(cols, function(col) { | |
return "<div class='col-md-" + col + "'></div>"; | |
}); | |
var regions = {}; | |
_.each(names, function(name, index) { | |
regions[name] = ">:nth-child(" + (index+1) + ")"; | |
}); | |
var GridLayout = Backbone.Marionette.Layout.extend({ | |
className: "row", |