Subject: Notice to all employees
Date: Tue, 24 Feb 2009 13:06:14 -0500
Dear employees,
Due to the current financial situation caused by the slowdown
of the economy, Management has decided to implement a scheme
to put workers of 40 years of age and above on early retirement.
This scheme will be known as RAPE (Retire Aged People Early).
Persons selected to be RAPED can apply to management to be eligible
for the SHAFT scheme (Special Help After Forced Termination).
Persons who have been RAPED and SHAFTED will be reviewed under the
SCREW programme (Scheme Covering Retired Early Workers). A person
may be RAPED once, SHAFTED twice and SCREWED as many times as
Management deems appropriate.
Persons who have been RAPED can only get AIDS (Additional Income
for Dependents & Spouse) or HERPES (Half Earnings for Retired
Personnel Early Severance).
Obviously, persons who have AIDS or HERPES will not be SHAFTED or
SCREWED any further by Management.
Persons who are not RAPED and are staying on will receive as much
SHIT (Special High-Intensity Training) as possible. Management
has always prided itself on the amount of SHIT it gives employees.
Sincerely,
The Management
(I hope you enjoyed this :D There is also an USAF version from 1997).
On VisitaCSA we’re using
defunkt’s facebox to
show places images at
large. Facebox is a great general-purpose lightbox, because it is fast, stable,
is based on jQuery and has got a really clean API.
But we needed more than a simple display lightbox, because we wanted our users
to navigate easily between all images, possibly without modifying facebox at
all. The solution turned out to be pretty simple, thanks also to the
will_paginate plugin we were
already using. It all burns out to have:
A Photo model, instrumented with the has_attachment method
Resource routes for photos (map.resources :photos, :only => :show in
config/routes.rb)
A show controller method in the PhotosController that calls .paginate
with a :per_page argument of 1
An HTML view for the photo resource, that has pagination controls using the
will_paginate helper
Some jQuery code hooks onto the pagination links and make the browser load
via AJAX the next photo directly into the facebox.
Here is the relevant code, simplified from what’s actually online, because the
photo model is actually polymorphic (using STI) and many different collections
are handled by the photos controller (photos, flyers, etc) for different
models, with different thumbnails :P.
Model [app/models/photo.rb]
classPhoto<ActiveRecord::Base has_attachment :storage=>:file_system, :path_prefix=>'public/photos',
:processor=>'ImageScience', :thumbs=> { :thumb=>'600x800' }
end
Well, maybe I should to wrap up all this stuff in a simple-and-nice-to-use
plugin, but it’s all built around reusable components, and the effort needed to
keep it up-to-date is currently out of order for me because of time
constraints. And, sincerely, I see little benefit in it. It’s a
“paginate-with-one-item-per-page” hack, after all :).
To me, it looks like a contrived melody, or complicated poetry. It’s evil
engineering, I know. But when I was writing it, I felt exactly the same I did
while writing verses with rhymes. _why’s words
are absolutely pertinent here:
until programmers stop acting like obfuscation is morally hazardous, they’re
not artists, just kids who don’t want their food to touch.”.
You can view the code with syntax hilighting on
github, or with the “View source” function
of your browser while you’re on the segfault
site. :)
I currently maintain the italian mirror of
the Open Source Initiative web site, and today I
realized that the script I wrote some months ago wasn’t doing its job well..
because the CSS files weren’t downloaded at all, causing a rather unpleasant
rendering of the site.
To mirror opensource org I’m currently using the plain’ol GNU
Wget -r –mirror and so on. While the
good’ol wget downloads each page prerequisite defined in the HTML source,
it doesn’t support @import CSS rules, and doesn’t download images referenced in
CSS with url() rules.
BTW, nothing that can’t be resolved with some regex-fu: that’s why I’m sharing
the script I’m currently using to mirror the
opensource.org web site, hoping it will generate either a new mirror or some
insights on how to do this job better :).