Skip to content

Instantly share code, notes, and snippets.

View mde's full-sized avatar

Matthew Eernisse mde

View GitHub Profile
var
// $ npm install model@0.2.10
model = require( 'model'),
Adapter = require('./node_modules/model/lib/adapters/memory/').Adapter,
adapter = new Adapter({});
var User = function () {
this.adapter = adapter;
this.property('login', 'string', {required: true});
this.property('password', 'string', {required: true});
@mde
mde / gist:6100679
Last active December 20, 2015 08:29 — forked from admc/gist:6100677
var User = function () {
this.hasMany('Messages');
this.hasMany('ConversationMemberships');
this.hasMany('Conversations', {through: 'ConversationMembership'});
};
var Conversation = function () {
this.hasMany('Messages');
this.hasMany('ConversationMemberships');
this.hasMany('Users', {through: 'ConversationMembership'});
var Item = function () {
this.defineProperties({
name: {type: 'string'}
});
this.findByName = function (name, callback) {
geddy.model.Item.all({name: name}, callback);
}
}
@mde
mde / gist:2689923
Created May 13, 2012 19:50 — forked from johnmdonahue/gist:2671849
How to handle pre-req flow using Jake.exec
var spawn = require('child_process').spawn;
desc('Do thing 1');
task('thing1', [], function () {
var cmds = ['node -e "console.log(\'--> Thing 1... Executing\')"'];
console.log('--> Thing 1... Starting');
jake.exec(cmds, function () {
var echo = spawn('echo',