Skip to content

Instantly share code, notes, and snippets.


Gordon L. Hempton ghempton

View GitHub Profile
View gist:12b489b49a55e539762dc170c7fcc875
### Keybase proof
I hereby claim:
* I am ghempton on github.
* I am gordon ( on keybase.
* I have a public key whose fingerprint is D4FB AED6 9E30 D434 AC3D 17E3 E406 8EA9 1729 1FD0
To claim this, I am signing this object:
ghempton / react-link.js
Created Nov 26, 2014
React Link Helper
View react-link.js
View gist:be43107bf626284df9dc
Attempting to create a subclass of `Model` that supports
CP's and Ember.Observable.
function EmberModel() {
Model.apply(this, arguments);
return CoreObject.apply(this);
var PrototypeMixin = Model.prototype;
ghempton / gist:11389065
Created Apr 29, 2014
Transactional Route
View gist:11389065
`import Route from 'outreach/core/route'`
# Route which manages a transaction on it's content.
# E.g. when the route is exited, the transaction will
# be rolled back
class TransactionalRoute extends Route
resolveSession: (parentSession) ->
@session = parentSession.newSession()
View gist:11389007
`import CurrentUserMixin from 'outreach/core/current_user_mixin'`
`import Model from 'outreach/core/model'`
class Route extends Em.Route with CurrentUserMixin
title: ->
enter: ->
ghempton / gist:9882197
Created Mar 30, 2014
View gist:9882197 {
this.resources('post', {path: '/blog-posts/:post_id'}, function() {
this.resources('comments'); // assumes has-many called 'comments' and inverse called 'post'
this.resource('owner', {type: 'user'});
ghempton / route.em
Created Mar 5, 2014
Example of using EPF child sessions at the route level
View route.em
`import CurrentUserMixin from 'outreach/core/current_user_mixin'`
class Route extends Em.Route with CurrentUserMixin
beforeModel: (transition) ->
parentRoute = if transition.state.handlerInfos.length > 1
transition.state.handlerInfos[transition.state.handlerInfos.length - 2].handler
View dynamic_classes.js
// dynamically creating classes + computed properties
// result of ajax request, these are the fields and their dependencies
var fields = {'name': {'firstName', 'lastName'}};
var mixin = {};
for(var name in fields) {
ghempton / gist:4481055
Created Jan 8, 2013
Bug in new router. This test belongs in basic_test.js
View gist:4481055
test("Grandparent route context change", function() {
Ember.TEMPLATES.application = compile("{{outlet}}");
Ember.TEMPLATES.posts = compile("{{outlet}}"); = compile("{{outlet}}"); = compile("showing");
Ember.TEMPLATES.edit = compile("editing"); {
ghempton / ember-analytics.js
Created Oct 3, 2012
Drop in addition of analytics to Ember.js applications
View ember-analytics.js
enter: function(router) {
if(this.get('isLeafRoute')) {
var path = this.absoluteRoute(router);
mixpanel.track('page viewed', {'page name' : document.title, 'url' : path});
_gaq.push(['_trackPageview', path]);
You can’t perform that action at this time.