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 toServer = csp.chan(); | |
| var throttled = throttle(toServer); | |
| csp.go(function* () { | |
| var msg; | |
| while (true) { | |
| msg = yield csp.take(toServer); | |
| if (msg === csp.CLOSED) { return; } | |
| console.log(msg); |
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 items = [huge array]; | |
| var concurrency = 5, i = items[0], x = items.length; | |
| return Promise.map(new Array(concurrency), function next(val) { | |
| if (i === items.length) { return; } | |
| return getData(items[i++]).then(next); | |
| }); |
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
| # /etc/rsyslog.conf Configuration file for rsyslog. | |
| # | |
| # For more information see | |
| # /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html | |
| # | |
| # Default logging rules can be found in /etc/rsyslog.d/50-default.conf | |
| ################# | |
| #### MODULES #### |
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
| async.auto({ | |
| get_data: function(callback){ | |
| callback(null, 'data', 'converted to array'); | |
| }, | |
| make_folder: function(callback){ | |
| callback(null, 'folder'); | |
| }, | |
| write_file: ['get_data', 'make_folder', function(callback, results){ | |
| callback(null, 'filename'); | |
| }], |
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
| module.exports = function (app) { | |
| if (!app.config.get('app.logRequests')) { return; } | |
| var mountPaths = app.config.get('swag.mountPaths'); | |
| var apiRE = new RegExp('^'+mountPaths.api.replace('/', '\\/')+'\\/'); | |
| app.use(function (req, res, next) { | |
| if (!apiRE.test(req.url)) { return next(); } | |
| var start = process.hrtime(); |
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
| cinema.locations = function () { | |
| return parse.locationIds() | |
| .map(function (locationId) { | |
| return Promise.props({ | |
| postCode: parse.postCode(locationId), | |
| movies: parse.movies(locationId) | |
| }); | |
| }); | |
| }; |
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
| resource.get('/attributes', { | |
| summary: 'Returns all Attributes', | |
| queryParams: { 'locale': 'string' }, | |
| returns: ['Attribute'] | |
| }, function (params, response) { | |
| return attrs.fetchAll(params); | |
| }); |
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
| 'use strict'; | |
| var Rx = require('rx'), | |
| PassThrough = require('stream').PassThrough; | |
| var helpers = require('./helpers'); | |
| var pt = new PassThrough(); | |
| var select = require('./rx-select'); |
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
| https://github.com/Reactive-Extensions/RxJS/blob/v2.3.18/dist/rx.all.js#L9048 | |
| https://github.com/CSSLint/parser-lib/blob/v0.2.5/release/node-parserlib.js#L905 | |
| https://github.com/CSSLint/parser-lib/blob/v0.2.5/release/node-parserlib.js#L417 | |
| /home/myndzi/backitup/node_modules/rx/dist/rx.all.js:9048 | |
| throw e; | |
| ^ | |
| Error | |
| at /home/myndzi/backitup/node_modules/parserlib/lib/node-parserlib.js:417:25 | |
| at Object.<anonymous> (/home/myndzi/backitup/node_modules/parserlib/lib/node-parserlib.js:905:3) | |
| at Module._compile (module.js:460:26) |
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 Promise = require('bluebird'); | |
| var db = ... pg connection ... | |
| var bcrypt = require('bcrypt'); | |
| Promise.promisifyAll(db, { suffix: '$' }); | |
| Promise.promisifyAll(bcrypt, { suffix: '$' }); | |
| function hashPassword(plaintext) { | |
| return bcrypt.genSalt$(10) |