Skip to content

Instantly share code, notes, and snippets.

Jamie White jgwhite

Block or report user

Report or block jgwhite

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jgwhite
jgwhite / controllers.application.js
Last active Jun 18, 2019
readOnly('foos.@each.bars')
View controllers.application.js
import Ember from 'ember';
import { readOnly } from '@ember/object/computed';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
foos: [{
bars: ['a', 'b']
}, {
@jgwhite
jgwhite / controllers.application.js
Last active Oct 17, 2018
Confirms and Prompts with Tasks
View controllers.application.js
import Ember from 'ember';
import { task, waitForProperty, timeout } from 'ember-concurrency';
const promptTask = task({
answer: undefined,
* perform() {
yield waitForProperty(this, 'answer', a => a !== undefined);
return this.answer;
}
View components.x-editor.js
import Ember from 'ember';
export default Ember.Component.extend({
tagName: '',
willDestroyElement() {
this.get('model').rollbackAttributes();
}
});
View SketchSystems.spec
IdP Config Flow
SSO Not Installed
Click begin setup -> SSO Not Configured
SSO Not Configured
Submit valid configuration -> SSO Disabled
Submit valid configuration with enabled true -> SSO Enabled
SSO Enabled
Submit enabled false -> SSO Disabled
SSO Disabled
Submit enabled true -> SSO Enabled
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
showForm: false
});
@jgwhite
jgwhite / mirage-scenarios-default.js
Last active Feb 28, 2018
Persisting Mirage’s DB in development
View mirage-scenarios-default.js
// mirage/scenarios/default.js
export default function(server) {
function store() {
let data = server.db.dump();
let json = JSON.stringify(data);
localStorage.mirage = json;
}
View foo.js
import { focus, triggerKeyEvent } from '@ember/test-helpers';
import findButton from './find-button';
import { calculateTabsTo } from './tabbability';
const KEY_RETURN = 13;
export default async function keyboardClick(text) {
let element = findButton(text);
if (!element) {
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
items: ['one', 'two', 'three', 'four'],
reorderItems(newOrder) {
this.set('items', newOrder);
},
up(item) {
View helpers.add.js
import Ember from 'ember';
export function add(numbers) {
return numbers.reduce((sum, n) => sum + n);
}
export default Ember.Helper.helper(add);
View components.x-bar.js
import Ember from 'ember';
export default Ember.Component.extend({
changeSomething() {
this.set('data', Math.random());
}
});
You can’t perform that action at this time.