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 express = require('express'), | |
| passport = require('passport'), | |
| LocalStrategy = require('passport-local').Strategy, | |
| connect = require('connect'), | |
| http = require('http'), | |
| path = require('path'), | |
| util = require('util'), | |
| fs = require('fs'), | |
| redis = require('redis'), | |
| cookie = require('cookie'), |
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
| // Which do you prefer more? | |
| // trigger event and get out | |
| var vent = _.extend({}, Backbone.Events); | |
| App.Router = Backbone.Router.extend({ | |
| routes: { | |
| 'show/:id': 'show' | |
| }, | |
| show: function(id) { |
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
| /*global define:false */ | |
| define(['backbone','underscore','deferred'], function (B, _, flow) { | |
| /** | |
| * @constructor | |
| */ | |
| var AsyncCollection = B.Collection.extend({ | |
| initialize: function () { | |
| // if the initialize function is overriden in an | |
| // extended class of AsyncCollection, ensure |
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 Resourceful = require('resourceful'); | |
| var tagFilter = { | |
| map: function (post) { | |
| post.tags.forEach(function (tag) { | |
| emit(tag, 1); | |
| }); | |
| }, | |
| reduce: function(keys, values) { |
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 flatiron = require('flatiron') | |
| , connect = require('connect') | |
| , path = require('path') | |
| , fs = require('fs') | |
| , plates = require('plates') | |
| , director = require('director') | |
| , util = require('util') | |
| , keys = require('./auth_keys') | |
| , passport = require('passport') | |
| , TwitterStrategy = require('passport-twitter').Strategy |
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 application_root = __dirname, | |
| express = require("express"), | |
| path = require("path"), | |
| mongoose = require('mongoose'); | |
| var app = express.createServer(); | |
| // database | |
| mongoose.connect('mongodb://localhost/ecomm_database'); |
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
| // this will find all files ending with _test.js and run them with Mocha. Put this in your package.json | |
| "scripts": { | |
| "test": "find ./tests -name '*_test.js' | xargs mocha -R spec" | |
| }, |