Instantly share code, notes, and snippets.

View components.my-component.js
import Ember from 'ember';
export default Ember.Component.extend({
logger: Ember.inject.service(),
log(message) {
this.get('logger').log(this.get('name'), message);
},
init() {
View Makefile
# Makefile for PlantUML
# Author: Devin Weaver (@sukima) <suki@tritarget.org>
# GistID: 52eacde54bf7861b19ee66a07b864583
#
# This handles SVGs PNGs and ASCII outputs.
# It handles included files with the .iuml extension: !include foo.iuml
# All diagrams have the .uml extension and reside in the diagrams directory
# All output is saved to the output directory
#
# make svg - (default) build all diagrams as SVGs
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
handleKeyDown(evt) {
console.log(evt);
}
}
});
View controllers.application.js
import Ember from 'ember';
import moment from 'moment';
const { computed } = Ember;
export default Ember.Controller.extend({
queryParams: ['before'],
before: '2017-08-23T03:55:00Z',
beforeDate: computed('before', {
View -enum-iterator-test.js
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { A } from '@ember/array';
import ArrayProxy from '@ember/array/proxy';
import EmberObject from '@ember/object';
import EnumIterator from 'ember-cli-vpp/-enum-iterator';
const TestSubject = EmberObject.extend({
_testData: Object.freeze([1, 2, 3]),
length: 3,
View components.my-component.js
import Ember from 'ember';
import { task, timeout } from 'ember-concurrency';
export default Ember.Component.extend({
foo: task(function* () {
throw new Error('bork');
}).evented(),
bar: Ember.on('foo:errored', function(_, error) {
// This line does not get executed:
View adapters.application.js
import { resolve } from 'rsvp';
import DS from 'ember-data';
const { JSONAPIAdapter } = DS;
export default JSONAPIAdapter.extend({
ajax(modelName, id, snapshot, requestType, query) {
snapshot.data.data.id = 1;
console.log(snapshot.data);
return resolve(snapshot.data);
},
View component.js
import Component from '@ember/component';
import { inject as service } from '@ember/service';
import { computed } from '@ember/object';
export default Component.extend({
router: service(),
href: computed('args.[]', function() {
return this.get('router').urlFor(...this.get('args'));
View components.my-componenta.js
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
open(){
//do stuff
let image = 'yay image'
this.get('childManager').select(image)
}
}
View adapters.application.js
import DS from 'ember-data';
let id = 0;
function uniqId() {
id++;
return `${id}`;
}
export default DS.JSONAPIAdapter.extend({
ajax(url, method, { data }) {