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
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'
handler = (client, connection) ->
@log = (data, cb) ->
console.log data
node = dnode handler
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.']
]
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, "\\\"");
"#{"test" + a + "asdasd"}"
# 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
(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 || {};
window.modules = {}
modules.test = (require, module) ->
module.exports = ->
console.log 'game created'
window.require = (->
library = {}
require = (handle) ->
getForks 'schacon', 'ruby-git', (callback) ->
count = 0
forkedRepoCount = 0
target = 0
for fork in callback.network
createdDate = new Date(fork.created_at)
pushedDate = new Date(fork.pushed_at)
if createdDate > pushedDate
// ==================================================================
// browser code in development
// locked into on of these options
//
// 1) using a special XHR synchronous script loader and
// a) seeing poor error messages with strange line numbering
// not corresponding with source code line numbering or
// b) using a JavaScript interpreter written in JavaScript
// to execute the code retrieved by the XHR. Line numbers