This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An Unobtrusive Javascript (UJS) driver based on explicit behavior definitions. Just | |
// put a "data-behaviors" attribute on your view elements, and then assign callbacks | |
// for those named behaviors via Behaviors.add. | |
var Behaviors = { | |
add: function(trigger, behavior, handler) { | |
document.observe(trigger, function(event) { | |
var element = event.findElement("*[data-behaviors~=" + behavior + "]"); | |
if (element) handler(element, event); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert a Gemfile to Heroku's .gems file plus config.gem statements for Rails 2.3 | |
herokuconfig = "" | |
railsconfig = "" | |
gemfile = File.new("Gemfile") | |
gemfile.readlines.each do |line| | |
if line =~ /gem ['"](\w+)['"](?:, ['"](.+?)['"]){0,1}(?:, :require => ['"](.+?)['"]){0,1}/ | |
herokuconfig << "#{$1}" + ($2 ? %Q( --version "#{$2}") : '') + "\n" | |
railsconfig << "config.gem '#{$1}'" + ($2 ? ", :version => '#{$2}'" : '') + ($3 ? ", :lib => '#{$3}'" : '') + "\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This example shows how to setup an environment running Rails 3 beta under 1.9.1 with a 'rails3' gem set. | |
∴ rvm update --head | |
# ((Open a new shell)) | |
# If you do not already have the ruby interpreter installed, install it: | |
∴ rvm install 1.9.1 | |
# Use the ruby + gem set | |
∴ rvm 1.9.1%rails3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~$ ARCHFLAGS='-arch i386 -arch x86_64' | |
~$ rvm install 1.8.7 --debug --reconfigure -C --enable-shared=yes | |
~$ wget http://sourceforge.net/projects/rubycocoa/files/RubyCocoa/1.0.0/RubyCocoa-1.0.0.tar.gz/download | |
~$ tar xzf RubyCocoa-1.0.0.tar.gz && rm RubyCocoa-1.0.0.tar.gz && cd RubyCocoa-1.0.0 | |
~/RubyCocoa-1.0.0$ ruby install.rb config --build-universal=yes | |
~/RubyCocoa-1.0.0$ ruby install.rb setup | |
~/RubyCocoa-1.0.0$ sudo ruby install.rb install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew install git | |
git config --global alias.st status | |
git config --global alias.ci commit | |
git config --global alias.co checkout | |
git config --global alias.br branch | |
git config --global user.name "First Last" | |
git config --global user.email [email protected] | |
git config --global color.branch auto | |
git config --global color.diff auto | |
git config --global color.interactive auto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SPEC_SUITES = [ | |
{ :id => :acl, :title => 'access control', :files => %w(spec/controllers/**/acl_spec.rb) }, | |
{ :id => :amazon, :title => 'Amazon libraries', :dirs => %w(spec/lib/amazon) } | |
] | |
namespace :spec do | |
namespace :suite do | |
SPEC_SUITES.each do |suite| | |
desc "Run all specs in #{suite[:title]} spec suite" | |
Spec::Rake::SpecTask.new(suite[:id]) do |t| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Very simple, but working, voice message system for Twilio in Ruby | |
# by Peter Cooper - http://twitter.com/peterc | |
# | |
# You can call the Twilio number, leave a message, as well as see the | |
# messages that are left. | |
# | |
# To set up on a server, just have this as the config.ru (yes, scrappy) | |
# on a Rack compliant server. Works great with Passenger.. | |
# | |
# In Twilio, just set the root as the endpoint for your app. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bundle_path "vendor/bundler_gems" | |
disable_system_gems | |
gem "rails", '2.3.5' | |
gem 'will_paginate', '2.3.11' | |
gem 'authlogic', '2.1.2' | |
gem 'haml', '2.2.13' | |
gem 'formtastic', '0.9.1' | |
gem 'state_machine', '0.8.0' | |
gem 'RedCloth', '4.2.2' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=== Epic Snow Leopard Upgrayyyyd Guide === | |
Son, you’re now living in the land of 64-bit systems. | |
That means that some of your 32-bit shit is now broken. | |
Not all is lost. | |
== Fixing MySQL weirdness |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This assumes you have the latest Ruby 1.9 installed via MacPorts: | |
# | |
# $ sudo port sync | |
# $ sudo port install ruby19 | |
# | |
# Make sure there are no trails of columnize, linecache, ruby-debug-base and ruby-debug. | |
for name in columnize linecache ruby-debug-base ruby-debug | |
do | |
(gem1.9 list | grep ^$name >/dev/null) && sudo gem1.9 uninstall -a -x -I $name | |
find /opt/local/lib/ruby1.9/gems/1.9.1/gems -name "$name*" -type d -maxdepth 1 -print0 | sudo xargs -0 rm -rf |