This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var model = require('model'); | |
var Adapter = require('../node_modules/model/lib/adapters/mongo').Adapter; | |
var User = require('../app/models/user.js').User; | |
var Reel = require('../app/models/reel.js').Reel; | |
var Video = require('../app/models/video.js').Video; | |
var modelAdapter = new Adapter({ | |
dbname:config.mongo.path, | |
host:config.mongo.host, | |
port:config.mongo.port, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var utils = require('utilities') | |
, assert = require('assert') | |
, currentId | |
, tests | |
, testItems | |
, Zooby = require('../fixtures/zooby').Zooby | |
, User = require('../fixtures/user').User | |
, Profile = require('../fixtures/profile').Profile | |
, Account = require('../fixtures/account').Account; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
User.verifyPassword = function (password, hash, callback) { //You need a callback because bcrypt.compare is async | |
bcrypt.compare(password, hash, function(err, isMatch) { | |
callback(err, isMatch); | |
}); | |
} | |
//Usage: | |
exports.User.verifyPassword(password, user.password, function(err, isMatch) { | |
if(err) { | |
console.log("Error!"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Extend your own models from BaseModel from now on | |
* e.g. `MyApp.Models.Zooby = BaseModel.extend({etc:etc})`; | |
* | |
* TODO: Don't forget to override `parse()` in your model. | |
* It should be something like `return data.modelName;` | |
* TODO: Don't forget to handle errors! Check data.errors for them. | |
*/ | |
var BaseModel = Backbone.Model.extend({ | |
methodUrl: function(method) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** Running tests/adapters.js *** | |
test dummy ctor | |
test dummy before | |
test dummy put | |
A | |
B | |
C | |
D | |
test dummy get | |
E |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var build = path.relative(__dirname, '_shared') | |
, src = path.relative(__dirname, '_shared_sources') | |
, buildLessFile = path.join(build, 'css', 'styles.css') | |
, lessFiles = [ | |
"css/video-js.css" | |
, "css/elastislide.css" | |
, "css/jquery.fancybox.css" | |
, "css/jquery.fancybox-buttons.css" | |
, "css/jquery.fancybox-thumbs.css" | |
, "css/bootstrap.css" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MILK:geddy-model omnomnomben$ git log | |
commit a487945cf187869679e5ef646f2ffff0589a53e6 | |
Merge: 31af941 7a60fca | |
Author: Matthew Eernisse <[email protected]> | |
Date: Sun Jun 30 22:04:35 2013 -0700 | |
Merge pull request #70 from ben-ng/fix-memory-like | |
Fix memory LIKE & bugfix in mongo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var assert = require('assert') | |
, cmd = require('../../lib/cmd') | |
, Cmd = cmd.Cmd | |
, tests; | |
tests = { | |
'Cmd parseArgs gen app defaults': function () { | |
console.log("FOO"); | |
var c = new Cmd(['app', 'foo'], {}); | |
assert.equal('gen:app[foo,default,default]', c.jakeTaskName); |
OlderNewer