Skip to content

Instantly share code, notes, and snippets.

View myndzi's full-sized avatar

Kris Reeves myndzi

  • Sigma Bold
  • Olympia, WA
View GitHub Profile
@myndzi
myndzi / json-loader.js
Last active August 29, 2015 14:07
Detect stream compression type and build json object on request object
//load modules
//var app = require('express')();
var http = require('http');
//var server = new http.Server();
var zlib = require('zlib');
var JsonLoader = require('./index');
var server = http.createServer(function (req, res) {
function next(err) {
'use strict';
var child_process = require('child_process');
var Promise = require('bluebird');
module.exports = Promise.method(function spawn(command, args, cwd) {
if (!command || !cwd) {
throw new Error("Both command and working directory must be given, not " + command + " and " + cwd);
}
if (args && !args.every(function (arg) {
{ penguinfrk: 784,
piper: 720,
Chew: 710,
goonerJimmy: 673,
Chopin: 664,
Blitz: 579,
shinanai: 522,
YaoHe: 485,
sonic: 480,
yida9900: 470,
setup complete. npm loves you!
npmE is now up and running!
[root@npm1 etc]# npme start
-bash: /usr/bin/npme: No such file or directory
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)
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)
'use strict';
var Rx = require('rx'),
PassThrough = require('stream').PassThrough;
var helpers = require('./helpers');
var pt = new PassThrough();
var select = require('./rx-select');
resource.get('/attributes', {
summary: 'Returns all Attributes',
queryParams: { 'locale': 'string' },
returns: ['Attribute']
}, function (params, response) {
return attrs.fetchAll(params);
});
cinema.locations = function () {
return parse.locationIds()
.map(function (locationId) {
return Promise.props({
postCode: parse.postCode(locationId),
movies: parse.movies(locationId)
});
});
};
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();