Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
#!/usr/bin/ruby require ENV["TM_SUPPORT_PATH"]+"/lib/web_preview" content = STDIN.read swear_words = { "foock" => /foock(er|ing)?/, "bar" => /bar/, "baz" => /baz/ } swear_counts = Hash.new swear_words.keys.each do |key| matches = content.scan(swear_words[key]) swear_counts[key] = matches.length end html_header("Swear Words") puts "<table>" swear_counts.keys.each do |key| puts "<tr><td>#{key.to_s}</td><td>#{swear_counts[key].to_s}</td></tr>" end puts "</table>" html_footer()
This paste will be private.
From the Design Piracy series on my blog: