Skip to content

Instantly share code, notes, and snippets.

View mrienstra's full-sized avatar

Michael Rienstra mrienstra

  • Olympic Peninsula, WA
View GitHub Profile
@mrienstra
mrienstra / gist:1905551
Created February 25, 2012 02:57 — forked from 4bu/gist:1472559
var PersonModel = Backbone.Model.extend();
var PersonView = Backbone.View.extend({
initialize: function () {
this.model.bind('change:name', _.bind(this.render, this));
},
render: function () {
$('body').html(this.model.get('name'));
}
});
@mrienstra
mrienstra / gist:1905442
Created February 25, 2012 02:44 — forked from 4bu/gist:1472552
window.person = new Person;
var myCallback = function(personModel, enteredName) {
alert(‘Hello’ + enteredName);
};
person.bind('change:name', myCallback);
person.promptName();