Skip to content

Instantly share code, notes, and snippets.

@mistahenry
mistahenry / controllers.application\.js
Created February 9, 2021 14:23
Query Param Preservation
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
queryParams = ['foo', 'bar'];
}
@mistahenry
mistahenry / controllers.application\.js
Created November 16, 2020 16:59
Ember bootstrap form input character prevention
import Controller from '@ember/controller';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
@tracked
username;
@mistahenry
mistahenry / components.form-element\.js
Last active November 16, 2020 17:23
prevent a from input
import Component from '@glimmer/component';
export default class extends Component {
}
import Component from '@glimmer/component';
import { tracked} from '@glimmer/tracking';
import { later } from '@ember/runloop';
export default class extends Component {
@tracked
trackedArray = [];
current = 0;
constructor(){
super(...arguments);
@mistahenry
mistahenry / components.subscriber\.js
Created July 24, 2020 09:23
Ember Evented Example
import Component from '@glimmer/component';
import { inject } from '@ember/service';
import { tracked } from '@glimmer/tracking';
export default class extends Component {
@inject
publisher;
@tracked
tick = 0;
@mistahenry
mistahenry / calculate-leaderboard.gs
Created March 9, 2020 10:51
Terraforming Mars Solo Leaderboard Google Sheets generator
function CALCULATE_LEADERBOARD() {
var corps = [
"CrediCor",
"Ecoline",
"Interplanetary Cinematics",
"Saturn Systems",
"Helion",
"Mining Guild",
"Tharsis Replublic",
"Phobolog",
@mistahenry
mistahenry / controllers.application.js
Created May 21, 2019 12:46
Dynamic computed property creation
import Ember from 'ember';
import { defineProperty, computed } from '@ember/object';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
init(){
this._super(...arguments);
// define a computed property
let object = {
import Ember from 'ember';
export default Ember.Controller.extend({
init(){
this._super(...arguments);
this.set('myValue', true);
},
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
import {
computed
} from '@ember/object';
export default Ember.Component.extend({
init() {
this._super(...arguments);
this.dataSorting = ['total_customers']
this.dataSortingDesc = ['total_customers:desc']