Skip to content

Instantly share code, notes, and snippets.

🏋
68s85j

Alisdair McDiarmid alisdair

🏋
68s85j
Block or report user

Report or block alisdair

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alisdair
alisdair / intensify.sh
Created May 21, 2019
intensifies Slack emoji creator
View intensify.sh
#!/bin/bash
# Generate a `:something-intensifies:` Slack emoji, given a reasonable image
# input. I recommend grabbing an emoji from https://emojipedia.org/
set -euo pipefail
# Number of frames of shaking
count=10
# Max pixels to move while shaking
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
You can’t perform that action at this time.