Skip to content

Instantly share code, notes, and snippets.

View mohitmayank's full-sized avatar
🎯
Focusing

Mohit Jain mohitmayank

🎯
Focusing
View GitHub Profile
@mohitmayank
mohitmayank / MultiSelect.js
Created July 10, 2013 18:13
backbone-form multi select editor using select2
define([
'underscore',
'backbone',
'backbone-forms',
'form-template',
'select2'
], function (_, Backbone) {
return Backbone.Form.editors.Select.extend({
attributes : {multiple : 'multiple'},
@philfreo
philfreo / model.js
Last active October 6, 2015 21:37
Backbone Model mutators / computed properties
var Model = Backbone.Model.extend({
/**
* Override main attribute getter to handle mutators.
* Looks for an object on the model called 'mutators', keyed by key name,
* with values of either the getter function or an object like:
* { get: function() {}, set: function() {} }
*/
get: function(attr) {
var val,