Skip to content

Instantly share code, notes, and snippets.

@zdwolfe
zdwolfe / gist:4120940
Created November 20, 2012 20:42
Mongoose returning invalid JSON
...
clientID = '1234';
...
models.Client.find({clientID: clientID}, function(err, client) {
console.log('ClientPasswordStrategy client = ' + client);
console.log('client.clientID = ' + client.clientID);
}
Output:
server.serializeClient(function(clientString, done) {
// @TODO for some reason clientJSON is not valid JSON
console.log('clientString = ' + clientString);
var client = JSON.parse(clientString);
console.log('_id = ' + client._id);
console.log('name = ' + client.name);
console.log('secret = ' + client.secret);
done(null, client._id);
});
@zdwolfe
zdwolfe / gist:4186143
Created December 2, 2012 00:36
MIPS datapath in Verilog beq instruction branching to one word too high
restart -f
# Refreshing C:/Users/zdw5010/Documents/331/mipsverilog/work.Driver
# Loading work.Driver
# Refreshing C:/Users/zdw5010/Documents/331/mipsverilog/work.Datapath
# Loading work.Datapath
run -all
# 0 Driver.dp write regs
# 5 Driver Clock = 1
# 5 Driver.dp fetch PC = 00000000 IR = 00000000, Instruction Number = 000
# 5 Driver.dp decode
@zdwolfe
zdwolfe / gist:4575753
Created January 19, 2013 23:06
find $or problem
models.User.find({ $or: [{"username":String(reqUsername)},{"email":String(reqEmail)}]}, function(err, user) {
console.log('user = ' + JSON.stringify(user));
});
/home/zach/src/Event-Playlist/node_modules/imagemagick/imagemagick.js:126
prop[comps[0].trim().toLowerCase()] = comps[1].trim()
^
TypeError: Cannot set property '22' of undefined
at parseIdentify (/home/zach/src/Event-Playlist/node_modules/imagemagick/imagemagick.js:126:45)
at null.callback (/home/zach/src/Event-Playlist/node_modules/imagemagick/imagemagick.js:155:18)
at Accumulator.finish (/home/zach/src/Event-Playlist/node_modules/imagemagick/imagemagick.js:60:55)
at ChildProcess.<anonymous> (/home/zach/src/Event-Playlist/node_modules/imagemagick/imagemagick.js:86:11)
at ChildProcess.EventEmitter.emit (events.js:99:17)
% Zachary Wolfe
% wolfe.zach@gmail.com
% CMPSC 456 SPR 2013
function [aQR, rQR, aMGS, rMGS, aCHOL, rCHOL] = fit()
t = 0:0.05:1;
V = vander(t);
X = V(:,17:21);
b = sin(pi*t);
b = b'; % make b a column vector
[
{
"name": "foo",
"number": "bar",
"errors": [3, 5]
},
{
"name": "foo2",
"number": "bar2",
"errors": [1, 2]
@zdwolfe
zdwolfe / gist:5204460
Created March 20, 2013 13:01
Log of example Reddit Passport Strategy
127.0.0.1 - - [Wed, 20 Mar 2013 13:00:27 GMT] "GET /login HTTP/1.1" 200 45 "http://127.0.0.1:3000/login" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Ubuntu Chromium/24.0.1312.56 Chrome/24.0.1312.56 Safari/537.17"
127.0.0.1 - - [Wed, 20 Mar 2013 13:00:27 GMT] "GET /favicon.ico HTTP/1.1" 404 - "-" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Ubuntu Chromium/24.0.1312.56 Chrome/24.0.1312.56 Safari/537.17"
127.0.0.1 - - [Wed, 20 Mar 2013 13:00:30 GMT] "GET /account HTTP/1.1" 302 68 "-" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Ubuntu Chromium/24.0.1312.56 Chrome/24.0.1312.56 Safari/537.17"
127.0.0.1 - - [Wed, 20 Mar 2013 13:00:30 GMT] "GET /login HTTP/1.1" 200 45 "-" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Ubuntu Chromium/24.0.1312.56 Chrome/24.0.1312.56 Safari/537.17"
127.0.0.1 - - [Wed, 20 Mar 2013 13:00:30 GMT] "GET /favicon.ico HTTP/1.1" 404 - "-" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTM
<?php echo '<p>Hello World</p>'; ?>
ncaught Error: Attempted to handle event `willSetProperty` on <Travis.Build:ember3526:5882247> while in state rootState.loaded.reloading. Called with {reference: [object Object], store: <Travis.Store:ember464>, name: _duration}