Skip to content

Instantly share code, notes, and snippets.

@ef4
ef4 / controllers.application.js
Created August 26, 2019 01:18 — forked from jameshahn2/controllers.application.js
Alphabetical Table Grids
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@ef4
ef4 / components.alpha-grid.js
Last active August 26, 2019 01:58 — forked from jameshahn2/controllers.application.js
Alphabetical Table Grids
import Ember from 'ember';
export default Ember.Component.extend({
rows: Ember.computed('names', function() {
let names = this.get('names');
let columns = Math.floor($(window).width() / 100);
let itemsPerColumn = Math.ceil(names.length / columns);
let rows = [];
for (let rowNumber = 0; rowNumber < itemsPerColumn; rowNumber++) {
@ef4
ef4 / controllers.application.js
Last active June 3, 2019 07:44 — forked from samselikoff/controllers.application.js
Ember Animated boilerplate
import Ember from 'ember';
export default Ember.Controller.extend({
nothing() {}
});
import Ember from 'ember';
const { Component } = Ember;
export default class EachChunk extends Component {};
EachChunk.tagName = '';
EachChunk.reopenClass({
positionalParams: ['items', 'chunkSize']
@ef4
ef4 / application.controller.js
Last active May 25, 2018 13:42 — forked from wonderful123/application.controller.js
Component Subexpressions one-way by default?
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
valueList: [1, 2, 3, 4],
updateVal(index, newValue) {
this.set('valueList', this.valueList.map((oldValue, i) => index === i ? newValue : oldValue));
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
state: 'one',
actions: {
changeState: function(val){
this.set('state', val);
@ef4
ef4 / controllers.application.js
Last active June 14, 2016 20:06 — forked from samselikoff/controllers.application.js
Liquid Fire - child state updating
import Ember from 'ember';
export default Ember.Controller.extend({
foo: 'bar',
actions: {
toggleIsOpen() {
this.toggleProperty('isOpen');
}