Skip to content

Instantly share code, notes, and snippets.

View techpeace's full-sized avatar

Matt Buck techpeace

View GitHub Profile
@techpeace
techpeace / .gitconfig
Created November 2, 2011 15:19
My global git config
[color]
branch = auto
diff = auto
status = auto
ui = auto
sh = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
@techpeace
techpeace / .irbrc
Created October 27, 2011 21:26
Recent irbrc
require 'awesome_print'
require 'wirble'
# Print all output with awesome_print
module IRB
class Irb
def output_value
ap @context.last_value
end
end
@techpeace
techpeace / .vimrc
Created October 24, 2011 19:08
Dealing with tabstops in vim
" functions to deal with Tabs
command! Stab2 call Stab2()
function! Stab2()
let l:tabstop = 2
let &l:sts = l:tabstop
let &l:ts = l:tabstop
let &l:sw = l:tabstop
setlocal expandtab
endfunction
.fullscreen {
display: block;
position: fixed !important;
top: 0;
left: 0;
width: 100% !important;
height: 100% !important;
z-index: 9999;
margin: 0;
padding: 0;
@techpeace
techpeace / irbrc.rb
Created June 30, 2011 18:55
An incredibly awesome ~/.irbrc
require 'awesome_print'
require 'wirble'
# Print all output with awesome_print
module IRB
class Irb
def output_value
ap @context.last_value
end
end
@techpeace
techpeace / .vimrc
Created June 7, 2011 21:44
A function that enables switching your tabstop configuration easily in vim.
" from http://stackoverflow.com/questions/1562336/tab-vs-space-preferences-in-vim
" http://vimcasts.org/episodes/tabs-and-spaces/ is also worth checking out
" put all this in your .vimrc or a plugin file
command! -nargs=* Stab call Stab()
function! Stab()
let l:tabstop = 1 * input('set shiftwidth=')
if l:tabstop > 0
" do we want expandtab as well?
@techpeace
techpeace / logger_upgrade.rb
Created May 18, 2011 18:18
A collection of scripts to automate some Rails 3 upgrade tasks
#!/usr/bin/env ruby
# Upgrades all files to use Rails.logger, rather than logger
Dir['app/**/*.*', 'config/**/*.*', 'lib/**/*.*'].each{ |filename|
data = File.read filename
File.open(filename,'w'){|f|
f.print data.gsub(/\slogger/, ' Rails.logger')
}
}
require "rubygems"
module ActiveRecord; end
require "ap"
# Log to STDOUT if in Rails
if !Object.const_defined?('RAILS_DEFAULT_LOGGER')
require 'logger'
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
end
@techpeace
techpeace / cijoe_github_poller.rb
Created October 27, 2010 21:07
Polls your git repo and kicks off CI Joe builds upon new commits. Useful for CI Joe servers running behind a firewall.
require 'yaml'
require 'net/http'
PROJECT_PATH = '/Users/mbuck/src/applicant_portal/hr_suite'
PORT = 3000
def current_sha
`cd #{PROJECT_PATH} && git rev-parse origin/master`.chomp
end
#! /bin/sh
help0()
{
echo "ERROR: No argument provided."
echo "Usage:"
echo " `basename $0` \"title\" to provide a new Terminal title."
}
help2()
{