I was implementing search in a Ruby app where the results objects were instances
of a mix of model classes. Each one had what could be considered a title and a
description, but the method names were inconsistent.
Wrapping each result in a SearchResult decorator to normalize the interface
seemed like a good idea. Ruby provides an abstract Delegator and a concrete
SimpleDelegator which gets most of the way there.
To normalize the method interface, I wrote an extension of SimpleDelegator
with a #hunt_and_call(*candidates) method, which finds and calls the first
method of the candidate list which the delegate responds to.
Here’s the example calling code:
And the MethodHuntingDelegator implementation:
And of course:
Completely insane? Useful enough for a gem? Better way of going about it? Give
me hell in the gist comments.
Ridiculously good article on digital cameras at The Verge, worth reading
even if you’re not in the market for one.
What we’re seeking to do here is help you make an informed decision by
separating the meaningful data from the meaningless. This is a guide to
discerning the things that will make a recognizable difference in your
photographic experience and results. We’ve selected a few of our favorite
cameras in the categories below, but those will change over time, whereas the
rest of this advice will (hopefully) remain relevant for a long time to come.
Why can’t there be more content of this quality on the Internet?
It works like you’d expect, with a couple restrictions: First, every morning it starts over fresh. Your list from the day before is thrown in the trash. This, hopefully, will encourage the completion of all tasks each day and discourage the addition of frivolous items. Second, there’s no reordering. I want to trust my subconscious; if I add a task before another, then it’s because my mind has determined it’s priority by remembering it sooner.
An excellent OpenGL tutorial; beware other documentation and tutorials which endorse deprecated APIs and practices.
Modern enough to be applicable to OpenGL ES 2.0 (and therefore WebGL), which requires vertex and fragment shaders to be written in OpenGL Shader Language to take advantage of the programmable rendering pipeline, and which removes much of the procedural (glBegin/glEnd) API.
Adapting this tutorial to Cocoa Touch for iPhone/iPad OpenGL ES 2.0 development was relatively easy, and beat any iPhone OS specific documentation for ES 2.0 that I’ve found.
Nice simple template format, implementations in Ruby, Python, JavaScript, PHP and more.
Similar to Django templates in simplicity, syntax and sensible constraint of logic.
Tiny blog engine in Ruby and Rack, uses flat git-managed content files containing YAML & ERB/Markdown, handles comments via disqus, leaves caching to HTTP.
Simple version number specification for systems which expose a public API. The format is major.minor.patch (e.g. 3.0.12); major indicates backwards incompatible, minor indicates backwards compatible, and 0.x.x indicates rapid development.