This file contains 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
[scottwb@test]% rake gems:install | |
(in /home/scottwb/src/my_rails_app) | |
Missing these required gems: | |
sanitize = 1.2.1 | |
You're running: | |
ruby 1.8.6.383 at /usr/bin/ruby | |
rubygems 1.3.5 at /home/scottwb/.gem/ruby/1.8, /usr/lib/ruby/gems/1.8 | |
Run `rake gems:install` to install the missing gems. |
This file contains 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
[scottwb@test]% rake gems:install | |
(in /home/scottwb/src/my_rails_app) | |
rake aborted! | |
no such file to load -- gdata | |
/home/scottwb/src/ranger_site/Rakefile:10 | |
(See full trace by running task with --trace) |
This file contains 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
[scottwb@test]% rake gems:install | |
(in /home/scottwb/src/my_rails_app) | |
Missing the Rails 2.3.5 gem. Please `gem install -v=2.3.5 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed. |
This file contains 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
#!/usr/bin/env ruby | |
# | |
# Example showing how to make including a mixin override instance methods. | |
# | |
module TalksLikeMrT | |
def self.included(klass) | |
(klass.instance_methods & self.instance_methods).each do |method| | |
klass.instance_eval{remove_method method.to_sym} | |
end |
This file contains 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
scottwb-mbp% ruby script/console test | |
Loading test environment (Rails 2.3.5) | |
>> x = "some object" | |
=> "some object" | |
>> x.frozen? | |
=> false | |
>> Rails.cache.write("foo", x) | |
=> "some object" | |
>> x.frozen? | |
=> true |
This file contains 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
if Rails.version <= "2.3.8" | |
module ActiveRecord | |
class Base | |
def dup | |
obj = super | |
obj.instance_variable_set('@attributes', instance_variable_get('@attributes').dup) | |
obj | |
end | |
end | |
end |
This file contains 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
#!/usr/bin/env bash | |
# Run inside an SVN working copy to output to stdout a template file | |
# you can use with `git svn --authors-file` when converting an SVN repository | |
# to git. | |
# | |
authors=$(svn log -q | grep -e '^r' | awk 'BEGIN { FS = "|" } ; { print $2 }' | sort | uniq) | |
for author in ${authors}; do | |
echo "${author} = NAME <USER@DOMAIN>"; | |
done |
This file contains 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
# Simple Makefile to update installed Strings gems from source instead of | |
# via gems.strings.com. | |
ROOT = ~/src | |
APIROOT = $(ROOT)/strings-api | |
WTLIBROOT = $(ROOT)/strings-webtracker | |
WTDEVROOT = $(ROOT)/strings-webtrackerdev | |
SCDEVROOT = $(ROOT)/strings-scraperdev | |
all: clean update gems get uninstall install |
This file contains 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
#!/usr/bin/python | |
########################################################################### | |
# Code that manipulates the /Library/Receipts/db/a.receiptdb file in | |
# Mac OS X 10.5 Leopard. The only functionality that is implemented | |
# is clean up a particular package that is listed. | |
# | |
# MAKE SURE YOU BACKUP BEFORE DOING ANYTHING. This script will | |
# automatically make a backup (a.receiptdb.old.*), but I recommend doing | |
# one yourself just in case. I have not extensively tested or | |
# optimized this code; in fact, I hacked it together in a few hours and |
This file contains 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
# Add AR::Base class methods for enumerating all the model | |
# classes in a Rails project. | |
module ActiveRecord | |
class Base | |
def self.all_model_classes | |
connection.tables.map do |table| | |
begin | |
klass = Class.const_get(table.classify) | |
klass.ancestors.include?(self) ? klass : nil |