NERO ‘PROMISES’ (SKRILLEX AND NERO REMIX) (by TheOfficialSkrillex)
Mmmm, sick dubstep. Thanks, Henlu!
NERO ‘PROMISES’ (SKRILLEX AND NERO REMIX) (by TheOfficialSkrillex)
Mmmm, sick dubstep. Thanks, Henlu!
My copy of The Ruby Programming Language arrived today. I dived straight in to find a canonical justification for my superstition that rescue with no arguments only rescues StandardError and its descendants, not Exception and its descendants.
Along the way, I discovered that the rescue keyword can be used as a statement modifier. If the modified statement raises an exception, the argument to the rescue keyword is used as the value of the expression. For example:
# Instead of this if (@elephant.nil? or @elephant[:color] == "pink") puts "Weird elephant, dude" end # You can do this if (@elephant[:color] == "pink" rescue true) puts "Weird elephant, dude" end
At first glance, I’m not wild about it, but maybe it’ll end up growing on me, like Enumerable#inject. Either way, it’ll probably prove useful in other ways.
Wondering how the Wallabies do it? After all, the Springboks were playing under the same blind, naive, unfit, incompetent has-been referee.
What the Wallabies do well, is probe the referee’s capabilities and boundaries.
Today, they discovered in the first half that they could get away with their hands in the ruck, coming in from the side, high tackling, shoulder charges, obstruction, early running and killing the ball. The only thing that lame geriatric was watching for was forward passing and failure to release.
The Springboks carried on playing a full 80 minutes against the full rulebook. The Wallabies only played the rules that were enforced.
In the end, the referee is an integral part of the game, and the Springboks need to learn to play the whole game.
On a more personal note, Bryce Lawrence, you’re a […] disgrace to the game, you lazy […]. Whatever you were in your time, you need to retire now.
The bad habit that I’m unlearning at the moment, is letting myself trail off mid-sentence because it’s gotten too hard to do what I’m doing and describe what I’m doing at the same time.
The computer can wait all day and won’t mind; my navigator is a human trying to participate in the thought process, not just the photon gazing.
Thanks to Graham Ashton for making me think about this.
—
(Some) Agilistas: Still Not Yet Lean Thinkers - Martin Burns: PM PoV
As someone familiar with the Agile Manifesto, but not familiar with Lean, I found Martin’s post and follow up to my comment extremely challenging, in a good way.
Rory McKinley and I have published a little ruby gem that implements what I call the magic options pattern. You know the drill:
class BigThing
def initialize(options = {})
@height = options[:height]
@width = options[:width]
@depth = options[:depth]
@weight = options[:weight]
end
end
What an epic yawn.
With magic_options, you can just do this:
class BigThing
include MagicOptions
def initialize(options = {})
magic_options options
end
end
# Alternatively...
class BigThing
include MagicOptions
magic_initialize
end
If you’d like to program defensively, there are additional options for specifying what the options hash may and may not include.
Sure, it won’t save the world, but it’ll make the world a better place.
The source code is available at github.com and the documentation is already live on rubydoc.info. Use the usual gem install magic_options to install.
Unobtrusive Ruby is any Ruby code that stays out of your way. It does not make you write lots of boilerplate, or stub methods, or open classes. It is decoupled. Its tests run quickly, its classes fit on one screen, its methods are tiny, and it is quickly refactorable.
Unobtrusive Ruby is a state of mind.
MagicOptions is a ruby module that provides mechanisms for splatting an options hash into an object’s instance variables.