Skip to content

Instantly share code, notes, and snippets.

import Ember from 'ember';
import UserValidations from 'twiddle/validations/user';
export default Ember.Controller.extend({
UserValidations,
actions: {
submit(model) {
console.log('submit', model)
model.save()
import Ember from 'ember';
import UserValidations from 'twiddle/validations/user';
export default Ember.Controller.extend({
UserValidations,
actions: {
submit(model) {
console.log('submit', model)
model.save()
@GCheung55
GCheung55 / .block
Created September 30, 2020 22:08 — forked from domoritz/.block
Vega Bl.ocks example
license: bsd-3-clause
@GCheung55
GCheung55 / spec.json
Last active August 14, 2020 23:33
Gradient example - changing data shifts gradient
{
"$schema":"https://vega.github.io/schema/vega/v5.json",
"width": 500,
"height": 300,
"padding": 20,
"autosize": {
"type": "fit",
"contains": "padding"
},
@GCheung55
GCheung55 / overriden-adapter.js
Last active June 18, 2020 19:31
Example async setting headers in adapter.
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
async ajax(...args) {
// Store the parent call, so it can be called after getting the current session.
const _super = this._super.bind(this);
// Sorry, I'm unfamiliar with how you're accessing amplify
const headers = await amplify.currentSession();
<ol>
<li>Open browser dev tools</li>
<li>click "Make True"</li>
<li>click "Make False"</li>
<li>Notice an error in the console</li>
</ol>
<button {{on 'click' this.makeTrue}}>
Make True
</button>
//app/components/marcas/marcas-form.js
import Component from '@ember/component';
export default Component.extend({
//https://guides.emberjs.com/v3.3.0/components/triggering-changes-with-actions/
//https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/closure-actions.md
// Noop, needs to be overriden
onSave() {},
@GCheung55
GCheung55 / spec.json
Last active March 24, 2020 23:50
Vega.js Line Graph - line interpolation
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"width": 400,
"height": 200,
"padding": 5,
"data": [
{
"name": "table",
"values": [ { "time": 1569097029000, "value": 107 }, { "time": 1569097030000, "value": 107 }, { "time": 1569097031000, "value": 107 }, { "time": 1569097032000, "value": 107 }, { "time": 1569097033000, "value": 107 }, { "time": 1569097034000, "value": 107 }, { "time": 1569097035000, "value": 107 }, { "time": 1569097036000, "value": 107 }, { "time": 1569097037000, "value": 107 }, { "time": 1569097038000, "value": 107 }, { "time": 1569097039000, "value": 107 }, { "time": 1569097040000, "value": 107 }, { "time": 1569097041000, "value": 107 }, { "time": 1569097042000, "value": 107 }, { "time": 1569097043000, "value": 107 }, { "time": 1569097044000, "value": 107 }, { "time": 1569097045000, "value": 107 }, { "time": 1569097046000, "value": 108 }, { "time": 1569097047000, "value": 108 }, { "time": 1569097048000, "value": 108 }, { "time": 1569097049000, "value":
import Ember from 'ember';
import { inject as service } from '@ember/service';
import { filterBy } from '@ember/object/computed';
export default Ember.Controller.extend({
store: service(),
appName: 'Ember Twiddle',
programTags: filterBy('model.program.tags', 'id', true)
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
select(e) {
console.log(e.target.value);
}
}