Skip to content

Instantly share code, notes, and snippets.

View alisdair's full-sized avatar
🏋️‍♂️
I'm probably snatching right now

Alisdair McDiarmid alisdair

🏋️‍♂️
I'm probably snatching right now
View GitHub Profile
@alisdair
alisdair / intensify.sh
Created May 21, 2019 23:44
intensifies Slack emoji creator
#!/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
@alisdair
alisdair / kill-sticky.js
Created May 29, 2013 13:43
Kill sticky headers.
(function () {
var i, elements = document.querySelectorAll('body *');
for (i = 0; i < elements.length; i++) {
if (getComputedStyle(elements[i]).position === 'fixed') {
elements[i].parentNode.removeChild(elements[i]);
}
}
})();

Keybase proof

I hereby claim:

  • I am alisdair on github.
  • I am alisdair (https://keybase.io/alisdair) on keybase.
  • I have a public key ASDxkxbgMVZSTorZwOfAI8E4_dz1hOS4fNNKZREJ0H7viAo

To claim this, I am signing this object:

2020/02/10 11:31:43 [INFO] Terraform version: 0.11.14
2020/02/10 11:31:43 [INFO] Go runtime version: go1.12.4
2020/02/10 11:31:43 [INFO] CLI args: []string{"C:\\Program Files\\Terraform\\terraform.exe", "init"}
2020/02/10 11:31:43 [DEBUG] Attempting to open CLI config file: C:\Users\alisd\AppData\Roaming\terraform.rc
2020/02/10 11:31:43 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/02/10 11:31:43 [INFO] CLI command args: []string{"init"}
2020/02/10 11:31:43 [DEBUG] command: loading backend config file: C:\Users\alisd\tf-example
2020/02/10 11:31:43 [INFO] command: empty terraform config, returning nil
2020/02/10 11:31:43 [DEBUG] command: no data state file found for backend config
2020/02/10 11:31:43 [DEBUG] New state was assigned lineage "ba9ad26a-10dd-4b1b-706d-80af33d69609"
@alisdair
alisdair / tty.c
Created November 15, 2011 15:42
Code to open a TTY with POSIX API, raw mode
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <termios.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@alisdair
alisdair / jquery.wraplines.js
Created August 14, 2013 15:02
jQuery wraplines plugin Copyright (c) 2010 Paul Bennett (http://pmbennett.net) Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
/*
* jQuery wraplines plugin
*
* Copyright (c) 2010 Paul Bennett (http://pmbennett.net)
* Licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
*/
jQuery.fn.wraplines = function(options) {
@alisdair
alisdair / duration-parser.js
Last active March 7, 2018 17:33
Natural language duration parser
const units = [
{
names: ['day', 'dy', 'd'],
seconds: 86400
}, {
names: ['hour', 'hr', 'h'],
seconds: 3600
}, {
names: ['minute', 'min', 'm'],
seconds: 60
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@alisdair
alisdair / controllers.application.js
Created September 27, 2017 14:23
Reject vs Catch: Failures and Exceptions Part 2
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 September 27, 2017 14:22
Reject vs Catch: Failures and Exceptions Part 1
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'],