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
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: {
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'));
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;
@nightire
nightire / application.route.js
Last active October 10, 2019 09:39 — forked from houfeng0923/application.route.js
Data Binding
import Ember from 'ember';
export default Ember.Route.extend({
activate() {
document.body.classList.add('standard');
}
});
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 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

@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 / mirage.config.js
Created April 12, 2017 09:47
Mirage Dev Boilerplate
export default function() {
//window.server = this;
this.get('users');
};
@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 / 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'
});