Run the following in your shell:
brew install macvim --override-system-vim
brew upgrade tmux
brew install reattach-to-user-namespace
echo 'set-option -g default-command "reattach-to-user-namespace -l bash"' >> ~/.tmux.conf
module InfiniteHash | |
def self.new | |
Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) } | |
end | |
end |
#! /usr/bin/ruby | |
require 'rubygems' | |
require "highline/system_extensions" | |
include HighLine::SystemExtensions | |
orig, new, args = ARGV | |
args = Array(args) | |
file_names = Dir["**/*.*"] |
command! -nargs=1 Silent | |
\ | execute ':silent !'.<q-args> | |
\ | execute ':redraw!' | |
" test the current file in the next tmux window | |
nmap <leader>tt :Silent tmux send-keys -t 1 "rspec %" C-m <cr> | |
" test the line from user input | |
nmap <leader>tl :Silent tmux send-keys -t 1 "rspec %:<C-r>=line('.')<cr>" C-m <cr> |
# Takes a table name, and an array of hashes where keys are column names and values are values. | |
# Expects hashes to all contain the same keys. | |
def bulk_insert(table, rows) | |
columns = rows.first.keys | |
to_insert = rows.map do |d| | |
vals = columns.map {|k| d[k] } | |
ActiveRecord::Base.send(:replace_bind_variables, "(#{vals.length.times.collect {'?'}.join(',')})", vals) | |
end |
describe ".inc_num_runs_by_brand" do | |
let (:upc_master) {FactoryGirl.create(:upc_master_with_sizes)} | |
it "increments the num runs correctly" do | |
UpcMaster.inc_num_runs_by_brand(upc_master.sizes.first.brand) | |
upc_master.reload.num_runs.should == 1 | |
end | |
end |
Control-A: Go to the beginning of the line | |
Control-E: Go to the end of the line | |
Control-P: Go up to the next line | |
Control-N: Go down to the next line | |
Control-F: Go forward one character | |
Control-B: Bo backward one character | |
Control-K: Delete all text proceeding cursor | |
Control-O: Add a line after current line |
require 'tinder' | |
require 'time' | |
campfire = Tinder::Campfire.new 'subdomain', :token => 'herp' | |
VOICES = [ | |
'Agnes', | |
'Albert', | |
'Alex', | |
'Bad News', |
# Generated by Percona Configuration Wizard (http://tools.percona.com/) version REL5-20120208 | |
# Configuration name mysql55-master generated for [email protected] at 2012-06-23 04:45:09 |
module RSpec::Mocks::Methods | |
# Validates the method exists on the stub-ee before stubbing | |
def s_stub(message_or_hash, opts={}, &block) | |
if Hash === message_or_hash | |
message_or_hash.each {|message, value| s_stub(message).and_return value } | |
else | |
raise "#{message_or_hash} not defined on #{self.inspect}" unless self.respond_to?(message_or_hash.to_sym) | |
stub(message_or_hash.to_sym, opts, &block) | |
end | |
end |
Run the following in your shell:
brew install macvim --override-system-vim
brew upgrade tmux
brew install reattach-to-user-namespace
echo 'set-option -g default-command "reattach-to-user-namespace -l bash"' >> ~/.tmux.conf