Skip to content

Instantly share code, notes, and snippets.

import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class extends Component {
@tracked isOpen = true;
@action
close() {
this.isOpen = false;
}
import Component from '@glimmer/component';
export default class extends Component {
}
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
@fivetanley
fivetanley / controllers.application.js
Last active May 3, 2019 21:08
weird analytics in the routes
import Ember from 'ember';
import {inject} from '@ember/service';
export default Ember.Controller.extend({
routerService: inject('router'),
analytics: inject('analytics'),
appName: 'Ember Twiddle',
});
// vget: like `get` but ensures the response body matches the schema for an endpoint. e.g. `validated get`
this.vget = (path, callback) => {
this.get(path, (schema, request) => {
request.__validationPath__ = `/${path}`;
return Promise.resolve().then(async () => {
await ensureSchemaLoaded(request.requestHeaders.Accept);
return callback.call(this, schema, request);
});
});
};
@fivetanley
fivetanley / test.js
Last active February 27, 2018 14:34
const puppeteer = require('puppeteer');
(async () => {
const { HEROKU_EMAIL, HEROKU_PASSWORD } = process.env;
const browser = await puppeteer.launch({headless: false})
const page = await browser.newPage();
await page.goto('https://dashboard.heroku.com');
// login
await page.type('#email', HEROKU_EMAIL);
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
});
import Ember from 'ember';
import { task, timeout } from 'ember-concurrency';
const steps = [
{
type: 'static',
message: 'i am totally a human!'
},
{
import Ember from 'ember';
const { computed } = Ember;
export default Ember.Component.extend({
isExpanded: false,
maxCollapsed: 5,
viewableContent: computed('maxCollapsed', 'content.[]', 'content.length', 'isExpanded', function() {
const { content, isExpanded } = this.getProperties('content', 'isExpanded', 'maxCollapsed');