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
% variables | |
One = 1. | |
Two = One + 1. | |
% atoms | |
atom. | |
'Hi I am an atom'. | |
another@_atom1. |
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
// 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 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 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 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 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
if ('ontouchstart' in window) { | |
// turn off click event | |
$(document) | |
.on('click', 'a', function(e) { | |
e.preventDefault(); | |
e.stopPropagation(); | |
}) | |
.on('tap', 'a', function(e) { | |
window.location.href = $(e.currentTarget).attr('href'); | |
}); |
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
(function ($) { | |
$.elementFromPoint = function (x, y) { | |
var moved = false; | |
var yo = window.pageYOffset; | |
var xo = window.pageXOffset; | |
var w = window.innerWidth; | |
var h = window.innerHeight; | |
if (yo > 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
// server | |
// redis client | |
var redisClient = redis.createClient(process.env.REDIS_PORT, process.env.REDIS_HOST); | |
redisClient.auth(process.env.REDIS_PASS); | |
// redis session store | |
var session = { | |
secret: 'your_secret', | |
store: new RedisStore({ client: redisClient }) |
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
(function ($) { | |
var matchers = { | |
'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/, | |
'MouseEvents': /^(?:click|dblclick|mouse(?:down|up|over|move|out))$/ | |
}; | |
var defaults = { | |
x: 0, | |
y: 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 Resource = (function () { | |
// static API | |
var api = (function () { | |
this.models = []; | |
this.add = function (model) { | |
// TODO: make model a real model | |
this.models.push(model); |