Skip to content

Instantly share code, notes, and snippets.

View thbishop's full-sized avatar

Tommy Bishop thbishop

View GitHub Profile
Index: vendor/gems/delayed_job-1.8.4/lib/delayed/command.rb
===================================================================
--- vendor/gems/delayed_job-1.8.4/lib/delayed/command.rb (revision 162)
+++ vendor/gems/delayed_job-1.8.4/lib/delayed/command.rb (working copy)
@@ -54,7 +54,7 @@
# Re-open file handles
@files_to_reopen.each do |file|
begin
- file.reopen File.join(RAILS_ROOT, 'log', 'delayed_job.log'), 'w+'
+ file.reopen File.join(RAILS_ROOT, 'log', 'delayed_job.log'), 'a'
index 3207690..3ce624e 100644
--- a/lib/railroad/rails_framework.rb
+++ b/lib/railroad/rails_framework.rb
@@ -10,6 +10,10 @@ class RailsFramework
require "config/environment"
@name = 'Rails'
@migration_version = ActiveRecord::Migrator.current_version
+
+ ActiveSupport::Inflector.inflections do |inflect|
+ inflect.singular(/ess$/i, 'ess')
#!/usr/bin/ruby
#
# I deliberately didn't DRY /usr/local references into a variable as this
# script will not "just work" if you change the destination directory. However
# please feel free to fork it and make that possible.
#
# If you do fork ensure you add a comment here that explains what the changes
# are intended to do and how well you tested them.
#
@thbishop
thbishop / my_controller.rb
Created May 19, 2010 22:50
call a private method with arg from before_filter block
before_filter :only => [:create, :update, :destroy] do |c|
c.send :my_method, :arg
end
@thbishop
thbishop / rails_version_gem_freeze.rb
Created July 26, 2010 16:51
rails freeze gems of a specific version
# in case you have multiple versions on your box
rake rails:freeze:gems VERSION=2.3.2
[root@localhost ~]# cat /etc/redhat-release
Fedora release 11 (Leonidas)
[root@localhost ~]# passwd -S root
root PS 2010-08-13 0 99999 7 -1 (Password set, MD5 crypt.)
[root@localhost ~]# echo $?
0
[root@localhost ~]#
begin
res = @http.request(req)
unless res.kind_of?(Net::HTTPSuccess)
res.error!
end
rescue Timeout::Error, Errno::EINVAL, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ETIMEDOUT, NoMethodError => e
# http://redmine.ruby-lang.org/issues/show/2708
# http://redmine.ruby-lang.org/issues/show/2758
if e.to_s =~ /#{Regexp.escape(%q|undefined method 'closed?' for nil:NilClass|)}/
Chef::Log.fatal("POST to Solr encountered exception Errno::ECONNREFUSED: net/http undefined method closed?")
top_dir = "/data/realtime"
["", "fetched", "fetched/radar"].each do d
directory "#{top_dir}/#{d}"
action :create
owner "ldm"
group "ldm"
mode "777"
recursive true
end
end
@thbishop
thbishop / quick hack.rb
Created October 23, 2010 06:33
in rubygem package provider
def with_gem_sources(*sources)
sources.compact!
original_sources = Gem.sources
# Gem.sources = sources unless sources.empty?
unless sources.empty?
if Gem.respond_to?(:sources=)
Gem.sources = sources
else
Gem.instance_variable_set(:@sources, sources)
end
[["rubygems-updateU:Gem::Version["
1.3.6" ruby