Skip to content

Instantly share code, notes, and snippets.

View Subtletree's full-sized avatar

Ryan Scott Subtletree

  • Wellington, New Zealand
View GitHub Profile
@Subtletree
Subtletree / components.foo-component.js
Last active September 16, 2017 04:57
Ember Twiddle Demo: Mirage with Ember Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
computedModel: Ember.computed('model.[]', function() {
return this.get('model').map(function(m) {
return `Computed: ${m.id}`;
});
}),
import Ember from 'ember';
import file from '../file';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
init() {
this._super(...arguments);
this.set('variable', file.variable);
},
@Subtletree
Subtletree / components.my-component.js
Created January 24, 2018 01:28 — forked from jpadilla/components.my-component.js
Component Lifecycle Hooks
import Ember from 'ember';
export default Ember.Component.extend({
didInitAttrs(options) {
console.log('didInitAttrs', options);
},
didUpdateAttrs(options) {
console.log('didUpdateAttrs', options);
},
@Subtletree
Subtletree / controllers.application.js
Created February 21, 2018 00:56 — forked from danielspaniel/controllers.application.js
FactoryGuy make/mockFindRecord
import Ember from 'ember';
export default Ember.Controller.extend({
});
import Ember from 'ember';
export default Ember.Component.extend({
});
@Subtletree
Subtletree / models.car.js
Last active March 27, 2018 03:24 — forked from ispiders/controllers.application.js
polymorphic example
import DS from 'ember-data';
import Ember from 'ember';
import { belongsTo, hasMany } from "ember-data/relationships";
export default DS.Model.extend({
make: DS.attr('string'),
owner: belongsTo('owner', { polymorphic: true })
});
import Ember from 'ember';
export default Ember.Controller.extend({
applicationController: Ember.inject.controller('application'),
config: Ember.computed.reads('applicationController.config'),
stats: Ember.computed.reads('applicationController.model.stats'),
chartOptions: Ember.computed("model.hashrate", {
get() {
console.log(this.get('model'));
var e = this,
@Subtletree
Subtletree / adapters.application.js
Last active August 30, 2018 01:03 — forked from YoranBrondsema/adapters.application.js
Non-async relationship bug (3.2.1)
import Adapter from "ember-data/adapters/json-api";
export default Adapter.extend();