Skip to content

Instantly share code, notes, and snippets.

View jasonmit's full-sized avatar
🌴
On a hiatus from open source

Jason Mitchell jasonmit

🌴
On a hiatus from open source
View GitHub Profile
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
children: Ember.computed('model.children', function() {
return this.get('model.children');
})
});
import CachedRouter, { time } from 'cacheable-router';
import blacklist from './config/sku-blacklist';
import products from './api/products';
const router = new CachedRouter(express.Router(), {
adapter: 'redis',
adapterOptions: {
port: process.env.REDIS_PORT,
hostname: process.env.REDIS_HOSTNAME,
password: process.env.REDIS_PASSWORD
@jasonmit
jasonmit / components.x-select.js
Last active January 19, 2017 02:01
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
hasFocus: false,
options: [
{
name: 'Foo',
value: 'http://foo.com'
},
{
import Ember from 'ember';
export default class extends Ember.Controller {
get appName() { return 'Ember Twiddle'; }
};
@jasonmit
jasonmit / components.x-foo.js
Last active December 31, 2016 00:02
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
});
@jasonmit
jasonmit / computed.js
Last active December 21, 2016 10:50
New Twiddle
let format = new Intl.DateFormat('en-US', {
hour: 'numeric', minute: 'numeric', second: 'numeric',
timeZoneName: 'short'
});
const { computed, run } = Ember;
const COUNTERS = '__COUNTERS__';
let idx = 0;
export default function({ interval }) {
@jasonmit
jasonmit / post-merge
Last active December 15, 2016 06:35 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.
#!/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"
export default Service.extend({
i18n: service(),
init() {
this._super(...arguments);
this._subscribers = A();
this.subscribe((e) => logger.error(e), this);
}
Router.map({
needs: ['i18n']
}, function({ i18n }) {
this.route('index', { path: '/' });
this.route('about', { path: i18n.t('urls.about') });
this.route('contact_us', { path: i18n.t('urls.contact_us') });
});
@jasonmit
jasonmit / initializer---router-map-patch.js
Last active July 25, 2016 00:32
Router.map runtime patch
// Also, parts of this are entirely wrong.. I don't have access to what
// I originally wrote at the moment but it at least shows roughly the idea..
import Ember from 'Ember';
const { get, Logger } = Ember;
export default {
name: 'router-map-patch',
initialize() {
Ember.Router.reopen({