Skip to content

Instantly share code, notes, and snippets.

@tehpeh
tehpeh / eddie.rb
Created May 20, 2011 07:47
Collect array to hash
#!/usr/bin/env ruby
input = [["GREY", "1"], ["GREY", "2"], ["GREY", "3"], ["LIME", "1"], ["LIME", "2"], ["LIME", "3"], ["PINK", "1"], ["PINK", "2"], ["PINK", "3"], ["RED", "1"], ["RED", "2"], ["RED", "3"]]
out = {}
input.each do |a|
out[a.first] ||= []
out[a.first] << a.last
end
@tehpeh
tehpeh / gist:990443
Created May 25, 2011 06:15
Sort colours
#!/usr/bin/env ruby
def sort_colours(str)
ranking = {
"blue" => 1,
"orange" => 2,
"green" => 3,
"yellow" => 4,
"pink" => 5,
"red" => 6,
@tehpeh
tehpeh / nginx-initd-ubuntu
Created May 8, 2012 06:44
nginx-initd-ubuntu
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nginx init.d dash script for Ubuntu <=9.10.
# Description: nginx init.d dash script for Ubuntu <=9.10.
### END INIT INFO
@tehpeh
tehpeh / ubuntu-deploy.txt
Created May 8, 2012 06:42
Ubuntu Deploy
Setup:
------
See ror-deploy.txt for general instructions.
Packages:
---------
sudo aptitude update
sudo aptitude safe-upgrade
@tehpeh
tehpeh / nginx-initd-centos
Created May 8, 2012 06:45
nginx-initd-centos
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
@tehpeh
tehpeh / ror-deploy.txt
Created May 8, 2012 06:41
RoR Deploy
General steps for a RoR deployment on linux.
For Ubuntu, see ubuntu-deploy.txt
For CentOS, see centos-deploy.txt
Information:
------------
- users
cat /etc/passwd
@tehpeh
tehpeh / centos-deploy.txt
Created May 8, 2012 06:43
CentOS Deploy
Setup:
------
See ror-deploy.txt for general instructions.
Create user:
------------
groupadd staff
useradd [user] -g staff
@tehpeh
tehpeh / tddium.rake
Created June 27, 2012 06:33 — forked from tddium/tddium.rake
Installing hstore extension in Postgresql 9.1 database for Tddium
# Copyright (c) 2011, 2012 Solano Labs All Rights Reserved
namespace :tddium do
desc "load database extensions"
task :db_hook do
Rake::Task["db:create"].invoke
Kernel.system("psql #{ENV['TDDIUM_DB_NAME']} -c 'CREATE EXTENSION hstore;'")
Rake::Task["tddium:default_db_hook"].invoke
@tehpeh
tehpeh / google-analytics-outbound-link-tracking.html
Last active December 16, 2015 13:28
Outbound link tracking for Google Analytics using YUI3 (SquareSpace compatible)

Keybase proof

I hereby claim:

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

To claim this, I am signing this object: