Skip to content

Instantly share code, notes, and snippets.

@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));
});
@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
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: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: