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 bunyan = require('bunyan').createLogger({ | |
name: "foo", | |
streams: [ | |
{ | |
stream: process.stdout, | |
level: "trace" | |
} | |
] | |
}); |
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
// FROM THE SHELL | |
{ | |
"result" : "organizations_reduced_ecosystems", | |
"timeMillis" : 20827, | |
"counts" : { | |
"input" : 198751, | |
"emit" : 198740, | |
"reduce" : 26380, | |
"output" : 162220 |
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 mapByOrgID = function(){ | |
var orgID = this.OrgID; | |
if(orgID) | |
emit(orgID, { ecosystem: this.ecosystem }); | |
}; | |
var reduceEcosystems = function(key, values){ | |
var ret = { | |
orgID: key, | |
ecosystems: [] |
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 dbClient; | |
var ensureDbClient = function(callback){ | |
if(dbClient){ | |
console.info('ensureDbClient: returning existing client'); | |
return callback(null, dbClient); | |
} else { | |
console.info('ensureDbClient: returning NEW client'); | |
MongoClient.connect(mongoConnectionString, mongoConnectionOptions, function(err, db){ | |
if(err){ | |
return callback(err, null); |
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
start o=node(999) | |
match(o)-[:serves]->(i) | |
with count(distinct i) as total, o | |
match(o)-[:serves]->(i) | |
return distinct total, i.Industry limit 10; |
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 searchForSubject = function(model, event){ | |
_subjectSearchText = event.srcElement.value; | |
console.log(_subjectSearchText); | |
// simple first algorithm - | |
// wait for 1 second | |
// search if | |
// the search string is non-falsey | |
// the string at the start of the timeout is the same as the current | |
// the search string is at least 3 characters |
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 should = require('should'), | |
bugs = require('../bugs.js'); | |
describe('bugs', function(){ | |
describe('when creating a new bug', function(){ | |
describe('with no parameters', function() { | |
it('should return an error'); | |
}); | |
describe('with the default title parameter', function() { |
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
[ | |
{ | |
"Make":"Ford", | |
"Model":"Taurus", | |
"Vin":"1234", | |
"Forms" : [ | |
{ | |
"Uri":"...", | |
"Rel":"reservation", | |
"Mode":"POST", |
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 Bug(title, description) { | |
var self = this; | |
this.title = title; | |
this.description = description; | |
this.assignedTo = ''; | |
this.status = ''; | |
this.history = []; | |
function addToHistory(comments, stateChanges){ | |
self.history.push({ |
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
app.post('/bugs/working', function(req, res){ | |
db.bugs.find({_id:req.body.id}, function(err, doc){ | |
doc.activate(req.body.comments); | |
db.bugs.update({_id:req.body.id}, doc, function(err, updatedDoc){ | |
db.bugs.find({status:'Working'}, function(err, docs){ | |
res.render('bugs-all.html', { | |
title: "Working", | |
model: { bugs : docs }}); |