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
$.ajaxSetup({ | |
beforeSend: function(xhr) { | |
xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content')); | |
} | |
}); |
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 SomeModel = Backbone.Model.extend({}); | |
someModel = new SomeModel(); | |
someModel.bind("change", function(model, collection){ | |
alert("You set some_attribute to " + model.get('some_attribute')); | |
}); | |
someModel.set({some_attribute: "some value"}); |
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 SomeModel = Backbone.Model.extend({}); | |
someModel = new SomeModel(); | |
someModel.bind("change", function(model, collection){ | |
alert("You set some_attribute to " + model.get('some_attribute')); | |
}); | |
someModel.set({some_attribute: "some value"}); |
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 findKey(obj, value){ | |
var key; | |
_.each(_.keys(obj), function(k){ | |
var v = obj[k]; | |
if (v === value){ | |
key = k; | |
} | |
}); |
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
Meteor.publish 'paths', (since) -> | |
pointHandles = {} | |
publishPath = (pathId) => | |
pointHandles[pathId] = Points.find({pathId: pathId}).observe | |
added: (obj) => | |
@set('points', obj._id, obj) | |
@flush() | |
# these two should never happen | |
changed: (obj) => |
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
// This needs tidied up before production TODO | |
var country_list = ["Afghanistan","Albania","Algeria","Andorra","Angola","Anguilla","Antigua & Barbuda","Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahamas" | |
,"Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bosnia & Herzegovina","Botswana","Brazil","British Virgin Islands" | |
,"Brunei","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Cape Verde","Cayman Islands","Chad","Chile","China","Colombia","Congo","Cook Islands","Costa Rica" | |
,"Cote D Ivoire","Croatia","Cruise Ship","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea" | |
,"Estonia","Ethiopia","Falkland Islands","Faroe Islands","Fiji","Finland","France","French Polynesia","French West Indies","Gabon","Gambia","Georgia","Germany","Ghana" | |
,"Gibraltar","Greece","Greenland","Grenada","Guam","Guatemala","Guernsey","Guinea","Guinea Bis |
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
MyApp.module('MyApp.SomeBuilder', function(SomeBuilder, App, Backbone, Marionette, $, _){ | |
'use strict'; | |
// Controller | |
// ---------- | |
SomeBuilder.Controller = Marionette.Controller.extend({ | |
initialize: function(options){ | |
this.navbarRegion = options.navbarRegion; | |
this.mainRegion = options.mainRegion; |
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
class Backbone.Marionette.StackRegion extends Backbone.Marionette.Region | |
constructor: -> | |
super | |
@views = [] | |
# Return the top view (currently visible) | |
peek: -> | |
@views[@views.length - 1] if @views.length |
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
// Router for Pages | |
Session.set("currentPage", null); | |
var SimpleRouter = Backbone.Router.extend({ | |
routes: { | |
"": "index", | |
"signup": "signup" | |
}, | |
index: function () { | |
console.log("router : index") | |
Session.set("currentPage", "index"); |
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
Accounts.createUser( | |
{email:"[email protected]", password:"password"} | |
,function(e,r){ | |
if(e){ | |
console.error(e) | |
}else{ | |
var me = Meteor.user(); | |
console.log("created", me); | |
} |
OlderNewer