Skip to content

Instantly share code, notes, and snippets.

@andre
Created January 26, 2011 20:11
Show Gist options
  • Save andre/797346 to your computer and use it in GitHub Desktop.
Save andre/797346 to your computer and use it in GitHub Desktop.
This will crash macruby inconsistently with "incorrect checksum for freed object - object was probably modified after being freed."
require "rubygems"
require "nokogiri"
puts "starting"
html=<<-EOS
<div class="result">
<div>
<h1>
<span class="type">link</span>
<a href="http://yahoo.com">yahoo</a>
</h1>
<h3>title text</h3>
<p>paragraph text</p>
<p class="attribution">
attribution text
</p>
</div>
</div>
EOS
doc = Nokogiri::HTML(html)
puts "Nokogiri parsed the html"
10.times do |t|
print "Run ##{t}: "
results = doc.css("div.result")
results.each do |result|
print"OK"
a=result.at_css("a")
p=result.at_css("p")
div=result.at_css("div")
attribution=result.at_css "p.attribution"
end
puts ""
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment