Ruby

warning: Creating default object from empty value in /home/kourge/kourge.net/modules/taxonomy/taxonomy.pages.inc on line 34.

LOLFeed for Ruby

Flickr's recent introduction of the LOLFeed format was highly amusing. Following Mark Christian's footsteps, I decided to write a Ruby version of the LOLFeed parser. At first it was merely a port, but I then found the state machine to be too cumbersome, so I went all out with regular expressions. Read on for the code.

A Better main.py for Python-Cocoa Apps

Although Apple describes both Python and Ruby as "first-class citizens" under a Leopard development environment, I feel that Apple meant it more programmatically than documentationally. Sure, both PyObjC and RubyCocoa are mature bridges, but both lack documentation from Apple (you have to rely on the community for gotchas) and RubyCocoa seems to receive more attention than PyObjC when it comes to tutorials for starters.

Moreover, the starting templates for Cocoa-Python apps and Cocoa-Ruby apps are not created equal. For example, while Apple encourages the scripts to be put into Resources, only a Cocoa-Ruby bootstrap file generated by Xcode (called main.rb) would automatically require them. A Cocoa-Python bootstrap file generated by Xcode (called main.py) would not import them, and this problem would manifest itself when you first attempt to do bindings in Interface Builder.

First, observe a generated main.rb:

Ruby Enumerable and Array Extras: pluck and invoke for Ruby

The Prototype JavaScript Framework has almost all of the Array and Enumerable extensions that Ruby has, but the reverse doesn't seem to be true. One thing apparently missing from Ruby is pluck() (or invoke()). Picture the following scenario in Prototype JavaScript:

Synthetic Division Heavylifter

Synthetic Division Heavylifter is a tool available in JavaScript, Python, Ruby, and Common Lisp that performs synthetic division. Synthetic division is a process that is used to speed up the factoring of polynomials. However, it is still a hassle to utilize when the first term or the last term of the polynomial has a large number of factors, since the possible number factor candidates would increase.

Syndicate content