Skip to content

Instantly share code, notes, and snippets.

@cbrammer
cbrammer / base-item.json
Last active December 23, 2016 17:15
Proposed video Metadata data structure
{
"startSeconds": 100,
"endSeconds": 200
}
@cbrammer
cbrammer / base-item.json
Created December 22, 2016 17:59
Proposed video Metadata data structure
{
"type": "title",
"startSeconds": 100,
"endSeconds": 200
}
@cbrammer
cbrammer / gist:9231728
Created February 26, 2014 15:34
web server dieing
Error: Can't set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (http.js:691:11)
at ServerResponse.res.setHeader (/opt/node/app/node_modules/express/node_modules/connect/lib/patch.js:62:20)
at next (/opt/node/app/node_modules/express/node_modules/connect/lib/http.js:166:13)
at pass (/opt/node/app/node_modules/express/lib/router/index.js:219:24)
at nextRoute (/opt/node/app/node_modules/express/lib/router/index.js:209:7)
at callbacks (/opt/node/app/node_modules/express/lib/router/index.js:274:11)
at callbacks (/opt/node/app/node_modules/express/lib/router/index.js:277:9)
at callbacks (/opt/node/app/node_modules/express/lib/router/index.js:277:9)
at callbacks (/opt/node/app/node_modules/express/lib/router/index.js:277:9)
@cbrammer
cbrammer / gist:4698751
Created February 2, 2013 18:43
Example add to queue request on production
<dom:hashedKey>c0675fad08ef70e05c07a298bdd5377f29da41bf</dom:hashedKey>
<dom:publicKey>1yNyYjxLFYC6Hj1GlqjGkcHBCrXgE8fXHZ5fieKpIqZLKof2mnBqZBhtQ2UiRxrj</dom:publicKey>
<dom:userAuthenticationToken>0df68a68231e8c8781e950d2c8c03012d312aa7e</dom:userAuthenticationToken>
<dom:userHash>b05ce44f-4c3c-433e-ba41-03cdb2d67fa8</dom:userHash>
<user:equipmentKey>01</user:equipmentKey>
<user:machineSoftwareNumber>331771</user:machineSoftwareNumber>
<user:workoutId>QRPA9F1V</user:workoutId>
@cbrammer
cbrammer / log
Created November 28, 2012 01:22
Log Fail
{
"equipmentKey": "T0",
"softwareNumber": "323574",
"userId": "50b4ebb4549745245500fca3",
"completed": true,
"workoutGMTDate": "2012-11-28",
"workoutGMTTime": "01:18:13",
"startTime": 1354090693000,
"workoutSessionId": "2012112801181112",
"summary": [
@cbrammer
cbrammer / gist:4106980
Created November 18, 2012 19:18
workout manager crash on API
<13>Nov 18 12:15:06 ip-10-50-211-235 sketch-dev: error: ReferenceError: app is not defined pid=10191, env=development, app=api
<13>Nov 18 12:15:06 ip-10-50-211-235 sketch-dev: ReferenceError: app is not defined
<13>Nov 18 12:15:06 ip-10-50-211-235 sketch-dev: at /opt/node/app/node_modules/workout-manager/controllers/api.js:121:7
<13>Nov 18 12:15:06 ip-10-50-211-235 sketch-dev: at handleError (/opt/node/app/node_modules/mongoose/node_modules/hooks/hooks.js:92:18)
<13>Nov 18 12:15:06 ip-10-50-211-235 sketch-dev: at module.exports.hook.proto.(anonymous function)._next (/opt/node/app/node_modules/mongoose/node_modules/hooks/hooks.js:34:22)
<13>Nov 18 12:15:06 ip-10-50-211-235 sketch-dev: at fnWrapper (/opt/node/app/node_modules/mongoose/node_modules/hooks/hooks.js:159:8)
<13>Nov 18 12:15:06 ip-10-50-211-235 sketch-dev: at complete (/opt/node/app/node_modules/mongoose/lib/document.js:912:5)
<13>Nov 18 12:15:06 ip-10-50-211-235 sketch-dev: at Document.validate.err (/opt/node/app/node_modules/mongoose/lib/document.j
@cbrammer
cbrammer / gist:4106797
Created November 18, 2012 18:48
workout manager crash on API
<13>Nov 18 11:45:31 domU-12-31-39-01-B9-71 sketch-dev: error: ReferenceError: url is not defined pid=8891, env=production, app=api
<13>Nov 18 11:45:31 domU-12-31-39-01-B9-71 sketch-dev: ReferenceError: url is not defined
<13>Nov 18 11:45:31 domU-12-31-39-01-B9-71 sketch-dev: at Request._callback (/opt/node/app/node_modules/workout-manager/controllers/api.js:296:89)
<13>Nov 18 11:45:31 domU-12-31-39-01-B9-71 sketch-dev: at Request.init.self.callback (/opt/node/app/node_modules/workout-manager/node_modules/request/main.js:120:22)
<13>Nov 18 11:45:31 domU-12-31-39-01-B9-71 sketch-dev: at Request.EventEmitter.emit (events.js:99:17)
<13>Nov 18 11:45:31 domU-12-31-39-01-B9-71 sketch-dev: at Request.<anonymous> (/opt/node/app/node_modules/workout-manager/node_modules/request/main.js:633:16)
<13>Nov 18 11:45:31 domU-12-31-39-01-B9-71 sketch-dev: at Request.EventEmitter.emit (events.js:96:17)
<13>Nov 18 11:45:31 domU-12-31-39-01-B9-71 sketch-dev: at IncomingMessage.Request.start.self.req.self.httpModule.request.buffer
@cbrammer
cbrammer / drappall.js
Created November 16, 2012 17:05
Drop all mongo dbs
var dbs = db.getMongo().getDBNames()
for(var i in dbs){
db = db.getMongo().getDB( dbs[i] );
print( "dropping db " + db.getName() );
db.dropDatabase();
}
@cbrammer
cbrammer / README
Created November 15, 2012 18:36
Merging all
Add these files in a bin somewhere that is accessible via your PATH.
In any repo you can run `crossmerge B1 B2` for example: `crossmerge dev test`
To do this in all repos, to the parent directory of all the repos and run `mergeall dev test`
@cbrammer
cbrammer / fetch.js
Created November 15, 2012 16:46
Download tars from NPM
/**
* Fetch an HTTP url to a local file.
**/
var request = require("request")
, fs = require("graceful-fs")
, npm = require("../npm.js")
, url = require("url")
, log = require("npmlog")
, path = require("path")