Skip to content

Instantly share code, notes, and snippets.

View patrickberkeley's full-sized avatar

Patrick Berkeley patrickberkeley

View GitHub Profile
import Component from '@glimmer/component'
import { inject as service } from '@ember/service';
import { get, computed } from '@ember/object';
export default class FastTable extends Component {
get tbody() {
const data = this.args.data;
const tbodyFragment = document.createDocumentFragment();
const tbody = document.createElement('tbody');
import Component from '@glimmer/component';
import { action } from '@ember/object';
export default class extends Component {
constructor(owner, args) {
super(owner, args);
console.time('table');
}
@patrickberkeley
patrickberkeley / controllers.application.js
Last active March 5, 2019 17:41
replaceWith Query Params
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
queryParams: ['some'],
some: null,
});
@patrickberkeley
patrickberkeley / adapters.asdf.js
Last active January 8, 2019 18:43
unloadRecord
import DS from 'ember-data';
export default DS.JSONAPIAdapter.extend({
async createRecord(store, type, snapshot) {
console.log('=====createRecord=====');
let payload = await this._super(store, type, snapshot);
let id = payload.data.id;
// This guard is needed in case the API responds to a create with
// an array. We can shim it into Ember Data with `normalize*` hooks
@patrickberkeley
patrickberkeley / component.js
Last active February 28, 2017 05:07
`ember-keyboard-manager` example usages.
import Ember from 'ember';
const {
get,
inject,
} = Ember;
export default Ember.Component.extend({
keyManager: inject.service(),
import Ember from 'ember';
export default Ember.Controller.extend({
somethingDownFromController: null
});
import Ember from 'ember';
const {
get,
set
} = Ember;
export default Ember.Controller.extend({
singleVal: '',
actions:{
import DS from 'ember-data';
export default DS.FixtureAdapter.extend();
import Ember from 'ember';
export default Ember.Controller.extend({
someProperty:'Ember Twiddle',
myComputedProperty: Ember.computed('someProperty', function(){
return {property: this.get('someProperty')};
})
});
import DS from 'ember-data';
export default DS.FixtureAdapter.extend();