Skip to content

Instantly share code, notes, and snippets.

@jrhe
jrhe / session.js
Last active August 29, 2015 14:28
import Ember from 'ember';
import Notify from 'ember-notify';
import Session from 'ember-simple-auth/services/session'
const {
Service,
computed,
isEmpty
} = Ember;
@jrhe
jrhe / gist:75b45949e51c41a0d3dd
Created June 18, 2015 21:42
Chained cp not firing
import Ember from 'ember';
import DS from 'ember-data';
// results is never updated apart from for the initial reference (from a template)
export default DS.Model.extend({
isNotSaving: Ember.computed.not('isSaving'),
isNotDirty: Ember.computed.not('isDirty'),
isSaved: Ember.computed.and('isNotSaving', 'isNotDirty'),
results: Ember.computed('isSaved', function() {
return ...;
export default Ember.Component.extend({
selectedTabIndex: 0,
...
}
@jrhe
jrhe / real app resolution
Created January 29, 2015 13:13
addon resolution
vendor-677ebc3d570315a9d25c81afd998f9f4.js:28585 [ ] template:components/dc-tabs ................................ devon-discovery/pods/dc-tabs/template
vendor-677ebc3d570315a9d25c81afd998f9f4.js:28585 [ ] template:components/dc-tabs ................................ devon-discovery/pods/components/dc-tabs/template
vendor-677ebc3d570315a9d25c81afd998f9f4.js:28585 [ ] template:components/dc-tabs ................................ undefined
vendor-677ebc3d570315a9d25c81afd998f9f4.js:28585 [ ] template:components/dc-tabs ................................ devon-discovery/templates/components/dc-tabs
vendor-677ebc3d570315a9d25c81afd998f9f4.js:28585 [ ] template:components/dc-tabs ................................ devon-discovery/pods/dc-tabs/template
vendor-677ebc3d570315a9d25c81afd998f9f4.js:28585 [ ] template:components/dc-tabs ................................ devon-discovery/pods/components/dc-tabs/template
vendor-677ebc3d570315a9d25c81afd998f9f4.js:28585 [ ] template:components/dc-tabs .............................
import DS from "ember-data";
import ENV from "devon-discovery/config/environment";
var ApplicationAdapter = DS.ActiveModelAdapter.extend({
namespace: ENV.api.namespace,
headers: {
'Accept': 'application/json',
},
serializePolymorphicType: function(record, json, relationship) {
var key = relationship.key;
@jrhe
jrhe / component.js
Created November 26, 2014 18:23
Observer problem
export default Ember.Component.extend({
selection: [],
columns: function() {
return this.get('columnDefinitions').map(function(colDef) {
return fluidColumn.create(colDef);
});
}.property('columnDefinitions'),
selectionChanged: function() {
console.log('in selection changed');
}.observes('selection'),
@jrhe
jrhe / gist:d78dd23970f2fddd9a45
Created November 26, 2014 18:18
Observer in component error
Uncaught TypeError: string is not a function vendor.js:30452 applyStrvendor.js:25950 sendEventvendor.js:28065 ObserverSet.flushvendor.js:28616 endPropertyChangesvendor.js:12747 DeferredActionQueues.flushvendor.js:12203 Backburner.endvendor.js:12249 Backburner.runvendor.js:30441 applyvendor.js:29057 runvendor.js:49234 __exports__.default.EmberObject.extend._bubbleEventvendor.js:49182 (anonymous function)vendor.js:4527 jQuery.event.dispatchvendor.js:4213 elemData.handle
~/D/P/c/test ❯❯❯ bundle gem test
create test/Gemfile
create test/Rakefile
create test/LICENSE.txt
create test/README.md
create test/.gitignore
create test/test.gemspec
create test/lib/test.rb
create test/lib/test/version.rb
Initializing git repo in /Users/jon/Documents/Projects/coffee_shit/test/test
{
  "meta": {
    "total" : 6039391,
    "took" : 65,
    "timed_out" : false,
    "shards" : {
 "total" : 5,
Ember.SimpleAuth.Authenticators.OAuth2.reopen({
serverTokenEndpoint: ENV.api.host + '/' + ENV.api.namespace + '/oauth/token'
});
// customize the session so that it allows access to the account object
Ember.SimpleAuth.Session.reopen({
user: function() {
var resourceOwnerId = this.get('resource_owner_id');
if (!Ember.isEmpty(resourceOwnerId)) {
return this.container.lookup('store:main').find('user', resourceOwnerId);