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
| require('streamline').register({ | |
| fibers: true, | |
| cache: true, | |
| verbose: true | |
| }); | |
| var argv = require('optimist') | |
| .usage('Usage: $0 -r streamlineFilePath') | |
| .demand(['r']) | |
| .argv; |
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 login_callbacks(email, password, onCompletion) { | |
| db.crudOp('account', 'read', {conditions:{email:email}}, function (error, dbAccount) { | |
| if (error) { | |
| return onCompletion(error, null); | |
| } | |
| bcrypt.compare(password, dbAccount.password_hash, function (error, match) { | |
| if (error) { | |
| return onCompletion(error, null); | |
| } | |
| if (!match) { |
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 app = express.createServer(); | |
| var verbs = ['get', 'post', 'put', 'delete']; // whatever verbs you want to patch here... | |
| patchExpressForStreamlineMiddleware(app, verbs, noop); | |
| // now, you can make a call like this: | |
| // app.get('/mypath', myStreamlineFunction) | |
| // and have it work correctly. sequences of middleware will work too: | |
| // app.get('/mypath2', myStreamlineFunction1, myStreamlineFunction2, myStreamlineFunction3) | |
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
| /*** Generated by streamline 0.8.1 (fibers) - DO NOT EDIT ***/var fstreamline__ = require("streamline/lib/fibers/runtime"); (fstreamline__.create(function(_) {var test_ = fstreamline__.create(test, 0), foo_ = fstreamline__.create(foo, 0); function test(_) { | |
| foo(_); | |
| fstreamline__.invoke(null, bar, [_], 0); | |
| }; | |
| function foo(_) { | |
| // set a breakpoint on the next line | |
| console.log('should not print before breakpoint hit'); | |
| console.log('should print after breakpoint hit'); | |
| } |
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 zlib = require('zlib'); | |
| test(_); | |
| function test(_) { | |
| var startTime = new Date(); | |
| var items = []; |
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 zlib = require('zlib'); | |
| var iteration = 0; | |
| var maxRss = 0; | |
| (function leak() { | |
| if (iteration % 1000 === 0) { | |
| var usage = process.memoryUsage(); |