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
| web: ./node_modules/.bin/coffee app.coffee |
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
| module.exports = [ | |
| { "name": "Brunch.io", "shortName": "brunch", "soId": "brunch", "_id": "514825fa2a26ea020000000b", "__v": 0 }, | |
| { "name": "C#", "shortName": "c#", "soId": "c#", "_id": "514825fa2a26ea020000000e", "__v": 0 } ] |
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
| module.exports = | |
| initialize: (sessionUserObject) -> | |
| (req, res, next) -> | |
| passport = @ | |
| passport._key = 'passport' | |
| passport._userProperty = 'user' | |
| passport.serializeUser = (user, done) -> done null, user | |
| passport.deserializeUser = (user, done) -> done null, user |
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
| """ BadassView add 3 basic bits of functionality to a normal Backbone.View | |
| 1) Auto-logging of initialize, render & save | |
| 2) Auto setting constructor args as attributes on view instances | |
| 3) Short elm() to access an html element based on it's name attribute | |
| """ | |
| module.exports = class BadassView extends Backbone.View | |
| # Set logging on /off | |
| # Why? : During dev it's handy to see the flow your views execute in | |
| logging: on |
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
| #!/bin/sh | |
| killall node | |
| brunch watch --server -c config-test.coffee & | |
| mocha test/server/all.coffee | |
| mocha-phantomjs http://localhost:3333/test/index.html |
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
| """ | |
| BadassRouter takes the philosophical position that only one router can be | |
| used for one html page / single page app. It is conceptually the top most | |
| container object other than window that contains all instances associated with the app. | |
| """ | |
| module.exports = class BadassRouter extends Backbone.Router | |
| # Set logging on /off - Very dandy during dev to see flow of routes | |
| logging: off |
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
| BB = require 'badass-backbone' | |
| M = require './models' | |
| V = require './views' | |
| # Inherit from BadassAppRouter to get Badass Backbone conventions | |
| module.exports = class Router extends BB.BadassAppRouter | |
| logging: on | |
| pushState: off # Set off for simple example |
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
| users = require './../data/users' | |
| data = users: [] | |
| data.users.anon = authenticated: false | |
| data.users.admin = users[0] | |
| data.users.jk = users[1] | |
| data.users.artle = users[5] | |
| data.users.beountain = users[4] | |
| setSession = (userKey) -> |
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 _JQ = document.createElement('script'); | |
| _JQ.src = 'http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js'; | |
| _JQ.type = 'text/javascript'; | |
| document.getElementsByTagName('head')[0].appendChild(_JQ); |
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 Author = { | |
| userId: { required: true, type: ObjectId, ref: 'User', index: true }, | |
| name: { required: true, type: String }, | |
| avatar: { required: true, type: String }, | |
| username: { type: String }, // if they are an expert | |
| tw: { type: String }, | |
| gh: { type: String }, | |
| in: { type: String }, | |
| gp: { type: String }, | |
| bio: { type: String } |