Rubyize this : 4th edition

The 3rd edition marked the beginning of a new association between Rubyize this and RefactorMyCode. I did things in a rather clumsy manner, telling people about how cool RmC was while asking them to use pastie to submit their refactored version of the code. At that time I didn’t realize that RmC and Rubyize this were ready to work together.

Well, RmC is now the official way to submit your rubyized solution. With the trackback system in place, a link to your refactored code will appear here at the moment you hit the submit button on RmC.

Before diving into the 4th edition, I’d like to take a moment to talk about the results of the 3rd one. We started with something pretty ugly that turned onto something pretty awesome!. On a side note, I really liked how some participants transformed the already mean sentence into something even meaner. As an exemple, the test sentence was : « You truly are a moron, sir! » and someone changed it to « you truly are a stupid moron sir! ». Someone else add fuel to the fire by writing « you truly are a ‘stupid’ moron, stupid sir! ». And finally, someone went as far as to write : « Stupid wabbit! Stupid, stupid, stupid! ». The situation was completely uncontrollable!

Enough said. Let’s get the ball rolling.

I have an array of insects and I want to be able to display on the screen the name, the iq and the annoyance factor of every members of a certain type. This “solution” works but has a ruby rating of 0.5/5. Moreover, it only works for butterflies… which feels rather incomplete and limiting. Remove stuff, add stuff and move stuff around. This dumb code must get smart and pretty!

Give it a shot now!

The voice of the community

I am thinking about that for quite some time now… how about having some posts written by other people once in a while? (Once every month maybe?)

If you have something relevant to share with us about anything conerning Ruby, I offer you to do it right here on Ruby Fleebie! just send me your post at frank[at]rubyfleebie.com and if it’s good enough, I’ll publish it.

I hate to say this but to be accepted, your post must follow these guidelines :

  1. Do not use the language of a 12 years old AOLer (e.g. Ruby iz da shit, it rEaLlY r0ckz hArd!!!1).
  2. Do not preach about Jesus. This is a Ruby blog.
  3. No mother jokes (e.g. Your mother is so fat one could believe she is not a human but a demolition truck!!). These jokes are not the slightest bit funny and more importantly they don’t make any sense on a ruby blog. Avoid them at all costs.
  4. Don’t go all crazy writing how much you hate me and how stupid I was to let a troublemaker like you spit his hatred on the blog without any precaution.
  5. Don’t scare my readers by telling them how much it would rock if someone would invent COBOLOnRails, ADAOnRails, FileMakerProOnRails or FoxtranOnRails.
  6. Don’t start your post like this : “And this is why I’d like to hear you on the subject”.
  7. Don’t threaten my readers by telling them you will suck their blood.
  8. And finally, under any circumstance, DO NOT insult Fleebie! Let this friendly and peaceful red alien alone for God sake!

That’s all I can think of right now.

Seriously, I cannot guarantee WHEN and IF I will publish your post, but if it’s relevant in one way or another, I will.

Rubyize this : 3rd edition

It’s time for another phenomenal edition of the fantastic Rubyize this serie (how humble is that?)

But before we go any further, I’d like to briefly talk about a brand new web 2.0 rails app that has been developed by Marc-AndrĂ© Cournoyer, a Ruby/Rails guru from Montreal. The app is called RefactorMyCode and became instantly popular among the coding community. The principle behind : People submit chunks of their own code that they would wish to see improved. Every members can then try their luck and submit their refactored version of the code. Marc told me that the Rubyize this serie partly inspired him in the creation of this application… it’s always cool to hear things like that!

Ok, now here is what we have to rubyize today :

Yikes! Pretty ugly this week… that’s how I like them.

IMPORTANT!
Wordpress doesn’t want that you write code… I suggest that you use RefactorMyCode to post your solution instead. You can also use pastie and just write a comment here with the URL to your snippet. The trackbacks are working correctly now so I strongly suggest that you use RefactorMyCode.

If for some reasons you do not wish to use RmC or Pastie, here are some precautions you should take :

  1. Code indentation with spaces doesn’t work. Use another character… an underscore maybe?
  2. Do not use <% or %> (it shouldn’t be a problem this week)
  3. COPY your code in your clipboard before sending it for safety measure… that way if wordpress screw up your code, you will be able to post it again rapidly by just removing what WordPress doesn’t like

Have fun!