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
count = ObjectSpace.each_object { } | |
100_000.times do |i| | |
String.new | |
c = ObjectSpace.each_object { } | |
if c < count | |
puts "GC - Iteration #{i} - Was #{count} now #{c}" | |
end | |
count = c | |
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
1_000_000.times do |i| | |
String.new | |
if i % 1000 == 0 | |
puts ObjectSpace.each_object { } | |
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
abstract (1.0.0) | |
actionmailer (2.2.2, 2.2.1, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.4, 2.0.2, 1.3.6, 1.3.3, 1.3.0) | |
actionpack (2.2.2, 2.2.1, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.4, 2.0.2, 1.13.6, 1.13.3, 1.13.0) | |
actionwebservice (1.2.6, 1.2.3, 1.2.0) | |
activerecord (2.2.2, 2.2.1, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.4, 2.0.2, 1.15.6, 1.15.5, 1.15.3, 1.15.0) | |
activeresource (2.2.2, 2.2.1, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.4, 2.0.2) | |
activesupport (2.2.2, 2.2.1, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.4, 2.0.2, 1.4.4, 1.4.3, 1.4.2, 1.4.0) | |
acts_as_ferret (0.4.3, 0.4.1) | |
addressable (2.0.2, 2.0.1, 2.0.0) | |
ambition (0.5.4, 0.5.2) |
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
Processing PagesController#show (for 127.0.0.1 at 2009-02-15 02:00:32) [GET] | |
Session ID: 4df3fedb8bf63b3df27834b84eb3e657 | |
Parameters: {"slug"=>"ruby_on_rails", "action"=>"show", "controller"=>"pages", "section"=>"consulting"} | |
SQL (0.000213) SET NAMES 'utf8' | |
SQL (0.000070) SET SQL_AUTO_IS_NULL=0 | |
Rendering template within layouts/application | |
Rendering /pages/consulting/ruby_on_rails | |
Rendered layouts/_ruby_rags_button (0.00023) | |
Rendered layouts/_head (0.00075) | |
Rendered layouts/_nav_bar (0.00200) |
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
begin | |
sleep(1000) | |
rescue Exception | |
raise "Oh how awful, I was sleeping here!" | |
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
The query: | |
select episodes.id from episodes | |
left outer join links on links.link_id = episodes.link_id | |
where episodes.link_id > 0 and links.link_id is NULL | |
The Rails: | |
Episode.find(:all, :include => :link, :conditions => "episodes.link_id > 0 and links.link_id is NULL") |
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 CacheManager | |
def self.expire(*globs) | |
cache_dir = ActionController::Base.page_cache_directory | |
globs.each do |glob| | |
begin FileUtils.rm_r(Dir.glob(File.join(cache_dir, glob))) rescue Errno::ENOENT ; nil end | |
RAILS_DEFAULT_LOGGER.info("Expired pages: #{glob}") | |
end | |
end | |
def self.clear |
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 check_ilom | |
probe_ilom.each do |probe| | |
unless probe.include?("ok") | |
return NagiosPlugin::CRITICAL | |
end | |
end | |
NagiosPlugin::OK | |
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
def events_for_me limit = 10 | |
essay_ids = essays.all(:select => :id).map(&:id) | |
recording_ids = recordings.all(:select => :id).map(&:id) | |
essay_sql = "(resource_id IN (#{essay_ids.join}) AND resource_type= 'Essay')" | |
recording_sql = "(resource_id IN (#{recording_ids.join}) AND resource_type= 'Recording')" | |
my_comments = essays.ids.blank? ? [] : Comment.all(:conditions => "#{essay_sql} OR #{recording_sql}") | |
my_corrections = essays.ids.blank? ? [] : Correction.all(:conditions => "essay_id IN (#{essays_ids.join})") | |
(my_comments + my_corrections).sort_by{|x| x.created_at}.reverse[0...limit] | |
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
# If set to 1, InnoDB will flush (fsync) the transaction logs to the | |
# disk at each commit, which offers full ACID behavior. If you are | |
# willing to compromise this safety, and you are running small | |
# transactions, you may set this to 0 or 2 to reduce disk I/O to the | |
# logs. Value 0 means that the log is only written to the log file and | |
# the log file flushed to disk approximately once per second. Value 2 | |
# means the log is written to the log file at each commit, but the log | |
# file is only flushed to disk approximately once per second. | |
innodb_flush_log_at_trx_commit = 1 |