View cart.exs
# from ounce of elixir
defmodule CartTest do
use ExUnit.Case
test "starts with empty count" do
assert Cart.count_items([]) == 0
View my_server.rb
require 'socket'
require 'rack'
require 'sinatra'
# Simple, rack-compliant web server
class MyServer
200 => 'OK',
500 => 'Internal Server Error'
View gist:f5f597f04b2efcb711c7
require 'mechanize'
require 'moving_average'
mechanize =
login_page = mechanize.get ''
form = login_page.forms.first
# noinspection RubyResolve
form.field_with(id: 'username').value = "username"
form.field_with(id: 'password').value = "pass"

This function automatically grabs the latest git tag and, based on keyword (major, minor, patch), adds a new tag. (e.g. git_tag patch for v1.2.0 would create v1.2.1)

Drop this into your ~/.bash_profile and run source ~/.bash_profile to use it.

You can find all of my dotfiles here:

Credit to Jacob Swanner for cleaning up my function :)


Keynote I guess pushed an update that doesn't take hightlighted code from xCode anymore. So, I googled around and found hightlight. It is a super useful utitlity to do syntax highlighting from the command line.

$ brew install hightlight

If you are on Mavericks you may need to brew link lua to get it working right.

Hightlight has support for all kinds of languages and themes and it can wrap the code with line numbers, which is great.

View import.rb
# coding: utf-8
require 'rubygems'
require 'hpricot'
require 'fileutils'
require 'safe_yaml'
require 'time'
module JekyllImport
# This importer takes a wordpress.xml file, which can be exported from your
View erlang.rb
require 'formula'
class ErlangManuals < Formula
url ''
sha1 '57ef01620386108db83ef13921313e600d351d44'
class ErlangHtmls < Formula
url ''
sha1 '6741e15e0b3e58736987e38fb8803084078ff99f'
View migrate.rake
desc 'rolls back migrations in current branch not present in other'
task :rollback_branch_migrations, [:other_branch] do |t, args|
load "#{Dir.pwd}/Rakefile"
branch_migrations =
puts ['Rollback the following migrations', branch_migrations, 'y,n? ']
next if %w[no n NO N].include?(STDIN.gets.chomp)
View chat.go
package main
import (
type Client struct {
incoming chan string
outgoing chan string