Created
July 20, 2011 09:46
-
-
Save tessi/1094681 to your computer and use it in GitHub Desktop.
if you need an insult to work faster...
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
require 'nokogiri' | |
require 'open-uri' | |
# thanks to Rosalily for the list of insults | |
doc = Nokogiri::HTML(open('http://www.cloudnet.com/~renfest/insults.htm')) | |
# works fine if you need positive feedback too ;) | |
# http://hubpages.com/hub/List-Of-Positive-Daily-Affirmations | |
insults = doc.at_css('body ul ul ul ul ul').children.select {|c| c.name =='li'}.map {|c| c.children[0].text} | |
loop { %x{ say "#{insults.shuffle.first.upcase}"; sleep #{rand(10000)+1000} } } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment