Skip to content

Instantly share code, notes, and snippets.

🏋️
65s82j

Alisdair McDiarmid alisdair

View GitHub Profile
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@alisdair
alisdair / controllers.application.js
Created Sep 27, 2017
Reject vs Catch: Failures and Exceptions Part 2
View controllers.application.js
import Ember from 'ember';
const { RSVP } = Ember;
const success = (time) => new RSVP.Promise((resolve) => setTimeout(resolve, time));
const failure = (time) => new RSVP.Promise((_, reject) => setTimeout(reject, time));
export default Ember.Controller.extend({
logs: ['Initialized'],
@alisdair
alisdair / controllers.application.js
Last active Sep 27, 2017
Reject vs Catch: Failures and Exceptions Part 1
View controllers.application.js
import Ember from 'ember';
const { RSVP } = Ember;
const success = (time) => new RSVP.Promise((resolve) => setTimeout(resolve, time));
const failure = (time) => new RSVP.Promise((_, reject) => setTimeout(reject, time));
export default Ember.Controller.extend({
logs: ['Initialized'],
@alisdair
alisdair / fake-statsd.rb
Created Jul 28, 2017
It's a statsd! Kind of!
View fake-statsd.rb
#!/usr/bin/env ruby
require 'socket'
require 'optparse'
port = 8125
pattern = /./
OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename(__FILE__)} [options]"
View .vimrc
call plug#begin()
Plug 'ctrlpvim/ctrlp.vim'
Plug 'editorconfig/editorconfig-vim'
Plug 'elixir-lang/vim-elixir'
Plug 'ervandew/supertab'
Plug 'joukevandermaas/vim-ember-hbs'
Plug 'leafgarland/typescript-vim'
Plug 'pangloss/vim-javascript'
Plug 'tomasr/molokai'
Plug 'tpope/vim-commentary'
@alisdair
alisdair / components.link-href.js
Last active Jan 26, 2017
Disabling links prototype
View components.link-href.js
@alisdair
alisdair / another-component.component.js
Last active Aug 29, 2016
Assertion Failed: A helper named "example.edit" could not be found
View another-component.component.js
import Ember from 'ember';
export default Ember.Component.extend({
});
@alisdair
alisdair / controllers.application.js
Last active Aug 14, 2016
Eggs & Milk Minder 0.1
View controllers.application.js
import Ember from 'ember';
const { Controller, computed } = Ember;
export default Controller.extend({
total: computed('model.eggs', 'model.milk', function() {
return this.get('model.eggs') + this.get('model.milk');
})
});
@alisdair
alisdair / duration-parser.js
Last active Mar 7, 2018
Natural language duration parser
View duration-parser.js
const units = [
{
names: ['day', 'dy', 'd'],
seconds: 86400
}, {
names: ['hour', 'hr', 'h'],
seconds: 3600
}, {
names: ['minute', 'min', 'm'],
seconds: 60
View components.delay-component.js
import Ember from 'ember';
import Duration from 'app/utils/duration';
const { computed, run } = Ember;
export default Ember.Component.extend({
classNames: ['panel'],
classNameBindings: ['isEditing::clickable'],
keyDown(event) {
You can’t perform that action at this time.