Skip to content

Instantly share code, notes, and snippets.

View scottmessinger's full-sized avatar

Scott Ames-Messinger scottmessinger

View GitHub Profile
@scottmessinger
scottmessinger / machine.js
Last active December 3, 2020 18:09
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
@scottmessinger
scottmessinger / machine.js
Created December 3, 2020 15:35
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@scottmessinger
scottmessinger / route-application.js
Created June 12, 2020 14:18
Application route for delaying loading until components have finished.
export default class ApplicationRoute extends Route {
model(params, transition) {
if (this.fastboot && this.fastboot.isFastBoot) {
let promise = new Promise((resolve, reject) => {
let poll = () => {
later(() => {
if (this.finder.inFlightRequests.length === 0 && this.query.inFlightQueriesCount === 0) {
scheduleOnce("afterRender", this, resolve)
@scottmessinger
scottmessinger / controllers.application\.js
Last active April 14, 2020 21:26
Array Proxy Infinite Loop
import Controller from '@ember/controller';
import ArrayProxy from "@ember/array/proxy"
import PromiseProxyMixin from "@ember/object/promise-proxy-mixin"
import { all } from "rsvp"
import { computed } from "@ember/object"
const ArrayPromiseProxy = ArrayProxy.extend(PromiseProxyMixin)
export default class ApplicationController extends Controller {
ids = [1, 2, 3]
import Controller from '@ember/controller';
import {computed, get, action, set} from "@ember/object";
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
@scottmessinger
scottmessinger / controllers.application\.js
Last active April 1, 2020 21:21
Problem using map and tracked properties
import Controller from '@ember/controller';
import {action, set, get} from "@ember/object";
import {tracked} from "@glimmer/tracking";
import {
TrackedObject,
TrackedArray
} from 'tracked-built-ins';
export default class ApplicationController extends Controller {
@scottmessinger
scottmessinger / SketchSystems.spec
Created August 8, 2018 01:30 — forked from robearle/SketchSystems.spec
Group Payment Flow
Group Payment Flow
trial
request-quote -> awaiting-purchase-order
request-invoice -> awaiting-payment
expired -> trial-expired
trial-expired
request-quote -> awaiting-purchase-order
request-invoice -> awaiting-payment
expired -> group-closed
awaiting-purchase-order
@scottmessinger
scottmessinger / SketchSystems.spec
Last active June 24, 2018 18:33
Group Payment Flow
Group Payment Flow
trial-new
expired -> trial-expired
credit-card -> paid-up
request-po -> trial-awaiting-payment
trial-expired
expired -> group-closed
trial-awaiting-payment
expired -> group-closed
payment-received -> paid-up
@scottmessinger
scottmessinger / enhancers.index.js
Last active February 8, 2017 22:35 — forked from toranb/helpers.average.js
New Twiddle
import { compose } from 'redux';
var devtools = window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : f => f;
var composed = compose(devtools);
window.__REDUX_DEVTOOLS_EXTENSION__.open();
export default composed
@scottmessinger
scottmessinger / components.a-child.js
Last active October 6, 2016 22:36
Rerender entire tree
import Ember from 'ember';
export default Ember.Component.extend({
didReceiveAttrs(){
this._super(...arguments)
console.log('didReceiveAttrs', 'a-child')
}
});