This file contains 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 mongoose = require('mongoose'), | |
Schema = mongoose.Schema, | |
ObjectId = Schema.ObjectId; | |
var myS = new Schema({ | |
name: {type: String, required: true} | |
}); | |
var My = mongoose.model('My', myS); | |
var my = new My({'name': 'bika'}); |
This file contains 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 tobi = require('tobi'), | |
browser = tobi.createBrowser(8000, "localhost"); | |
json_browser = (function(){ | |
var json_header = {headers: | |
{ | |
"Accept": "application/json", | |
"X-Requested-With": "XMLHttpRequest" | |
} | |
}; |
This file contains 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 Db = require('mongodb').Db; | |
//... | |
options.noOpen = true; | |
myDb = Db.connect(mongouri, options); | |
// or | |
options.noOpen = false; |
This file contains 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 backbone_validation = require('backbone-validation'); | |
backbone_validation(app, '/libs/backbone-validation.js'); | |
// and access the browser side validation with | |
// <script src="/libs/backbone-validation.js"></script> |
This file contains 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
/* Pretend app setup stuff is here */ | |
/* Kick off app */ | |
jQuery(function($) { | |
var Gallery = app.module("gallery"); | |
app.Router = Backbone.Router.extend({ | |
routes: { | |
"add": "main_add" |
This file contains 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
(function() { | |
// Save a reference to the global object. | |
var root = this; | |
/* do stuff */ | |
root.public_method = function() {}; | |
}).call(this); |
NewerOlder