I hereby claim:
- I am aseemk on github.
- I am aseemk (https://keybase.io/aseemk) on keybase.
- I have a public key whose fingerprint is 8FD7 03E6 42A7 B1CD 6D50 07F4 4929 0166 F879 0B95
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
echo = console.log | |
Request = require 'request' | |
BASE_URL = 'http://localhost:7474' | |
# helper to make transactional requests: | |
req = (_, {query, params, commit, rollback, txId}) -> | |
method = if rollback then 'DELETE' else 'POST' | |
url = "#{BASE_URL}/db/data/transaction" |
$ node-streamline -c truthy_.js | |
$ node-streamline -c true_.js | |
/usr/lib/node/.npm/streamline/0.1.11/package/lib/transform.js:1549 | |
throw new Error(message); | |
^ | |
Error: error streamlining source: Missing identifier on line 5 | |
at Object.transform (/usr/lib/node/.npm/streamline/0.1.11/package/lib/transform.js:1549:10) | |
at /usr/lib/node/.npm/streamline/0.1.11/package/lib/compile.js:48:30 | |
at /usr/lib/node/.npm/streamline/0.1.11/package/lib/compile.js:43:206 |
// streamline.options = { "callback": "_cb" } | |
var _ = require('underscore'); | |
var array = [1, 2, 3]; | |
function process(item, _cb) { | |
// simulate async task | |
setTimeout(_cb, 1000); | |
return item; | |
} |
console.log('will throw error in one second...'); | |
try { | |
// simulate async step here: | |
setTimeout(_, 1000); | |
// then *synchronously* throw error here: | |
(function closure() { | |
throw new Error(); | |
})(); |
// here's an example third-party, out-of-my-control function. | |
// it calls the callback with multiple non-error values: | |
function addAndProfile_original(x, y, callback) { | |
var start = Date.now(); | |
return setTimeout(function () { | |
var time = Date.now() - start; | |
callback(null, x + y, time); | |
}, 1000); | |
} |
coffee = require 'coffee-script' | |
streamline = require 'streamline' | |
fs = require('fs') | |
if require.extensions | |
require.extensions['.coffee'] = (module, filename) -> | |
content = coffee.compile fs.readFileSync filename, 'utf8' | |
if filename.match /_\.coffee$/ | |
content = streamline.transform.transform content | |
module._compile content, filename |
var express = require('express'); | |
var app = express.createServer(); | |
app.configure(function () { | |
app.use(app.router); | |
}); | |
app.set('views', __dirname + '/views'); | |
app.set('view engine', 'html'); | |
app.register('.html', require('eco')); |
var express = require('express'); | |
var app = express.createServer(); | |
app.configure(function () { | |
app.use(require('./blocks')(app)); | |
app.use(app.router); | |
}); | |
app.set('views', __dirname); | |
app.set('view engine', 'html'); |