Skip to content

Instantly share code, notes, and snippets.

View taylor's full-sized avatar
🐢
🌊

Taylor Carpenter taylor

🐢
🌊
View GitHub Profile
@taylor
taylor / git-interactive-merge.sh
Created March 27, 2012 20:31 — forked from vgrichina/git-interactive-merge.sh
Interactive merge utility for Git, as described here http://www.angrylibertarian.com/node/53
#!/bin/bash
# git-interactive-merge
# Taken from: http://www.angrylibertarian.com/node/53
from=$1
to=$2
if [[ ( -z $from ) || ( -z $to ) ]]; then
echo "Usage:"
echo " git-interactive-merge <from-branch> <to-branch>"
exit 1
@taylor
taylor / minitest_spec_expectations.md
Created March 23, 2012 05:51 — forked from ordinaryzelig/minitest_spec_expectations.md
How to write MiniTest::Spec expectations

I'm a fan of MiniTest::Spec. It strikes a nice balance between the simplicity of TestUnit and the readable syntax of RSpec. When I first switched from RSpec to MiniTest::Spec, one thing I was worried I would miss was the ability to add matchers. (A note in terminology: "matchers" in MiniTest::Spec refer to something completely different than "matchers" in RSpec. I won't get into it, but from now on, let's use the proper term: "expectations").

Understanding MiniTest::Expectations

Let's take a look in the code (I'm specifically referring to the gem, not the standard library that's built into Ruby 1.9):

# minitest/spec.rb

module MiniTest::Expectations
@taylor
taylor / 98_command_prompt
Created March 15, 2012 21:01 — forked from matthewmccullough/gist:47267
command prompt tweaks -- git and last command status (smiley) + title bar updates for bashrc
# vim:ft=sh:
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
DARK_GRAY="\[\033[0;90m\]"
@taylor
taylor / gist:1843031
Created February 16, 2012 07:43
foreman in Procfile on Heroku
$ cat Procfile
foreman: foreman start -c web=1 worker=10 -f Procfile2
$ cat Procfile2
web: bundle exec rails s -p $PORT thin
worker: ruby worker.rb
@taylor
taylor / rbenv-install-system-wide.sh
Created February 15, 2012 22:24
rbenv install and system wide install on Ubuntu 10.04 LTS.
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Add rbenv to the path:
@taylor
taylor / Gemfile
Created February 15, 2012 10:28
Testing Ruby VMs
source :rubygems
gem 'sinatra'
gem 'sinatra-synchrony'
gem 'thin'
@taylor
taylor / mount-ram.sh
Created December 22, 2011 00:19 — forked from koshigoe/mount-ram.sh
Like tmpfs in Mac OSX
#!/bin/sh
# This program has two feature.
#
# 1. Create a disk image on RAM.
# 2. Mount that disk image.
#
# Usage:
# $0 <dir> <size>
#
@taylor
taylor / extensions.conf
Created December 5, 2011 21:06 — forked from bklang/extensions.conf
Adhearsion dev setup
[adhearsion]
exten => _.,1,AGI(agi://localhost/adhearsion)
@taylor
taylor / adhearsion_outgoing_call.rake
Created September 13, 2011 12:11 — forked from cloudvoxcode/adhearsion_outgoing_call.rake
place & receive a phone call with Ruby (Adhearsion)
require File.expand_path(File.dirname(__FILE__) + "/../../config/environment")
require 'adhearsion'
require 'adhearsion/initializer/asterisk'
require 'drb'
# http://help.cloudvox.com/faqs/getting-started/setup-for-ruby-adhearsion
desc "Make an outgoing phone call to number provided as 'call' (via Cloudvox)"
task :make_outgoing_call do
if ENV['call']
# Outgoing context from Cloudvox Switchboard, under "Outgoing settings (AMI)."