Skip to content

Instantly share code, notes, and snippets.

View runspired's full-sized avatar
💜
Pondering Paradigms

Chris Thoburn runspired

💜
Pondering Paradigms
View GitHub Profile
@runspired
runspired / controllers.application\.js
Last active April 14, 2023 21:51
Transactional Bulk Endpoint
import Controller from '@ember/controller';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { recordIdentifierFor } from '@ember-data/store';
let count = 2;
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
@service store;
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { set, action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
export default class ApplicationController extends Controller {
@service store;
@service archive;
@tracked archivedRecord = null;
@runspired
runspired / controllers.application\.js
Last active April 12, 2023 01:55
Immutable Proxy
import Controller from '@ember/controller';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
class Ref {
@tracked p = 0;
}
function immutable(value, tag) {
return new Proxy(value, {
import Controller from '@ember/controller';
import { Promise as RSVPromise } from 'rsvp';
const a = new Promise(() => {});
const b = new RSVPromise(() => {});
function isFn(val) {
return typeof value === 'function' && typeof value.nodeType !== 'number'
}
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ApplicationController extends Controller {
@service native;
appName = this.native.alsoNative.native.greeting;
}
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ApplicationController extends Controller {
@service store;
appUser = this.store.push({
type: 'user',
id: '1',
attributes: { name: 'Ember Twiddle' }
@runspired
runspired / hyrums-law-thoburn-addendum.md
Last active March 10, 2023 00:35
Thoburn's Addendum to Hyrum's Law

Hyrum's Law

With a sufficient number of users of an API, it does not matter what you promise in the contract: all observable behaviors of your system will be dependend on by somebody.

Thoburn's Addendum

These users provide maximal test coverage for all observable unspecified or forgotten behaviors, providing the opportunity to trade friction for insights when making changes.

@runspired
runspired / github-action-example.yml
Last active March 4, 2023 02:26
Parallel Brotli Compression in a Github Actions Workflow
# Ubuntu machines have 2 cores, but larger runners can have a lot more
# parallel will auto use number of virtual cores
# brotli, and parallel are both available out of the box on github's ubuntu machines
jobs:
build-assets:
steps:
- uses: actions/checkout@v3
# - name: Build
@runspired
runspired / controllers.application\.js
Last active March 3, 2023 23:09
UUID createRecord Example
import Controller from '@ember/controller';
import { recordIdentifierFor } from '@ember-data/store';
import { inject as service } from '@ember/service';
export default class ApplicationController extends Controller {
@service store;
twiddles = this.store.peekAll('twiddle')
}