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 | |
require 'optparse' | |
options = { :use_svn => true } | |
OptionParser.new do |opt| | |
opt.banner = "Usage: upgrade_views [options]" | |
opt.on('-f', '--file_rename', 'Use file renaming rather than svn move to update the files.') { |v| options[:use_svn] = false } | |
opt.parse!(ARGV) | |
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
class Schedule | |
def initialize(service) | |
@service = service | |
end | |
attr_accessor :schedule | |
def day | |
(1..23).map { [] } |
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
2009-10-06 07:51:36.776 System Preferences[408] PrefPaneInstalld: awakeFromNib | |
2009-10-06 07:51:36.777 System Preferences[408] PrefPaneInstalld: mainViewDidLoad | |
2009-10-06 07:51:36.796 System Preferences[408] /bin/launchctl unload -w -S Aqua /Users/msteel01/Library/LaunchAgents/com.floehopper.installdPrefPane.plist | |
2009-10-06 07:51:36.861 System Preferences[408] launchctl: illegal option -- S | |
usage: launchctl load [-wF] paths... | |
2009-10-06 07:51:36.862 System Preferences[408] Error executing command: /bin/launchctl unload -w -S Aqua /Users/msteel01/Library/LaunchAgents/com.floehopper.installdPrefPane.plist | |
2009-10-06 07:51:36.862 System Preferences[408] PrefPaneInstalld#mainViewDidLoad: RuntimeError: Error executing command: /bin/launchctl unload -w -S Aqua /Users/msteel01/Library/LaunchAgents/com.floehopper.installdPrefPane.plist | |
/Users/msteel01/Library/PreferencePanes/Installd.prefpane/Contents/Resources/command.rb:19:in `execute' | |
/Users/msteel01/Library/PreferencePanes/Installd.prefpane/Contents/Resource |
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
$LOAD_PATH.unshift(Rails.root + '/vendor/plugins/cucumber/lib') if File.directory?(Rails.root + '/vendor/plugins/cucumber/lib') | |
CUCUMBER_FAILED_LOG = Rails.root + "log/cucumber_failed" | |
touch(CUCUMBER_FAILED_LOG) unless File.exist?(CUCUMBER_FAILED_LOG) | |
begin | |
require 'cucumber/rake/task' | |
require "cucumber_rerun_task" | |
namespace :features do | |
Cucumber::Rake::Task.new(:active) do |t| |
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
class Module | |
def private(*args) | |
if args.empty? | |
@acl = :private | |
else | |
args.each do |meth| | |
alias_method :"__#{meth}", meth | |
undef_method meth | |
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
# Assuming AR test models are present... | |
# The salient bits are: | |
# | |
# class Developer < ActiveRecord::Base | |
# has_many :audit_logs | |
# end | |
# | |
# class AuditLog < ActiveRecord::Base | |
# belongs_to :developer, :validate => true | |
# 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
class SomeController | |
before_filter :find_product | |
before_filter :sanitise_segment | |
def show | |
@product.reviews.for_segment(@segment).order_by(sort_order) | |
end | |
def show_extended_detail |
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
# something like ... | |
# I think this goes in specs/support/whatever.rb | |
def it_should_be_invalid_without(*fields) | |
object_name = described_class.name.underscore | |
fields.each do |field| | |
it "should fail if #{field} is missing" do | |
instance_variable_get("@#{object_name}").send(:"#{field}=", nil) | |
instance_variable_get("@#{object_name}").should_not be_valid_for_create |
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
# ARCHFLAGS may or may not matter - I set mine up this way just in case. | |
~$ echo $ARCHFLAGS | |
-arch i386 -arch x86_64 | |
# Be sure to compile ruby with --enable-shared | |
~$ rvm install 1.9.1 --debug --reconfigure -C --enable-shared=yes | |
# Test to ensure that --enable-shared worked | |
~$ ruby -e "require 'rbconfig'; puts Config::CONFIG['ENABLE_SHARED']" | |
yes |
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
-- | |
def stub_oauth! | |
TwitterAuth.stub!(:config).and_return({ | |
'strategy' => 'oauth', | |
'oauth_consumer_key' => 'testkey', | |
'oauth_consumer_secret' => 'testsecret' | |
}) | |
end |
OlderNewer