This post originated from an RSS feed registered with Ruby Buzz
by Red Handed.
Original Post: Trimming Off the Internet
Feed Title: RedHanded
Feed URL: http://redhanded.hobix.com/index.xml
Feed Description: sneaking Ruby through the system
Anyone wondering about MouseHole 2? Rany Keddo has posted some instructions for winding it up. And, along with that, he posts one of the first MouseHole 2 scripts out there.
Whitelist.rb, for using Mr. T to stop you from wandering when you’re working.
class Whitelist < MouseHole::App
name "whitelist"
namespace "purzelbaumcorp.de"
description "fend off the time thieves!"
version "0.1"
%w{mail.google.com corelib.rubyonrails.org blog.purzelbaumcorp.de}.
each do |site|
- url("http://#{site}/*")
end
+ url("http://*")
# the pages flow through here
def rewrite(page)
page.document.at("html").innerHTML= %{
<body>
<div style='text-align: center; margin-top:40px;'>
<img src='http://www.doyouremember.co.uk/images/mr-t.gif' />
<div style='font-size:27pt; color:#aaa;'>
Pity the fool!
</div></div>
</body>
}
end
end
If I may interject, the rewrite method could also be written:
def rewrite(page)
page.html do
body do
div :style => 'text-align: center; margin-top: 40px;' do
img :src => 'http://www.doyouremember.co.uk/images/mr-t.gif'
div "Pity the fool!", :style => 'font-size:27pt; color:#aaa;'
end
end
end
end
Oh, and, if you use this: please consider unblocking RedHanded! It’s not that distracting and it’s super-helpful. Right, guys?