Serve CSS and Javascript even faster: improved Rails bundled_assets plugin

posted: April 27th, 2007 · by: Sven

in: Css & Html, Programming · tagged as: , , , , , , ·  6 comments »

I recently showed a Rails plugin that allows to transparently bundle your various CSS and Javascript resources (“assets” in Rails talk) into just one single CSS and Javascript file respectively.

I received some quite positive feedback on it and from various discussions some improvements have emerged that are now available in the repository.

Thanks go especially to Witold Rugowski who pointed me to the execution times of the Ruby implementation of JSMin with larger Javascript bundles. He also found a small bug in Uladzislau Latynski’s otherwise flawless JSMin implementation in Ruby that we are using by default.

Read the rest of this entry

Concise & transparently localized Rails url_helper methods?

posted: April 24th, 2007 · by: Sven

in: Globalization, Programming · tagged as: , , , , , ·  5 comments »

Update: It’s worth noting that the following information has been updated in the follow-up article: Concise, localized Rails URL helpers? Solved (twice).

Recently Jeremy Hubert commented on my tutorial about routes setup for Globalize. In short he criticized that Globalize doesn’t provide a solution for transparently adding the locale to Rails url_helpers where needed. Instead of being able to say:


You have to specify the locale for each and every call to an url_helper, like so:

article_url(@current_locale, @article)  

Needless to say that this does raise some eyebrows in the Rails community. So let’s see if we can come up with an acceptable solution here. This post describes some intermediary results.

Read the rest of this entry

A new code repository for useful stuff at

posted: April 22nd, 2007 · by: Sven

in: Misc stuff, Programming · tagged as: , , , ·  0 comments »

Update: some of the links in this summary might not work anymore and some information may be outdated. I’ve changed some of my code repository structure and some of the code has evolved. I’ve set up a central page though which I’ll keep updated. You can find it here: Small projects, plugins, patches and stuff like that.

Those of you who are subscribed to my RSS feed might have noticed that I’ve updated some URLs to plugins and patches in recent articles. That’s because I’ve decided that it’s a cool idea to have an own repository for “stuff” like: plugins, patches, utilities and the like. You can find it at

I’ve also set up a Trac for this repository just to be able to track commits at I don’t think that I’m ever going to need the tickets and wiki portions so that’s rather oversized. But Trac is already running for other projects, so that’s been the easiest way to get something going.

I’m going to add more stuff subsequently. Currently there are the following bits and pieces checked in yet.

Read the rest of this entry

Safari's beautiful search tag is broken - let's fix that

posted: April 16th, 2007 · by: Sven

in: Css & Html, Programming · tagged as: , , , , , , ·  8 comments »

What?! Okay, you might well file this away as “Why in the world would I waste my time on this?” - “Ummmm, well … just because it’s cool, you know!” But watch carefully! As a matter of fact this is serious research and development stuff (of course) that deals with super-useful web technologies. :-)

Most probably everybody who’s high on Safari (you know, that “best browser in the world”) knows those beautiful search box HTML widgets that very much resemble Safari’s own search box in the address bar.

Read the rest of this entry

Rails plugin: Blazing fast page loads through bundled CSS and Javascript

posted: April 14th, 2007 · by: Sven

in: Programming · tagged as: , , , , , ·  10 comments »

I recieved an interesting Sitepoint newsletter the other day which talked about bundling CSS and Javascript ressources (or “assets” like that’s called in Rails talk) to achieve faster page loads. This caught my attention specifically because I experienced the need to repackage many small CSS files on the fly a while back when I worked on a large CMS-type system.

Skimming through the PHP source article and code I thought that something similar could be done as a Rails plugin pretty easily and elegantly. I couldn’t resist, sat down and started coding away … so here are my results.

Read the rest of this entry

Allow custom column types in your Rails migrations

posted: April 7th, 2007 · by: Sven

in: Programming · tagged as: , , , , , , ·  6 comments »

We’ll all admit it. Rails’ migrations rock. Totally.

But when you try to change a database column to some vendor specific type (like varbinary for MySQL) that Rails doesn’t implement you notice that Rails doesn’t hand over control that easily here like it does elsewhere in ActiveRecord. You’re just not supposed to use any custom types.

This article explains how to easily change that behaviour.

Read the rest of this entry

Patch Mephisto to add a comments list filter

posted: April 4th, 2007 · by: Sven

in: Programming · tagged as: , , , , , ·  0 comments »

Mephisto is backed by Akismet when it comes to comment-spam-protection and this duo works pretty well. But like any such system it’s not 100% foolproof and therefor Rick has build it that way that comments are put aside, not completely deleted when Akismet thinks that it’s spam. You’re supposed to log into the admin interface, go to “Moderate comments” and then review them. You can approve or delete the comments separately or delete them all at once.

That’s all pretty reasonable and handy. But when I scrolled through my 900 spam comments yesterday I found myself really wanting to filter the list by keywords like “cialis” or “toyota” (what the heck is so cool about Toyota newly?). This way I could reduce the list by the largest portions in some steps and then only have to review the rest of it.

I looked at the source code and found that it’s pretty super simple to patch in support for this kind of feature. So, here you go.

Read the rest of this entry

How to add a floodgate to Mephisto's nearly perfect spam protection

posted: April 4th, 2007 · by: Sven

in: Programming · tagged as: , , , , , , , ·  5 comments »

Mephisto comes with Akismet support baked right into its heart and it works like a charm. I’ve been totally pleased with it spotting nearly every spam comment and collecting them for later review and bulk deletion.

Now, 30 days later, I found it was time to clean up the spammy comments piles that Mephisto hunted down for me. Actually nearly 900 comments had piled up. Year, that’s 30 per day. I don’t think that’s that much compared to what others receive.

But to me 900 spam comments in 30 days is too much. I don’t want to spend the time to manually check 900 comments even if I’d have to do it only once a month. No way.

I thus revisited an idea that Damien Katz called “negative captcha”. I realized that I’ve actually had experiences with this type of “protection” and they’ve been pretty good.

Read the rest of this entry

Howto use: Mephisto article list pagination plugin

posted: April 3rd, 2007 · by: Sven

in: Programming · tagged as: , , , , , ·  17 comments »

I’ve been asked for instructions on how to use the Mephisto pagination plugin that I’ve published last week. Well, that makes sense :-) So there you go.

The plugin allows you to add very basic pagination functionality to your article section pages (that is, pages like your blog homepage, sub-section pages etc.). Right now, there are only means to add a “older posts” and “newer posts” links to access the previous and next paginated articles list’s pages - you can see this at the bottom of my blog’s homepage.

Read the rest of this entry

artweb design
Sven Fuchs
Grünberger Str. 65
10245 Berlin, Germany

Fon +49 (30) 47 98 69 96
Fax +49 (30) 47 98 69 97