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 dependencies. | |
*/ | |
var express = require('express'), | |
fs = require('fs'); | |
var app = module.exports = express.createServer(); | |
var port = (app.settings.env == 'test') ? 8000 : 3001; |
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
// Calls done when db is finished connecting | |
exports.dbReady = function(done) { | |
var db = require('../../models/db'); | |
switch (db.state) { | |
case 'connected': | |
done(); | |
break; | |
case 'connecting': | |
db.once('open', done); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
<link rel="stylesheet" href="../libs/mocha.css" type="text/css" media="screen" title="no title" charset="utf-8"> | |
</head> | |
<body> | |
<div id="mocha"></div> | |
<script src="../libs/mocha.js" type="text/javascript" charset="utf-8"></script> |
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 Backbone.View to have a "close" function. | |
* Unbind all triggers and events. | |
* Save an array of all bound events to unbind | |
* Define onClose on views to clean up model/collection listeners | |
*/ | |
define(function(require) { | |
var Backbone = require('use!libs/backbone/backbone'), | |
_ = require('use!underscore'); |
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 config:true, task:true*/ | |
config.init({ | |
options: { | |
templates: { | |
namespace: "tmpl", | |
dir: 'templates' | |
} | |
}, | |
pkg: '<json:package.json>', | |
test: { |
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
I have a schema that looks like this: | |
band: { | |
albums: [ | |
{ tweets: [ | |
{ tweet }, { tweet } | |
] } | |
] | |
} | |
I want to add the band (doc) if it doesn't exist. |
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
checkExisting: function() { | |
var existing = $(this.id)[0]; | |
if (existing) this.setElement(existing); | |
}} |
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
js | |
model | |
user.js | |
test | |
test.js | |
Error: Calling node's require("model/user") failed with error: Error: Cannot find module 'model/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
({ | |
appDir: "../js", | |
baseUrl: "./", | |
dir: "../js-deploy", | |
//Comment out the optimize line if you want | |
//the code minified by UglifyJS | |
optimize: "none", | |
paths: { | |
'app' : 'app', |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<title>Page Title</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript" charset="utf-8"></script> | |
<script src="http://documentcloud.github.com/underscore/underscore-min.js" type="text/javascript" charset="utf-8"></script> | |
<script src="http://documentcloud.github.com/backbone/backbone-min.js" type="text/javascript" charset="utf-8"></script> | |
</head> |