Skip to content

Instantly share code, notes, and snippets.

@hardbap
hardbap / gist:29881
Created November 28, 2008 02:09 — forked from dhh/gist:29752
config.action_controller.asset_host = Proc.new do |source, request|
non_ssl_host = "http://asset#{source.hash % 4}.backpackit.com"
ssl_host = "https://asset1.backpackit.com"
if request.ssl?
case
when source =~ /\.js$/
ssl_host
when request.headers["USER_AGENT"] =~ /(Safari)/
non_ssl_host
class Example < ActiveRecord::Base
includes
associations
named scopes
validations
Autotest.add_hook :initialize do |autotest|
autotest.add_mapping %r%^test/factories/(.*)_factory.rb$% do |_, m|
["test/unit/#{m[1]}_test.rb", "test/functional/#{m[1]}s_controller_test.rb",
"test/unit/helper/#{m[1]}s_helper_test.rb"]
end
autotest.remove_mapping %r%^app/helpers/application_helper.rb%
autotest.remove_mapping %r%^app/helpers/(.*)_helper.rb%
# Macro asserts that the routing of the given path is handled correctly
#
# If you don't specify a :controller it will try to guess the
# controller based on the current test.
#
# This tests only one half of what should_route will test. should_route
# uses assert_routing which combines assert_recognizes and the inverse
# assert_generates.
#
# Example:
@hardbap
hardbap / .irbrc
Created December 26, 2008 23:32 — forked from henrik/.irbrc
# http://pablotron.org/software/wirble/
# Provides "ri", history survives restart etc
require 'rubygems'
require 'wirble'
Wirble.init
# http://www.quotedprintable.com/2007/9/13/my-irbrc
# Show rails root in script/console prompt
require 'irb/completion'
(function($){
$.fn.inlineLabels = function(options){
var settings = $.extend({
suffix: '...'
}, options)
var inputs = this.find('input[type=text]')
inputs.data('labelText', inputs.prev('label'))
this.find('input[type=text]').each(function(i, input){
alias ss='./script/server'
alias sc='./script/console'
alias sg='./script/generate'
alias sdb='./script/dbconsole'
alias fixscreen='/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/VErsions/A/Resources/DMProxy'
alias startpg='/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /usr/local/pgsql/data/logfile start'
alias stoppg='/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /usr/local/pgsql/data/logfile stop'
alias reload='source ~/.profile'
alias m='mate'
alias ls='ls -G'
#!/bin/sh
echo Install Ruby
RUBY=ruby-1.8.6-p287
curl -O http://smartic.us/assets/2008/10/5/${RUBY}.tar.gz
tar -zxvf ${RUBY}.tar.gz
cd ${RUBY}
./configure --prefix=/usr/local
make && make install
#!/usr/local/bin/ruby
gems = ['rake', 'thin', 'mysql -- --with-mysql-include=/usr/include/mysql --with-mysql-lib=/usr/lib/mysql', 'god', 'right_aws']
gems.each do |gem|
puts `gem install --no-rdoc --no-ri #{gem}`
end
#!/bin/sh
echo Updating system this could take awhile...
yum -y update
echo Installing Development Tools...
yum -y groupinstall "Development Tools"
echo Installing zlib-devel, pcre-devel, openssl...
yum -y install zlib-devel pcre-devel openssl openssl-devel readline-devel