February 2009
26 posts
Ruby: hooks and metaprogramming 2
Here are some real life examples that come from Ruby-Concordion.
(A ruby active specification framework based on annotated HTML. Try it out with: gem install concordion .)
The “inherited” method, to detect subclasses of ConcordionTestCase:
def self.inherited(subclass)
# Concordion config/housekeeping code omitted. bind_test_method_to(subclass, config) end
and the similarly...
Ruby: hook methods and metaprogramming
Here are a handful of hook methods I’ve used in my Ruby career:
method_added
method_missing
const_added
const_missing
inherited
included
extended
These methods are called when the appropriate event takes place (e.g. method_missing in rails is used to detect method calls like Model.find_by_other(other) and delegate to the appropriate find(:other => other) method.)
Sometime just...
CSS to debug alignment problems
If you want to check the alignment of two design elements, you can add a grid line such as one would use in Photoshop or Gimp.
Just add an empty span to the page that contains the elements you want to align:
<span class=”horizontal_grid_line”> </span>
Then in your CSS add the following declaration:
.grid_line {
position: absolute;
width: ...
Design: It's all CRAP.
CRAP is a handy mnemonic for (aesthetic) design guidelines: contrast, repitition, alignment and proximity.
Contrast: Use dark text on a light background or vice versa.
“Performance is optimal when contrast levels […] exceed 70 percent.”
[UPD:124]
Repetition: Repeat important thematic elements of the design.
“Repeated exposure to stimuli for which people have...
RCor renamed to Ruby-Concordion
I just renamed RCor to Ruby-Concordion, and renamed the gem to just concordion.
It’s available through the usual gem sources:
gem install concordion
I haven’t moved anything but releases to the rubyforge page yet. For now the wiki and source are only available from the google code page.
Renaming a project with actual client code and vhosts and accounts named after it makes one...
Be not over-concerned with money, or position, or glory. For some day you will...
– Rudyard Kipling
Ruby: gem which
I just stumbled across this today while doing some work on RCor:
gem which Find the location of a library file you can require
Ok, so why is that useful?
Lets say you’re working on some ruby code with a line like:
require ‘concordion_test_case’
But ‘concordion_test_case’ isn’t in the project (which runs), so you deduce it must come from a gem.
...
Logo Design Process
Here’s the process I went through with some great people to come up with my company logo.
Choose a motif that is visually connected in some way to your companies industry.
Generate various examples within that motif.
Select a color palette.
Refine the result: tweak image size/placement, font size/placement, whitespace, etc.
For Goodspeed IT Consulting, the selected motif was...
testing
it seems to be a good thing
are these urls stable?
i hope so..
rcor - Google Code →
My Ruby acceptance testing tool
"#{0.succ}st post"
# -> “1st post”