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
@nightire
nightire / post-merge
Created May 27, 2016 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed. In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed. Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
View post-merge
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
View components.simple-table.js
import Ember from 'ember';
export default Ember.Component.extend({
tableClassNames:'table table-striped table-bordered table-hover table-responsive table-condensed',
actions:{
selectionChanged(selectedRows){
this.set('selectedRows', selectedRows);
},
View components.my-component.js
import Ember from 'ember';
export default Ember.Component.extend({
name: 'Bar'
});
View app-layout.component.js
import Ember from 'ember';
import hbs from 'htmlbars-inline-precompile';
export default Ember.Component.extend({
layout: hbs`
{{yield}}
`
});
@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'
});
View components.AModel.js
import Ember from 'ember';
export default Ember.Object.extend({
name: 'abb'
});
@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');
};
@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 / 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

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);
}