Skip to content

Instantly share code, notes, and snippets.

View pivotal-casebook's full-sized avatar

pivotal-casebook

View GitHub Profile
#!/usr/bin/env ruby
# script/whitespace
#
# Strips whitespace from any files modified in git
# Also:
# - converts tabs to spaces
# - ensures a single newline at the end
class WhitespaceProcessor
def self.process(code)
# Processes a given +block+. Yields objects if the block expects any arguments.
# Otherwise evaluates the block in the context of this object.
def process(offset = 0, &block)
block.arity > 0 ? yield_objects(offset, &block) : evaluate(&block)
end
# Yields a number of objects to a given +block+ depending on how many arguments
# the block is expecting.
def yield_objects(offset, &block)
yield *[soap, wsdl, http, wsse][offset, block.arity]
@pivotal-casebook
pivotal-casebook / Gemfile
Created July 9, 2011 13:20
Gemfile and spec_helper with Spork
source 'http://rubygems.org'
gem 'rails', '3.1.0.rc4'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'pg'
# Asset template engines
gem 'sass-rails', "~> 3.1.0.rc"
@pivotal-casebook
pivotal-casebook / cucumber.vim
Created December 16, 2011 16:14 — forked from tpope/cucumbertables.vim
tpope's Tabular-for-Cucumber, renamed for ftpluginability
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
Tabularize/|/l1
normal! 0
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
/usr/sbin/usermod -a -G rvm deploy
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison glibc
echo insecure >> ~/.curlrc
rvm get head --auto
rm ~/.curlrc
@pivotal-casebook
pivotal-casebook / gist:1719042
Created February 1, 2012 20:10
Postgres master slave status query
select application_name,state,sync_priority,sync_state from pg_stat_replication;
#!/bin/bash
echo -e "kern.sysv.shmmax=6442450944\nkern.sysv.shmmin=1\nkern.sysv.shmmni=256\nkern.sysv.shmseg=64\nkern.sysv.shmall=393216" > /etc/sysctl.conf
sysctl -w kern.sysv.shmmax=6442450944
sysctl -w kern.sysv.shmmin=1
sysctl -w kern.sysv.shmmni=256
sysctl -w kern.sysv.shmseg=64
sysctl -w kern.sysv.shmall=393216
#!/bin/bash
echo "Truth";
#!/bin/bash
echo -e "kern.sysv.shmmax=6442450944\nkern.sysv.shmmin=1\nkern.sysv.shmmni=256\nkern.sysv.shmseg=64\nkern.sysv.shmall=393216" > /etc/sysctl.conf
reboot
exit
sysctl -w kern.sysv.shmmax=6442450944
sysctl -w kern.sysv.shmmin=1
sysctl -w kern.sysv.shmseg=64
sysctl -w kern.sysv.shmall=393216