Skip to content

Instantly share code, notes, and snippets.

View ashmckenzie's full-sized avatar

Ash McKenzie ashmckenzie

View GitHub Profile
@ashmckenzie
ashmckenzie / keybase.md
Last active August 29, 2015 14:00
keybase.md

Keybase proof

I hereby claim:

  • I am ashmckenzie on github.
  • I am ashmckenzie (https://keybase.io/ashmckenzie) on keybase.
  • I have a public key whose fingerprint is 5B61 33ED 9A42 5888 38E9 41A4 8077 C600 7FF5 E320

To claim this, I am signing this object:

env
bundle install --deployment
export DISPLAY=:$$
/usr/bin/Xvfb ${DISPLAY} -ac > /dev/null 2>&1 &
XVFB_PID=$!
/usr/bin/firefox > /dev/null 2>&1 &
FIREFOX_PID=$!
bundle exec rake
kill ${XVFB_PID} ${FIREFOX_PID}
@ashmckenzie
ashmckenzie / hash_challenge.rb
Last active December 24, 2015 08:59
Create the smallest solution to take the given data hash and produce the desired output (using pure Ruby stdlib)
# Source data
#
data = {
name: 'John Smith',
age: 45,
address: '123 Here St',
email: '[email protected]'
}
# Code here..
@ashmckenzie
ashmckenzie / bootstrap.sh
Created September 3, 2012 04:05
Bootstrap for new Ubuntu box
#!/bin/bash
RUBY_VERSION='1.9.3-p194'
sudo apt-get install build-essential
cd /tmp
wget -c http://mirrors.ibiblio.org/ruby/ruby-${RUBY_VERSION}.tar.gz
tar xzf ruby-${RUBY_VERSION}.tar.gz
cd ruby-${RUBY_VERSION}
@ashmckenzie
ashmckenzie / .port
Created July 12, 2012 05:06 — forked from tommeier/.port
Install local ssl with pow
5000
@ashmckenzie
ashmckenzie / gist:2556520
Created April 30, 2012 08:20
Witch dangling symlink
[ash@ash-macbook-air]-[18:16:46]-[0]-[1.9.3-falcon]-[/Volumes/Witch]
$ cp -r 'Witch.prefPane' /Users/ash/Library/PreferencePanes
cp: Witch.prefPane/Contents/Resources/witchdaemon.app/Contents/Frameworks/Sparkle.framework/Resources/fr_CA.lproj: No such file or directory
cp: Witch.prefPane/Contents/Resources/witchdaemon.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/fr_CA.lproj: No such file or directory
cp: Witch.prefPane/Contents/Resources/witchdaemon.app/Contents/Frameworks/Sparkle.framework/Versions/Current/Resources/fr_CA.lproj: No such file or directory
[ash@ash-macbook-air]-[18:17:09]-[0]-[1.9.3-falcon]-[/Volumes/Witch]
$ ls -la Witch.prefPane/Contents/Resources/witchdaemon.app/Contents/Frameworks/Sparkle.framework/Resources/fr_CA.lproj
lrwxr-xr-x 1 ash staff 110 Apr 8 08:31 Witch.prefPane/Contents/Resources/witchdaemon.app/Contents/Frameworks/Sparkle.framework/Resources/fr_CA.lproj -> /Users/andym/Development/Build Products
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"'
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
if [ $(git status -s | wc -l) -gt 0 ]; then
changes="*"
fi
echo "-["${ref#refs/heads/}"${changes}]"
}
@ashmckenzie
ashmckenzie / gist:848146
Created February 28, 2011 22:07
VLine letter of complaint 01/03/2011

What a disgrace.

Your trains rarely arrive on time, consistently late and usually without a/c or any available seating. Where is the money that I’m spending on your ‘service’ on a daily basis going exactly ?

I’ve been using your ‘service’ for four (very) long years and in that time the ‘service’ has not improved once, in fact it’s steadily declined. Congratulations. I realise there are factors outside of VLine’s control (city congestion) but c’mon, a lot of the problems stem from lack of co-ordination, organisation and just generally caring about the ‘service’ you provide to hundreds of paying customers who rely on your ‘service’. It’s no secret that your lack of ‘service’ is directly affecting the lives of hundreds of people, consistently causing them to arrive home late to their husbands, wives and kids.

I would be ashamed and disgusted to work for VLine. It’s arrogant to continue to treat your customers with such disrespect and contempt by not doing a DAMN THING ABOUT FIXING THE SERVICE.

VLi

@ashmckenzie
ashmckenzie / cake_habtm.php
Created January 8, 2011 00:56
CakePHP HABTM problem
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`created` datetime DEFAULT NULL,
`modified` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
);
CREATE TABLE `announcements` (
`id` int(11) NOT NULL AUTO_INCREMENT,
@ashmckenzie
ashmckenzie / gist:738540
Created December 13, 2010 01:37
Find the smallest index in an array where all array values exist prior to index
def ps(list)
freq = {}
list.each do |v|
freq[v] = 0 if freq[v].nil?
freq[v] += 1
end
list.each_with_index do |v, i|