Skip to content

Instantly share code, notes, and snippets.

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
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 keybase.md

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:

@alisdair
alisdair / kill-sticky.js
Created May 29, 2013
Kill sticky headers.
View kill-sticky.js
(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]);
}
}
})();
View terraform.log
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 Nov 15, 2011
Code to open a TTY with POSIX API, raw mode
View tty.c
#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 Aug 14, 2013
jQuery wraplines plugin Copyright (c) 2010 Paul Bennett (http://pmbennett.net) Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
View jquery.wraplines.js
/*
* 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 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 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'],