Skip to content

Instantly share code, notes, and snippets.

Avatar
💜
Pondering Paradigms

Chris Thoburn runspired

💜
Pondering Paradigms
View GitHub Profile
@runspired
runspired / controllers.application\.js
Last active Jan 28, 2023
Module Scope Reactive Strings Example
View controllers.application\.js
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
const translations = {
'en': {
greeting: 'Welcome Ember friends!'
},
'es': {
greeting: 'Hola Embereños!'
View controllers.application\.js
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
@runspired
runspired / routes.application\.js
Last active Jan 12, 2023
Advanced Query Params
View routes.application\.js
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
class BaseRoute extends Route {
@service('query-params') params;
setupController(model, controller) {
super.setupController(model, controller);
console.log({ model, controller });
controller.params = this.params;
@runspired
runspired / controllers.-base\.js
Last active Jan 12, 2023
Query Params Service
View controllers.-base\.js
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class extends Controller {
@service('query-params') params;
// queryParams = this.params.buildControllerParams('application', {
// composeWith: [this.params.getDatatableParams('controls')]
// });
}
View models.foo\.js
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
export default class FooModel extends Model {
@attr name;
@attr meta;
}
View controllers.application\.js
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
View controllers.application\.js
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
View controllers.application\.js
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
myValues = ["1", "2", "3"];
}
View pods migration
/* eslint-disable no-console */
import execa from "execa";
import { globby } from "globby";
import codeshift from "jscodeshift";
import fs from "node:fs";
import path from "node:path";
const TYPES = [
{ fileName: "adapter", usePods: false },
{ fileName: "component", usePods: false, alsoMoveTemplate: true },
View controllers.application\.js
import Controller from '@ember/controller';
import Model from '../models/foo';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}