Skip to content

Instantly share code, notes, and snippets.

[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git@github.com:railsrumble/YOURTEAMNAME.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
require 'fileutils'
require 'tempfile'
class File
def File.open_safely(path)
result, temp_path = nil, nil
Tempfile.open("#{File.basename($0)}-#{path.hash}") do |file|
result = yield file
temp_path = file.path
end
HTTP_ERRORS = [Timeout::Error,
Errno::EINVAL,
Errno::ECONNRESET,
EOFError,
Net::HTTPBadResponse,
Net::HTTPHeaderSyntaxError,
Net::ProtocolError]
SMTP_SERVER_ERRORS = [TimeoutError,
IOError,
# straight Test::Unit
# one GET
# one failure message to address if something goes wrong
# six lines of code
# two db records created
# no string programming
def test_index
2.times { Factory(:user) }
get :index
# Making RSpec concise:
# http://opensoul.org/2008/11/10/making-rspec-concise
describe Company do
it { should have_many(:classifications) }
it { should have_many(:events) }
it { should have_many(:interests) }
it { should have_many(:jobs) }
it { should have_many(:leads) }
it { should have_many(:locations) }
_bold=$(tput bold)
_normal=$(tput sgr0)
__vcs_dir() {
local vcs base_dir sub_dir ref
sub_dir() {
local sub_dir
sub_dir=$(stat -f "${PWD}")
sub_dir=${sub_dir#$1}
export PATH=/usr/local/bin:/usr/local/mysql/bin/:/opt/local/bin:/opt/local/sbin:/opt/local/apache2/bin:/usr/local/apache2/bin:${HOME}/bin:$PATH
export PS1='\W \$ '
export EDITOR='vim -w'
export SVN_EDITOR='vim -wd'
export CDPATH=.:~:~/dev
# ALIASES
alias myip='ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d\ -f2'
begin
http.get query
rescue *HTTP_ERRORS => error
notify_hoptoad error
end
# test
require File.dirname(__FILE__) + '/../test_helper'
class XMLRendererTest < ActiveSupport::TestCase
context "A class with XMLRenderer mixed in" do
setup do
class ::DummyClass
include XMLRenderer
end
# Originally by Xavier Noria and posted to the Rails Core list here:
# http://groups.google.com/group/rubyonrails-core/browse_thread/thread/7554c8c5a25b4765?hl=en
# Output has been aggregated at:
# http://gist.github.com/20721
require 'rubygems'
require 'grit'
$KCODE = 'u'