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
es = require 'event-stream' | |
dnode = require 'dnode' | |
MuxDemux = require 'mux-demux' | |
net = require 'net' | |
assert = require 'assert' | |
D = (send,recv) -> | |
d = dnode fn : (cb) -> cb(send) | |
d.on 'remote', (r) -> | |
assert r.fn |
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
colors = require 'colors' | |
es = require 'event-stream' | |
dnode = require 'dnode' | |
ss = require 'switch-stream' | |
server = -> | |
s = ss() | |
lobby = -> | |
d = dnode |
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
Layer.tick : (dT) -> | |
sprite_nodes.map (s) -> | |
loc = s.getLocation() | |
unless s.vel? | |
s.vel = cc.p (Math.random() - 0.5) * 10, (Math.random() - 0.5) * 10 | |
s.setLocation cc.p loc.x + s.vel.x * dT, loc.y + s.vel.y * dT | |
bboxes = sprite_nodes.map (n) -> n.getBoundingBox() |
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
Show hidden characters
{ | |
"cmd": ["scripts/build_script.sh"], | |
"working_dir" : "${project_path:${folder}}/..", | |
"shell": "true", | |
"path":"/usr/local/bin:$PATH" | |
} |
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
templ = { | |
"type" : "Layer", | |
"controller" : "MyLayerCtrl", | |
{ | |
"type" : "LabelTTF", | |
"repeat" : "x in friends", | |
"text" : "{{this.x}}", | |
"click" : "this.invite(this.x);" | |
} | |
} |
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
erver = cargoship() | |
server.get /.*/, (m) -> m.end() | |
gameserver = (create) -> | |
log.info 'game created', create.id, create.secret | |
players = [] | |
(m) -> | |
unless m? |
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
gen_scope = (parentScope) -> | |
Scope = -> | |
Scope.prototype = parentScope | |
new Scope() | |
a = gen_scope() | |
a.x = 1 | |
b = gen_scope a |
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
http://www.wolframalpha.com/input/?i=inv%28+%7B+%7B+a%2C+-b%2C+1%2C+0+%7D%2C+%7Bb%2C+a%2C+0%2C+1%7D%2C+%7B+c%2C+-d%2C+1%2C+0+%7D%2C+%7B+d%2C+c%2C+0%2C+1+%7D+%7D+%29+*+%7B+%7Bx%7D%2C+%7By%7D%2C+%7Bz%7D%2C+%7Bw%7D+%7D | |
calc = (p1, p2, q1, q2) -> | |
low = (a,b,c,d,x,y,z,w) -> | |
scale = 1/(a^2-2 a c+b^2-2 b d+c^2+d^2) | |
sct = -b w+d w+a x-c x+b y-d y-a z+c z | |
sst = -a w+c w-b x+d x+a y-c y+b z-d z | |
tx = z a^2-d w a-c x a+d y a-c z a+b c w+c^2 x+d^2 x-b d x-b c y+b^2 z-b d z | |
ty = w a^2-c w a-d x a-c y a+d z a+b^2 w-b d w+b c x+c^2 y+d^2 y-b d y-b c z) | |
[scale * sct, scale * sst, scale * tx, scale * ty] |
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
ship.use require 'cargoship-modules' | |
ship.register 'library', (a,next) -> | |
@require 'bank', (err,bank) -> | |
return next err if err | |
bank.get_library next | |
ship.use (m) -> | |
ship.require 'bank', 'library', (err,bank,library) -> |
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
ship.methods | |
get_campaigns : (event,data,next) -> | |
# get_campaigns 'login:alkka', @user, (err,result) -> | |
result.media | |
result.coupon | |
callback : (coupon,next) -> | |
per campaign |
OlderNewer