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
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
import Controller from '@ember/controller';
import { getOwner } from '@ember/application';
import { inject as service } from '@ember/service';
import attr from 'ember-data/attr';
const NEW_ATTRS = {
age: { kind: 'attribute', name: 'age', type: 'number', options: {} }
};
function upgradeModelSchema(owner, type, newAttrs) {
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
import { next } from '@ember/runloop';
const createdAt = new Date().toUTCString();
let inc = 0;
export default class ApplicationController extends Controller {
@service store;
@runspired
runspired / controllers.application\.js
Last active February 16, 2024 06:49
Data Integrity Issue Repo
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
/*
{
data: {
type: 'user',
id: '1',
attributes: {
name: 'Chris',
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
newlyCreated = [
{ name: 'james' }
];
source = [
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { guidFor } from '@ember/object/internals';
function inspect(target, key, descriptor) {
const { initializer } = descriptor;
descriptor.initializer = function $inspectInit() {
const value = initializer.call(this);
console.log(`[initialized] ${this.constructor.name}<${guidFor(this)}>.${key}`, value);
return value;
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
constructor() {
super(...arguments);
this.user = this.store.push({
data: {
type: 'user',
import Controller from '@ember/controller';
import { A } from '@ember/array';
const ArrayLike = { length: 0 };
Object.defineProperty(ArrayLike, '[]', {
enumerable: true,
//configurable: false,
get() {
return 0;
},
const ArrayLike = { length: 0 };
Object.defineProperty(ArrayLike.prototype, 'push', {
enumerable: true,
configurable: false,
get() {
return 0;
},
set() {
throw new Error('Do Not Set');
}
@runspired
runspired / scan.js
Created September 12, 2023 05:28
Element Scan
function timedGet(selector) { let start = performance.now(); let all = document.querySelectorAll(selector); let end = performance.now(); return { start, end, all }; }
function iterateAll(selector, cb) {
let data = timedGet(selector);
for (let e of data.all) cb(e);
let end = performance.now();
console.log({ start: data.start, iter: data.end, end, duration: end - data.start })
}
seen2 = new Set(); iterateAll('*', (e) => seen2.add(e));