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 util = require('util'); | |
var colors = require('colors'); | |
var moment = require('moment'); | |
var logentries = require('node-logentries'); | |
var sinon = require('sinon'); | |
var log = logentries.logger({ | |
token:process.env.LOGENTRIES_TOKEN | |
}); |
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 async = require('async'); | |
var ids = []; | |
var requestInfoTasks = ids.map(function (id) { | |
return function (callback) { | |
db.query(id, function (err, data) { | |
if (err) { | |
return callback(err); | |
} | |
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, |
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); | |
}); |
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' |
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? |
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, |
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; |
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'; |
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) { |