Skip to content

Instantly share code, notes, and snippets.

View ghempton's full-sized avatar

Gordon L. Hempton ghempton

View GitHub Profile
@ghempton
ghempton / async-routing-example.md
Created July 20, 2012 17:43
Async Routing Example

Example of the Need for Async Routing

App.Profile = DS.Model.extend({

});

App.User = DS.Model.extend({
  profile: DS.belongsTo(App.Profile)
@ghempton
ghempton / ember-controllers.md
Created July 18, 2012 21:16
Ember.js Controller Brainstorm

Ember.js Controller Brainstorm

Currently, there are several awkward points to Ember.js controllers. Namely:

  1. Passing controllers around to view's not instantiated by the routing system is hard.
  2. Non-singleton controllers are very difficult to manage (e.g. #each where each view has it's own controller).
  3. Sharing data between controllers is difficult.

Solution for 1 and 2: Controllers are lazily created by views

@ghempton
ghempton / safeClone.jquery.js.coffee
Created March 11, 2012 21:36
Small jQuery extension to clone elements without Ember/Metamorph metadata
# Small extension to create a clone of the element without
# metamorph binding tags and ember metadata
$.fn.extend
safeClone: ->
clone = $(@).clone()
# remove content bindings
clone.find('script[id^=metamorph]').remove()
@ghempton
ghempton / bound_helper.js
Created March 11, 2012 20:55
Ember Bound Handlebars Helper Utility
// This file contains utilities for creating bound helpers
// For reference: https://github.com/wagenet/ember.js/blob/ac66dcb8a1cbe91d736074441f853e0da474ee6e/packages/ember-handlebars/lib/views/bound_property_view.js
Ember.Handlebars.BoundHelperView = Ember.View.extend(Ember._Metamorph, {
context: null,
options: null,
property: null,
// paths of the property that are also observed
propertyPaths: [],