Sharpening your Ruby fu 1

Posted by Colin A. Bartlett Thu, 18 Oct 2007 11:23:00 GMT

There was some discussion at last night’s Philly on Rails meeting about resources for helping you learn ruby and challenging you to do so.

Here’s a few I’ve put together:

Colin's Ruby Quiz #126 Submission 3

Posted by Colin A. Bartlett Sun, 03 Jun 2007 13:03:00 GMT

If you haven’t looked at this week’s RubyQuiz yet, beware. Spoilers ahead.

This week’s quiz was dead simple. But I think that’s the point of this one. The most interesting thing about RubyQuiz for me is looking at how other people solved the same problem (no matter how simple) and learning about other ways to do things.

Here’s my solution:

(1..100).each do |n|
  ret = ""
  ret += "Fizz" if n.divmod(3).last == 0
  ret += "Buzz" if n.divmod(5).last == 0
  ret = n if ret == ""
  puts ret
end

The challenge presented this week is one that is well suited for a quick in-interview coding session for potential hires. Having prospective employees write code was a new idea to me that I read about in Joel on Software. And although I didn’t have candidates in the last round of hiring write code, I did review some psudo-code on the whiteboard with them and I think the next candidates will actually sit down at a machine and tap something out for us in our presence.