Skip to content

Instantly share code, notes, and snippets.

Alex Matchneer machty

Block or report user

Report or block machty

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@machty
machty / ember-cli-build.js
Last active Jun 8, 2019
Broccoli challenges
View ember-cli-build.js
/* jshint node: true */
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const generateWhitelabelIndexes = require('./generate-whitelabel-indexes');
module.exports = function(defaults) {
const app = new EmberApp(defaults, {
// ...all sorts of config
});
View controllers.application.js
import Ember from 'ember';
let guid = () => (Math.random().toString(36) + '00000000000000000').slice(2, 14)
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
vol: Ember.computed(function() {
return guid();
}).volatile(),
actions: {
View controllers.application.js
import Ember from 'ember';
import { lifespan, subscription } from "../subscription";
import { bind } from '@ember/runloop';
import { task, timeout } from 'ember-concurrency';
export default Ember.Controller.extend({
chatRooms:[ "EmberChat", "ReactChat", "VueChat", "AngularChat"],
chatRoom: null,
// chatRoomName: null,
View controllers.application.js
import Ember from 'ember';
import { subscription } from "../subscription";
import { bind } from '@ember/runloop';
import { task, timeout } from 'ember-concurrency';
export default Ember.Controller.extend({
chatRooms:[ "EmberChat", "ReactChat", "VueChat", "AngularChat"],
chatRoomName: null,
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
bar: "bar_initial",
foo: Ember.computed('bar', {
set(key, value) {
return `setter(${value})`;
@machty
machty / journal.md
Created Jun 18, 2018
ember-testing journal
View journal.md

Ember Testing Journal

We've been driving all of our Ember tests with end-to-end Capybara tests running from our Rails server for some time. There are many upsides to this approach, but Capybara tests are generally slow and brittle, so we'd likely to start investing in client-side only Ember tests that don't actually hit the server at all.

Given that I don't have a lot of experience with Ember tests, I wanted to keep a journal of first impressions and snags I encountered along the way, so that perhaps this information will be useful for documentation maintainers or whomever.

Figuring out how to stub a service in an acceptance test

Screencast of me talking through my through process

@machty
machty / some-route.js
Last active Jun 17, 2018
I have a user-activity service that exposes some observables that monitor the user clicking/tapping around and expose some convenience methods for generating new observables, which allows for the flexibility of consumers specifying different activity times. Refactoring this to use tasks vs observables points out a few awkward cases that could be…
View some-route.js
import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
const DEFAULT_INACTIVITY_TIMEOUT_MS = 10 * 60 * 1000
export default Route.extend({
session: service(),
userActivity: service(),
notifications: service(),
logoutTimeoutSubscription: null,
activate() {
View controllers.application.js
import Ember from 'ember';
function * myGen() {
yield 1;
yield 2;
yield 3;
}
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
View controllers.application.js
import Ember from 'ember';
import { task, timeout, waitForProperty } from 'ember-concurrency';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
lol: 'init',
foo: task(function * () {
this.set('lol', 1);
You can’t perform that action at this time.