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
# client = ... | |
class User | |
constructor: (call_when_created) -> | |
m = client.multi() | |
m.incr "user_id" | |
m.get "user_id", (e, r) -> | |
@id = parseInt r, 10 |
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
$ npm install docco | |
npm info it worked if it ends with ok | |
npm info using npm@0.3.7 | |
npm info using node@v0.4.0 | |
npm ERR! Error parsing json /usr/local/lib/node/.npm/docco/0.3.0/package/package.json | |
npm ERR! parse error SyntaxError: Unexpected token } | |
npm ERR! parse error at Object.parse (native) | |
npm ERR! parse error at /usr/local/lib/node/.npm/npm/0.3.7/package/lib/utils/read-json.js:71:17 | |
npm ERR! parse error at P (/usr/local/lib/node/.npm/npm/0.3.7/package/lib/utils/read-json.js:62:40) |
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
class Suite | |
constructor: (options={ | |
foo: '...' | |
bar: '...'}) -> | |
if @constructor.instance | |
throw new Error 'Please use Suite.getInstance()' | |
else | |
@constructor.instance = this |
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
((exports) -> | |
# ... | |
)(if exports? then exports else @mymodule = {}) | |
# vs | |
((exports) -> | |
# ... |
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
((exports) -> | |
# ... | |
)(if exports? then exports else @mymodule = {}) |
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 = require 'http' | |
server = http.createServer (req, res) -> | |
res.writeHead 200, {'Content-Type': 'text/plain'} | |
res.end 'Hello World\n' | |
server.listen 8124, "127.0.0.1", () -> | |
console.log 'Server running at http://127.0.0.1:8124/' |
1 if x 2 else if y 3 else if z
-->
if x 1 else if y
CHCMF[H]: (coord to coord)-mapping format[, with hashes]
- CCMF: (Closure's format)
- CCMFH: (Closure's format) + (backward-compatible extras)
Let json_encode be a JSON encoder such that no linebreaks occur in its output.