Skip to content

Instantly share code, notes, and snippets.

View nightire's full-sized avatar
Looking for new opportunities

余凡 nightire

Looking for new opportunities
View GitHub Profile
@nightire
nightire / post-merge
Created May 27, 2016 07:13 — 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/`.
#/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"
@nightire
nightire / components.simple-table.js
Last active September 26, 2016 17:00 — forked from ykaragol/components.simple-table.js
simple-table example
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);
},
@nightire
nightire / components.my-component.js
Last active November 6, 2016 02:48 — forked from bcardarella/components.my-component.js
block-component layout scoping
import Ember from 'ember';
export default Ember.Component.extend({
name: 'Bar'
});
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 December 9, 2016 17:46 — forked from Eteokles/controllers.application.js
Nested route, multiple outlet and renderTemplate problem
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Nested Route Problem'
});
@nightire
nightire / components.AModel.js
Last active December 28, 2016 04:50
ember enumerables
import Ember from 'ember';
export default Ember.Object.extend({
name: 'abb'
});
@nightire
nightire / mirage.config.js
Created April 12, 2017 09:47
Mirage Dev Boilerplate
export default function() {
//window.server = this;
this.get('users');
};
@nightire
nightire / components.async-button.js
Last active June 20, 2017 07:28 — forked from machty/components.async-button.js
Concurrency with i18n driven
import Ember from 'ember';
export default Ember.Component.extend({
tagName: '',
});
@nightire
nightire / Flexible Dockerized Phoenix Deployments.md
Created February 26, 2018 11:14 — 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.

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

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