Mandatory Fun Day Sucks

July 15th, 2008 at 07:25

The Daily WTF, for those of you who have never heard of it, is a website originally dedicated to showcasing the use of horrible source code found being used in production environments.  It has since grown to doing much more; it seems to currently specialize in demonstrating horrible business practice, which I suppose is still somewhat amusing. What isn’t amusing at ALL is the webcomic called Mandatory Fun Day, which is being featured on tdwtf.  It is horrible.  It is a waste of bandwidth.  It is so bad that I don’t even want it showing up in my RSS feed for tdwtf anymore. So, I went to the trouble of actually fixing this problem.  My RSS reader, Liferea, has a neat feature it calls a conversion filter, supposedly for support of non-RSS feeds, with the help of a script.  It passes the data it fetches from the source URL to a script’s STDIN, and expects standard RSS from the script’s STDIO.  I fashioned a script to get rid of the scourge that is Mandatory Fun Day.  Here it is:

#!/usr/bin/env ruby
require 'rexml/document'
doc = REXML::Document.new( $stdin )
#select and delete all of the items with "Mandatory Fun Day" as the category
doc.root.elements.delete_all( "/rss/channel/item[category/text()='Mandatory Fun Day']" )
doc.write
Slap that in a file, set it executable, and re-add the tdwtf feed.  When adding, hit advanced, and enable the conversion filter.  Point it at the script.  Voila, no more Mandatory Fun Day.  And people say XML sucks.