(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
/** | |
* Moves a model to the given index, if different from its current index. Handy | |
* for shuffling models about after they've been pulled into a new position via | |
* drag and drop. | |
*/ | |
Backbone.Collection.prototype.move = function(model, toIndex) { | |
var fromIndex = this.indexOf(model) | |
if (fromIndex == -1) { | |
throw new Error("Can't move a model that's not in the collection") | |
} |
/** | |
* @author Anatoly Mironov (mirontoli) | |
* http://sharepointkunskap.wordpress.com | |
* http://www.bool.se | |
* | |
* http://stackoverflow.com/questions/3605495/generate-a-list-of-localized-language-names-with-links-to-google-translate/14800384#14800384 | |
* http://stackoverflow.com/questions/10997128/language-name-from-iso-639-1-code-in-javascript/14800499#14800499 | |
* | |
* using Phil Teare's answer on stackoverflow | |
* http://stackoverflow.com/questions/3217492/list-of-language-codes-in-yaml-or-json/4900304#4900304 |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.