Skip to content

Instantly share code, notes, and snippets.

Avatar
😄
I may be slow to respond.

Albert Yu nightire

😄
I may be slow to respond.
View GitHub Profile
View adapters.application.js
import { Promise, defer } from 'rsvp';
import { get } from '@ember/object';
// a mock API response used below
const MOCK_PAYLOAD = {
person: {
id: '1',
name: 'Chris',
age: 33,
father: {
View components.blog-post-card.js
import Ember from 'ember';
const { Component, computed } = Ember;
const BlogPostCardComponent = Component.extend({
classNames: ['blog-post-card', 'card'],
classNameBindings: ['disabled::clickable'],
click() {
if (!this.get('disabled')) {
this.get('viewPost')(this.get('post'));
View components.clients.change-password-form\.js
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class ChangePasswordForm extends Component {
@tracked oldPassword;
@tracked newPassword;
@tracked confirmPassword;
View application.route.js
import Ember from 'ember';
export default Ember.Route.extend({
activate() {
document.body.classList.add('standard');
}
});
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 / 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.async-button.js
Last active Jun 20, 2017 — forked from machty/components.async-button.js
Concurrency with i18n driven
View components.async-button.js
import Ember from 'ember';
export default Ember.Component.extend({
tagName: '',
});
@nightire
nightire / mirage.config.js
Created Apr 12, 2017
Mirage Dev Boilerplate
View mirage.config.js
export default function() {
//window.server = this;
this.get('users');
};
View components.AModel.js
import Ember from 'ember';
export default Ember.Object.extend({
name: 'abb'
});
@nightire
nightire / controllers.application.js
Last active Dec 9, 2016 — forked from Eteokles/controllers.application.js
Nested route, multiple outlet and renderTemplate problem
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Nested Route Problem'
});