Skip to content

Instantly share code, notes, and snippets.

😄
I may be slow to respond.

Albert Yu nightire

😄
I may be slow to respond.
Block or report user

Report or block nightire

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
@nightire
nightire / controllers.application.js
Last active Jan 4, 2019
Change state by route link
View controllers.application.js
import Controller from '@ember/controller';
import { inject } from '@ember/service';
import { set } from '@ember/object';
export default Controller.extend({
state: inject(),
router: inject(),
View application.controller.js
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
}
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
appVersion: Ember.VERSION,
});
View controllers.application.js
import Ember from 'ember';
import { task, waitForEvent } from 'ember-concurrency';
const { Evented, Controller } = Ember;
export default Controller.extend(Evented, {
myTask: task(function* () {
while (true) {
let payload = yield waitForEvent(this, 'message');
this.get('messages').pushObject(payload);
}
@nightire
nightire / debug_ember_app_in_vscode.md
Created May 17, 2018
How to debug an ember application with VS Code
View debug_ember_app_in_vscode.md

Step 1: Launch Google Chrome with Remote Debugging support

  • windows: <path to chrome>/chrome.exe --remote-debugging-port=9222
  • macOS: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
  • linux: google-chrome --remote-debugging-port=9222

Step 2: Install "Debugger for Chrome" extension

Step 3: Setup your application

@nightire
nightire / Flexible Dockerized Phoenix Deployments.md
Created Feb 26, 2018 — forked from jswny/Flexible Dockerized Phoenix Deployments.md
A guide to building and running zero-dependency Phoenix (Elixir) deployments with Docker. Works with Phoenix 1.2 and 1.3.
View Flexible Dockerized Phoenix Deployments.md

Prelude

I. Preface and Motivation

This guide was written because I don't particularly enjoy deploying Phoenix (or Elixir for that matter) applications. It's not easy. Primarily, I don't have a lot of money to spend on a nice, fancy VPS so compiling my Phoenix apps on my VPS often isn't an option. For that, we have Distillery releases. However, that requires me to either have a separate server for staging to use as a build server, or to keep a particular version of Erlang installed on my VPS, neither of which sound like great options to me and they all have the possibilities of version mismatches with ERTS. In addition to all this, theres a whole lot of configuration which needs to be done to setup a Phoenix app for deployment, and it's hard to remember.

For that reason, I wanted to use Docker so that all of my deployments would be automated and reproducable. In addition, Docker would allow me to have reproducable builds for my releases. I could build my releases on any machine that I wanted in a contai

@nightire
nightire / components.data-binding.js
Last active Feb 25, 2018
possible bug about one way binding
View components.data-binding.js
import Ember from 'ember';
export default Ember.Component.extend({
bar: 0,
actions: {
change() {
// if comment out this line, mutation will be updated in template properly
this.toggleProperty('foo');
View application.route.js
import Ember from 'ember';
export default Ember.Route.extend({
activate() {
document.body.classList.add('standard');
}
});
View application.controller.js
import Ember from 'ember';
const { Controller } = Ember;
export default class ApplicationController extends Controller {
constructor() {
super(...arguments);
this.application_name = '<code>as</code> pattern';
}
}
View application.controller.js
import Ember from 'ember';
const { Controller } = Ember;
export default class ApplicationController extends Controller {
constructor() {
super();
this.application_name = 'Double Loop';
}
}
You can’t perform that action at this time.