Skip to content

Instantly share code, notes, and snippets.

View rtablada's full-sized avatar

Ryan Tablada rtablada

View GitHub Profile
import Ember from 'ember';
import { inject as service } from '@ember/service';
import { computed } from '@ember/object';
export default Ember.Controller.extend({
router: service(),
appName: 'Ember Twiddle',
value: 0,
queryParams: ['value', 'value2'],
import Component from '@ember/component';
import hbs from 'htmlbars-inline-precompile';
let MysteryTour = Component.extend({
layout: hbs`<h2>This is a thing</h2>`
})
export default Component.extend({
layout: hbs`<this.MysteryTour />`,
MysteryTour
import Ember from 'ember';
import { inject as service } from '@ember/service';
export default Ember.Component.extend({
router: service('router'),
queryParams: null,
actions: {
foo() {
this.get('router').transitionTo(this.routeName, {
@rtablada
rtablada / post.md
Last active November 2, 2018 14:55
Difference between Koa, Express, and Hapi

Express and Koa are more 1-1 comparisons and HAPI is slightly different so I’ll explain the diffs for those first.

Express and Koa are both middleware driven server libraries. With middleware you’re defining a set of functions to handle an incoming request and either return a result from that function or make some changes to the incoming request (or outgoing response) and pass on to the next set of middleware (think each middleware function as a colored lens letting light through or a mirror reflecting light back).

The big difference between the two is how they setup middleware, call middleware, and deal with async behavior (and the resulting errors or responses).

Express is based on callbacks so async actions will need to use callbacks as a control flow. While you can use async/await or generators in Express middleware the library itself does not handle this and may exit early or hang (there are some middleware that can be added that add more flexibility for async/await to Express but they aren’t 1st pa

import makeStyle from 'ember-something-js-style-thing';
import Component from '@glimmer/component';
export default class MyComponent extends Component {
styles = makeStyle({
title: {
margin: '1rem',
color: (component) => {
return component.isActive ? 'red' : 'black';
}

Community and Jobs

Paid Learning Resources

return await RSVP.hash({
x: this.store.findAll('thing'),
u: this.store.queryRecord('user', { me: true })
});
// or
let [x, u] = await Promise.all([this.store.findAll('thing'), this.store.queryRecord('user', { me: true })]);
return { x, u };
import Component from '@ember/component';
import { set } from '@ember/object';
import { action, computed } from '@ember-decorators/object';
import { layout, classNames } from '@ember-decorators/component';
import hbs from 'htmlbars-inline-precompile';
const WORDS_PER_SEC = 200 / 60; // Assumption: 200 words per minute
export class CountingTextareaManager {
constructor(str) {
@rtablada
rtablada / ideas.md
Created July 17, 2018 18:44
Hotel Improvements
  • Public Documented API
  • Configure Daemon From
    • CLI
    • API
    • UI
  • Plugins
    • Easier Project Adding
  • Scripts Support
    • Add custom scripts
  • Load from plugins
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});