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
// Create a sound with fallback sound files | |
var sound = new Howl({ | |
urls: ['sound.mp3', 'sound.ogg'] | |
}); | |
// Play sound | |
sound.play(); |
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
/* | |
A simple task list app with standard sidebar and main area design | |
_______________________ | |
| | | | |
|sidebar| main | | |
|_______|_______________| | |
*/ | |
// Define a LayoutView and its Regions | |
var AppLayoutView = Backbone.Marionette.LayoutView.extend({ |
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
// Task ItemView | |
var TaskView = Backbone.Marionette.ItemView.extend({ | |
template: "#task-template" | |
}); | |
// CollectionView of Task ItemViews | |
var TasksCollectionView = Backbone.Marionette.CollectionView.extend({ | |
childView: TaskView | |
}); |
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
'use strict'; | |
Marionette.SortedCollectionView = Marionette.CollectionView.extend({ | |
/** | |
* Given a model, function tries to find the correct itemView based on the | |
* model's cid. Returns itemview or null | |
* @param model | |
* @return itemView/null | |
*/ |
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 _loader(array){ | |
var flat = []; | |
for (var i = 0, l = array.length; i < l; i++){ | |
var type = Object.prototype.toString.call(array[i]).split(' ').pop().split(']').shift().toLowerCase(); | |
if (type) { flat = flat.concat(/^(array|collection|arguments|object)$/.test(type) ? _flat(array[i]) : array[i]); } | |
} | |
return flat; | |
} |
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
div{ | |
position: absolute; | |
height: 50px; | |
width: 200px; | |
} | |
.center-horizontally{ | |
left: 50%; | |
margin-left: -100px; |