Skip to content

Instantly share code, notes, and snippets.

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());
}
});
View word.md

TL;DR Ember added contains before it was slated for ES7. When the contains (now includes) spec did arrive, it was a bit of a problem that Ember was “squatting” the method name with a slightly different implementation. Fortunately, Ember had been designed to “eventually align” with javascript as it becomes more capable. Thus, this was the moment prototype extensions were retired as a default.

@jgwhite
jgwhite / components.x-beacon.js
Created Jul 14, 2017
didReceiveAttrs vs. didChange
View components.x-beacon.js
import Ember from 'ember';
export default Ember.Component.extend({
condition: false,
risingEdgeOnly: true,
count: 0,
tagName: '',
didReceiveAttrs() {
this._super(...arguments);
@jgwhite
jgwhite / glimmer-application.diff
Last active Apr 14, 2017
Passing web components attributes to glimmer components
View glimmer-application.diff
==> https://github.com/glimmerjs/glimmer-application/compare/master...jgwhite:attributes
diff --git a/src/application.ts b/src/application.ts
index 3ae3a49..e16e6b8 100644
--- a/src/application.ts
+++ b/src/application.ts
@@ -39,7 +39,8 @@ export interface AppRoot {
id: number,
component: string | ComponentDefinition<Component>,
parent: Simple.Node,
You can’t perform that action at this time.