View proc.js
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
async.waterfall([ | |
download, | |
process, | |
upload | |
], function (err, results) { | |
if (err) { | |
return console.error('processing failed, error: ', err); | |
} | |
console.log('processing completed, results: ', results); | |
}); |
View aggregate.js
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
function aggregate(callback) { | |
mongo.items.aggregate([ | |
{ | |
$match: {created: {$gte: timespan.from, $lt: timespan.to}} | |
}, | |
{ | |
$group: { | |
_id: { | |
url: '$source', | |
item: '$itemId' |
View 1.js
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
// which is better? | |
function f() { | |
// returns object.. takes some cpu to complete | |
} | |
// this one? | |
return f().one || f().two; | |
// that one? |
View collections.json
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
/* 0 */ | |
{ | |
"_id" : ObjectId("533be1949421f7c070000007"), | |
"followers" : [ | |
{ | |
"_id" : ObjectId("533be1949421f7c070000005"), | |
"email" : "1396433300606@tests.com" | |
} | |
], | |
"public" : false, |
View patch.js
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
var _ = require('underscore'); | |
var through = require('through'); | |
var moment = require('moment'); | |
var logger = require('../source/utils/logger'); | |
var log = require('single-line-log'); | |
function run(db, callback) { | |
var started = moment(); | |
var patched = 0; |
View nostreams.js
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
var config = require('../config'); | |
var db = require('./db')(config); | |
function readUsers(callback) { | |
db.users.find({unsubscribed: {$exists: false}, firstTimeUser: {$exists: false}}).forEach(function (err, user) { | |
if (err) { | |
throw callback(err); | |
} | |
if (!user) { |
View auth.spec.js
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
var request = require('request'); | |
var testUtils = require('../utils'); | |
var moment = require('moment'); | |
var crypto = require('crypto'); | |
describe('auth.spec.js', function () { | |
var authUrl, url, payload, error, response, body; | |
beforeEach(function () { | |
authUrl = testUtils.getRootUrl() + '/api/auth'; |
View base64.js
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
function base64(data) { | |
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; | |
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, ac = 0, enc="", tmp_arr = []; | |
if (!data) { | |
return data; | |
} | |
data = utf8Encode(data); |
View logger.js
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
require('colors'); | |
var util = require('util'); | |
var moment = require('moment'); | |
var logentries = require('node-logentries'); | |
var config = require('../../config'); | |
var stub = require('./stub'); | |
var log = logentries.logger({ | |
token: config.logentries.token, |
View modej.js
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
var tenancy = require('../utils/tenancy'); | |
function shiftsModel(mongo) { | |
function create(user, shift, callback) { | |
mongo.shifts.save(tenancy(user, shift), tenancy(callback)); | |
} | |
function getByWeek(user, week, callback) { | |
mongo.shifts.find(tenancy(user, {week: +week}), tenancy(callback)); |
OlderNewer