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
upstream app_server { | |
server 127.0.0.1:7000; | |
keepalive 64; | |
} | |
server { | |
listen 80; | |
# listen 443 ssl; | |
server_name viviz.bettr.es www.viviz.bettr.es; |
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
// utils | |
var slice = Array.prototype.slice; | |
var concat = Array.prototype.concat; | |
var flatten = function(l) { return concat.apply([], l); }; | |
// really stupid DSL | |
function nodeOrTextNode(n) { | |
if (typeof(n) === "object") |
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 extend() { | |
return Array.prototype.reduce.call(arguments, function(acc, el) { | |
for (var k in el) if (el.hasOwnProperty(k)) acc[k] = el[k]; | |
return acc; | |
}); | |
} | |
function klass(parent, props) { | |
var F = (props && props.init) || function() { return parent.apply(this, arguments); }; | |
F.prototype = extend(Object.create(parent.prototype), props); |
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
define(function(require, exports, module) { | |
"use strict"; | |
var Backbone = require("backbone"), | |
_ = require("underscore"); | |
function maybeApply(fn, ctx, args) { | |
if (fn) { | |
return fn.apply(ctx, args); | |
} |
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
define(function(require, exports, module) { | |
"use strict"; | |
var Backbone = require("backbone"), | |
_ = require("underscore"); | |
/* The extractor determines the order of the cascading */ | |
/* shift = bottom first */ | |
var extractor = "shift"; | |
/* pop = top first */ |
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
// Use invoker to generate the invoker directly | |
// and be able to manipulate it. The key is that | |
// the invoker allways invokes on "this". | |
var invoker = function(method) { | |
var args = [].slice.call(arguments, 1); | |
return function() { | |
var newargs = [].slice.call(arguments); | |
return this[method].apply(this, args.concat(newargs)); | |
}; |
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
/* jshint ignore:start */ | |
var bot = (function() { | |
var timeline = 0; | |
return function bot (timeout) { | |
function evter(evt, sel) { | |
var args = [].slice.call(arguments, 2); | |
return function() { var $n; ($n = $(sel))[evt].apply($n, args); }; | |
} | |
return function(evt, node) { |
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 dynamicCollision(agent1, agent2) { | |
function getAngle(v) { | |
return Math.atan2(v.y, v.x); | |
} | |
function normalize(v) { | |
var m = vdistance({ x: 0, y: 0 }, v); | |
return { x: v.x/m, y: v.y/m }; | |
} |
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 segmentIntersection(a, b) { | |
var denom = (((b[1].y - b[0].y) * (a[1].x - a[0].x)) - | |
((b[1].x - b[0].x) * (a[1].y - a[0].y))); | |
if (denom === 0) { return null; } | |
var ua = ((((b[1].x - b[0].x) * (a[0].y - b[0].y)) - | |
((b[1].y - b[0].y) * (a[0].x -b[0].x))) / denom); | |
var ub = ((((a[1].x - a[0].x) * (a[0].y - b[0].y)) - | |
((a[1].y - a[0].y) * (a[0].x - b[0].x))) / denom); |
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
/* jshint node: true, laxcomma: true */ | |
/* global __dirname */ | |
/* Dependencies */ | |
"use strict"; | |
var express = require("express") | |
, Q = require("q") | |
, auth = require("./simpleauth") | |
, MongoClient = require("mongodb").MongoClient |