Created
October 18, 2011 23:49
-
-
Save leobalter/1297100 to your computer and use it in GitHub Desktop.
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 Song = Backbone.Model.extend({ | |
defaults: { | |
name: "Not specified", | |
artist: "Not specified" | |
}, | |
initialize: function() { | |
console.log("Music is the answer"); | |
} | |
}), Album = Backbone.Collection.extend({ | |
model: Song | |
}), song1 = new Song({ | |
name: "How Bizarre", | |
artist: "OMC" | |
}), song2 = new Song({ | |
name: "Sexual Healing", | |
artist: "Marvin Gaye" | |
}), song3 = new Song({ | |
name: "Talk It Over In Bed", | |
artist: "OMC" | |
}), myAlbum = new Album([ song1, song2, song3 ]); | |
console.log(myAlbum.models); |
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 a = "</script>"; // => var a="<\/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
function f(a, b, c, d, e) { | |
var q; | |
var w; | |
w = 10; | |
q = 20; | |
for (var i = 1; i < 10; ++i) { | |
var boo = foo(a); | |
} | |
for (var i = 0; i < 1; ++i) { | |
var boo = bar(c); | |
} | |
function foo(){ /*...*/ } | |
function bar(){ /*...*/ } | |
function baz(){ /*...*/ } | |
} |
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
function f(a, b, c) { | |
var f, g, h, i; | |
function j() {} | |
function k() {} | |
g = 10, f = 20; | |
for (h = 1; h < 10; ++h) i = j(a); | |
for (h = 0; h < 1; ++h) i = k(c); | |
} |
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 Song = Backbone.Model.extend({ | |
defaults: { | |
name: "Not specified", | |
artist: "Not specified" | |
}, | |
initialize: function() { | |
console.log("Music is the answer"); | |
} | |
}); | |
var Album = Backbone.Collection.extend({ | |
model: Song | |
}); | |
var song1 = new Song({ name: "How Bizarre", artist: "OMC" }); | |
var song2 = new Song({ name: "Sexual Healing", artist: "Marvin Gaye" }); | |
var song3 = new Song({ name: "Talk It Over In Bed", artist: "OMC" }); | |
var myAlbum = new Album([ song1, song2, song3]); | |
console.log(myAlbum.models); // [song1, song2, song3] |
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 Song=Backbone.Model.extend({defaults:{name:"Not specified",artist:"Not specified"},initialize:function(){console.log("Music is the answer")}}),Album=Backbone.Collection.extend({model:Song}),song1=new Song({name:"How Bizarre",artist:"OMC"}),song2=new Song({name:"Sexual Healing",artist:"Marvin Gaye"}),song3=new Song({name:"Talk It Over In Bed",artist:"OMC"}),myAlbum=new Album([song1,song2,song3]);console.log(myAlbum.models) |
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
obj.toString() // => obj+"" | |
new Array(1, 2, 3, 4) // => [1,2,3,4] | |
Array(a, b, c) // => [a,b,c] | |
new Array(5) // => Array(5) | |
new Array(a) // => Array(a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment