Skip to content

Instantly share code, notes, and snippets.

View 525c1e21-bd67-4735-ac99-b4b0e5262290's full-sized avatar

525c1e21-bd67-4735-ac99-b4b0e5262290

View GitHub Profile
(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 || {};
# 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
"#{"test" + a + "asdasd"}"
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, "\\\"");
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.']
]
handler = (client, connection) ->
@log = (data, cb) ->
console.log data
node = dnode handler
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'
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);
node.connect (remote) ->
client.__remote__ = remote
Backbone.sync = (args...) ->
[method, model, options] = args
packet =
method: method
callback: (response) ->
options.success response
THREE.WebGLRenderer = (parameters) ->
_canvas = document.createElement 'canvas'
_gl = null
_oldProgram = null
_oldFramebuffer = null
_this = this
# gl state cache
_oldDoubleSided = null