Skip to content

Instantly share code, notes, and snippets.

@tmiller
tmiller / gist:1274563
Created October 10, 2011 03:15
Install unicode font for look of disapproval on OSX
cd ~/Library/Fonts/ && curl -O http://web.nickshanks.com/downloads/fonts/Kedage.dfont
@tmiller
tmiller / irssi-bottom
Created February 11, 2012 02:17
irssi config
settings = {
core = {
real_name = "Tom Miller";
user_name = "tmiller";
nick = "tmiller";
};
"fe-text" = { actlist_sort = "refnum"; };
"perl/core/scripts" = {
growl_show_message_public = "yes";
growl_show_message_action = "yes";
@tmiller
tmiller / server.rb
Created June 26, 2012 18:40
Small server
require 'socket'
require 'thread'
server = TCPServer.open(8080)
HEADER = <<-EOH
HTTP/1.1 200 OK
Content-Type: text/html; charset=ISO-8859-1
EOH
;; Packages
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)
;; General
(fset 'yes-or-no-p 'y-or-n-p)
(setq inhibit-startup-screen t)
(setq inhibit-startup-echo-area-message t)
@tmiller
tmiller / gist:3787980
Created September 26, 2012 13:18
Get status of working tree
git status --porcelain | sort -u | sed -e 's/^.\(.\).*/\1/' -e 's/M/*/' -e 's/D/-/' -e 's/?/+/' | tr -d '\n'
<%
def database_adapter
if Bundler.load.specs.map(&:name).include? "mysql2"
"mysql2"
else
"mysql"
end
end
def database_name(environment)
@tmiller
tmiller / .gitconfig
Last active December 14, 2015 06:29
[user]
name = Tom Miller
email = tom@gradesfirst.com
[color]
# turn on colors for all projects
ui = true
# I need to look this up again
[color "status"]
added = green
/*
Package pivotaltracker implements a wrapper around Pivotal Tracker's API.
*/
package main
import (
"encoding/xml"
"fmt"
"io/ioutil"
"net/http"
def fibonacci(nth, series = method(:fibonacci))
if nth < 2
nth
else
series[nth - 2] + series[nth - 1]
end
end
# The easiest memoization in the world:
fibs = Hash.new { |series, nth| series[nth] = fibonacci(nth, series) }
@tmiller
tmiller / README.md
Last active December 15, 2015 06:28
Using the gem ptb to prepare commit messages.

Usage

Place this file in my_project/.git/hooks/prepare-commit-msg to have git automatically use ptb to prepare your commit messages for you.

You also need to give execute permisions to prepare-commit-msg

chmod +x myproject/.git/hooks/prepare-commit-msg