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() { | |
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { | |
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } | |
function ctor() { this.constructor = child; } | |
ctor.prototype = parent.prototype; | |
child.prototype = new ctor; | |
child.__super__ = parent.prototype; | |
return child; | |
}; | |
window.modules = window.modules || {}; |
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
# Establish the root object, `window` in the browser, or `global` on the server. | |
root = this | |
# Save any existing module | |
_previous = root.li | |
# Initialise the module | |
li = {} | |
# Export the module for server or browser |
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
"#{"test" + a + "asdasd"}" |
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 escapeString(string) { | |
string = string.replace(/\\/g, "\\\\"). | |
replace(/\n/g, "\\n"). | |
replace(/\r/g, "\\r"). | |
replace(/\t/g, "\\t"); | |
if (string.indexOf("'") < 0) { | |
return "'" + string + "'"; | |
} | |
string = string.replace(/"/g, "\\\""); |
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
OptionParser = require('coffee-script/optparse').OptionParser | |
switches = [ | |
['-h', '--help', 'Displays this wonderful, elucidative help message'] | |
['-v', '--version', 'Shows zappa version'] | |
['-p', '--port [NUMBER]', 'The port(s) the app(s) will listen on. Ex.: 8080 or 4567,80,3000'] | |
['-n', '--hostname [STRING]', 'If omitted, will accept connections to any ipv4 address (INADDR_ANY)'] | |
['-c', '--compile', 'Compiles the app(s) to a .js file instead of running them.'] | |
['-w', '--watch', 'Keeps watching the file and restarts the app when it changes.'] | |
] |
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
handler = (client, connection) -> | |
@log = (data, cb) -> | |
console.log data | |
node = dnode handler |
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
callbacks = foo: true, bar: true | |
callback = (handle) -> | |
delete callbacks[handle] | |
if callbacks.foo and callbacks.bar | |
# do something after foo and bar | |
# do some foo | |
some_async_method 'some string', -> | |
callback 'foo' |
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 frames = 0, last = 0; | |
setInterval(function () { | |
if (last) { | |
var fps = frames / (Date.now() - last) * 1000; | |
console.log('fps: ' + fps); | |
} | |
last = Date.now(); | |
frames = 0; | |
}, 1000); |
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
node.connect (remote) -> | |
client.__remote__ = remote | |
Backbone.sync = (args...) -> | |
[method, model, options] = args | |
packet = | |
method: method | |
callback: (response) -> | |
options.success response |
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
THREE.WebGLRenderer = (parameters) -> | |
_canvas = document.createElement 'canvas' | |
_gl = null | |
_oldProgram = null | |
_oldFramebuffer = null | |
_this = this | |
# gl state cache | |
_oldDoubleSided = null |