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 exec = require('child_process').exec; | |
var redis = require("redis"); | |
var when = require('when'); | |
var client; | |
exports.startServer = function () { | |
exec('redis-server'); | |
} | |
exports.stopServer = function () { |
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 Promise(context) { | |
this.context = context || this; | |
this.success = []; | |
this.error = []; | |
} | |
Promise.prototype.then = function (success, error) { | |
if (success) { | |
if (this.resolved) { | |
success.apply(this.context, this.resolved); |
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
Backbone.Service = function (options) { | |
this.options = options || {}; | |
this.ctx = options.context || this; | |
this.endpoints = this.parseEndpoints(options.endpoints); | |
_(this.endpoints).each(this.createMethod, this); | |
}; | |
Backbone.Service.prototype.parseEndpoints = function (endpoints) { | |
return _(endpoints).map(function (value, key) { | |
var endpoint = { name: key }; |
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
// balancer node | |
var httpProxy = require('http-proxy'); | |
var uuid = require('node-uuid'); | |
var Cookies = require('cookies'); | |
var redis = require('redis'); | |
var connect = require('connect'); | |
var express = require('express'); | |
var RedisStore = require('connect-redis')(express); | |
var redisClient = redis.createClient(); | |
var port = 8000; |
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
% variables | |
One = 1. | |
Two = One + 1. | |
% atoms | |
atom. | |
'Hi I am an atom'. | |
another@_atom1. |
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 () { | |
"use strict"; | |
/** | |
* DB constructor | |
* | |
* @param {Object} options | |
* @param {Function} callback | |
*/ |
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 () { | |
"use strict"; | |
var Logger = this.Logger = function ($el) { | |
this.$logger = $el; | |
this.timers = {}; | |
} | |
Logger.prototype.stop = function (label) { |
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
//viewport for https://github.com/scttnlsn/backbone.viewkit | |
var NamedViewSelector = Backbone.ViewKit.ViewPort.extend({ | |
constructor: function (options) { | |
options || (options = {}); | |
this._views = options.views || {}; | |
_.each(this._views, function(view) { | |
view.viewSelector = this; | |
}, this); |
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
// resources gathered around inheritance and Object.create | |
// http://ericleads.com/2012/09/stop-using-constructor-functions-in-javascript/ | |
// https://speakerdeck.com/anguscroll/parlez-vous-javascript | |
// http://dailyjs.com/2012/06/04/js101-object-create/ | |
// inheritance via prototype | |
// both constructors A, B are initialized | |
function A() { | |
console.log("init A"); | |
this.log = "A"; |
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
// modules (one per file) | |
(function (namespace) { | |
"use strict"; | |
// implementation | |
})(namespace); | |
// files.js (loaded in dev) |