Skip to content

Instantly share code, notes, and snippets.

View garrettwilkin's full-sized avatar

Garrett Wilkin garrettwilkin

View GitHub Profile
@garrettwilkin
garrettwilkin / Output.txt
Created October 5, 2012 15:08
Java double experiments.
gw@airy ~/> java Reps
a: 1.0
b: 0.35
c: 0.65
d: 0.35
e: 0.035
f: 0.034999999999999996
g: 0.06999999999999999
@garrettwilkin
garrettwilkin / gist:3729265
Created September 15, 2012 18:46
Krispin node douche error
/Users/gw/Code/douche/lib/douche/wsdl.js:48
var name = operation_tag['@']['name'];
^
TypeError: Cannot read property 'name' of undefined
at WSDL._read_xml (/Users/gw/Code/douche/lib/douche/wsdl.js:50:34)
at WSDL.parse (/Users/gw/Code/douche/lib/douche/wsdl.js:21:10)
at IncomingMessage.WSDL._get (/Users/gw/Code/douche/lib/douche/wsdl.js:108:7)
at IncomingMessage.EventEmitter.emit (events.js:115:20)
at IncomingMessage._emitEnd (http.js:366:10)
at HTTPParser.parserOnMessageComplete [as onMessageComplete] (http.js:149:23)
@garrettwilkin
garrettwilkin / gist:3724263
Created September 14, 2012 19:46
Attempting to add new mapping to piratespeak.dictiony "up","aloft"
When I execute this URL in my browser:
http://query.yahooapis.com/v1/public/yql?q=insert%20into%20piratespeak.dictionary%20(english_term%2C%20pirate_term)%20values%20(%22up%22%2C%20%22aloft%22)%3B&format=json&env=store%3A%2F%2Fkid666.com%2Fpiratespeak&callback=cbfunc
I get this response:
cbfunc({"query":{"count":1,"created":"2012-09-14T19:42:19Z","lang":"en-US","results":{"result":"Ahoy mate! Ye doth added ye Pirate term \"aloft\" for yonder English term \"up\""}}});
It looks good, but if i go back to the console and get the URL to list everything in piratespeak.dictionary,
@garrettwilkin
garrettwilkin / TileMill.log
Created September 9, 2012 00:39
TileMill crash on startup
gw@airy ~/Code> vim /Users/gw/Library/Logs/TileMill.log
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
@garrettwilkin
garrettwilkin / gist:3642610
Created September 5, 2012 19:00 — forked from Southern/gist:3642328
What the scope?
function findHandler(err, docs) {
if (!err) {
// Return Success & JSON Content-type
var length = docs.length;
writeMeta(self.res,200,url,length);
// Process results from Mongo
docs.forEach(function(e,i,a) {
//console.log(e,i,a);
@garrettwilkin
garrettwilkin / gist:3642279
Created September 5, 2012 18:39
What the scope?
I want to use a function so that i dont have to write the same logic over and over again in my calls to the find function on my MongoDb collections.
Here's the function I want, but notice that it contains 'self.res'. That's cause i just ripped it out of my find(...) call (below). Previously, when this was just an annoymous function, self.res is the HTTP response that we're building.
So how to i access self.res in my callback, if I use a named function, instead of an anonymous function in my find?
function findHandler(err, docs) {
if (!err) {
// Return Success & JSON Content-type
var length = docs.length;
@garrettwilkin
garrettwilkin / gist:3638347
Created September 5, 2012 15:24
Weird ACCES error ???
Not sure why I would get EACCES. on Deployment:
gw@airy ~/C/HackerClubProjectOne> jitsu logs
info: Welcome to Nodejitsu garrettwilkin
info: jitsu v0.9.8
info: It worked if it ends with Nodejitsu ok
info: Executing command logs app
info: Attempting to load logs for /Users/gw/Code/HackerClubProjectOne/package.json
For what it's worth, I've verified that the db connection works on my mac and also from my Linode server.
Maybe there's a discrepancy in the package versions?
The error message seems to indicate that the mongo database object is not created properly.
=========================================
APPLICATION LOGS (latest at top)
=========================================
[09/04 01:38:58 EDT] TypeError: Cannot read property '_serverState' of undefined
gw@airy ~/C/HackerClubProjectOne> jitsu env list
info: Welcome to Nodejitsu garrettwilkin
info: jitsu v0.9.8
info: It worked if it ends with Nodejitsu ok
info: Executing command env list
info: Attempting to load env variables for app /Users/gw/Code/HackerClubProjectOne/package.json
info: Listing all environment variables for HackerClubProjectOne
data: {
data: MONGO_USER: 'njitsu',
data: NODE_ENV: 'production',
@garrettwilkin
garrettwilkin / gist:3616531
Created September 4, 2012 04:20
Another failed deploy
gw@airy ~/C/HackerClubProjectOne> jitsu deploy
info: Welcome to Nodejitsu garrettwilkin
info: jitsu v0.9.8
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing application dependencies in main.js
warn: Local package version appears to be old
warn: The package.json version will be incremented automatically
warn: About to write /Users/gw/Code/HackerClubProjectOne/package.json
data: