Category Archives: Ruby

Droplet Thoughts (Day 2)

I’m calling my RubyWeekend #3 game “Droplet”. I will not proceed to ramble about it to help my planning. And you get to read the results, you lucky person you! I’m setting aside the animals/people aspect for the competition. It’s just going to be about the plants. I’m going to use Garage Band’s built-in instruments [...]

Also posted in Projects, RubyWeekend | Leave a comment

Election Year: Zombies vs. Pirates!

Done! Here’s my entry for RubyWeekend #1! You can follow my previous entries in the zombies-vs-pirates rubyweekend section (they didn’t appear on the home page or in RSS feeds). Here’s the premise of the game: It’s another election year, and the two major political parties, the Zombie Party and the Pirate Party, have chosen their [...]

Also posted in Projects, RubyWeekend | Tagged , , | Leave a comment

Zombies versus Pirates!

The RubyWeekend contest has started, and the theme is… Zombies versus Pirates!?! Here’s some sample dialog from my game: “Brains!” “Arrrrr!” “Braaains!” “No, Aaarrrr!” “No! Brraaaaiiiins!” “Let’s just agree to disagree.” “…brains.” … just kidding. : )

Also posted in Projects, RubyWeekend | Tagged , , , | Leave a comment

Snippet: Hash#with_only, #merge_existing

Here are some potentiall useful one-liner methods for extracting and merging only parts of Hashes. I was surprised to find out that Hash didn’t already have built-in methods to do these things. Maybe they’re considered so obvious that they don’t need to be built-in, but I think the readability gain is worth it. 1 2 [...]

Also posted in Snippets | Tagged , | 2 Comments

Snippet: Range#compare

Here’s a little idea that popped into my head for enhancing the Range class in Ruby: 1 2 3 4 5 6 7 8 9 10 11 class Range def compare( value ) if member?( value ) 0 elsif value <= self.begin -1 elsif value >= self.end 1 end end end Then you can perform [...]

Also posted in Snippets | Tagged , , , | Leave a comment

Testing the Git Waters

Apparently, Git is the new hotness, and Github is liquid hotness concentrate, with pulp. Or, so I hear. Rails monkeys seem to like it, anyway. ;) You can blame Piotr for bringing it to my attention, and then radiant-comments for giving me an excuse to dip my foot in. I did some browsing online, and [...]

Also posted in Projects | Tagged , , , , | Leave a comment

RDoc C parser needs improvement

I don’t think I’ve mentioned here how frustrating RDoc’s C parser can be. It’s almost up there with SDL_mixer on the headache-o-meter, I swear. I’ll admit, the idea of automatically generating documentation from the code structure and comments in the source code is neat. And RDoc does a pretty good job of figuring out the [...]

Posted in Ruby | Tagged , , , , | Leave a comment

Emacs: ruby-electric-return

I’ve made a patch to improve the ruby-electric-mode for Emacs. If you use Emacs to edit Ruby code, please try it out and tell me what you think! I’ve created a patch to the ruby-electric-mode for Emacs, which makes pressing return after certain keywords automatically insert an “end” statement, just like pressing space does. So, [...]

Posted in Ruby | Tagged , | Leave a comment

Easier solution for using BetterNestedSet

More tinkering with BetterNestedSet, and I think I’ve got the solution nailed: First of all, use redundant columns to store the parent id. One is for your application to access, the other is for BetterNestedSet to handle – I called mine :parent_id and :bns_parent_id. You can tell BNS to use a nonstandard parent column like [...]

Also posted in Projects | Tagged , , | Leave a comment

Rant: BetterNestedSet (than a nail in your skull)

I’ve been tinkering around with ApeDoctor, my to-be API documentation application running on Rails. The core class of ApeDoctor is the Amodule, a representation of a Ruby module/class. (It’s Amodule because the class name Module was taken, of course!) And since Ruby modules can have other modules or classes under them, I had a hierarchy/tree/nested [...]

Also posted in Projects | Tagged , , , | Leave a comment