Steffen Hi, the name's Steffen and I'm writing about the Web, programming and all those things coming to my mind. Enjoy your stay.

I'm currently working on fabidoo.com - 3D Printing for everyone!

ShadedBorder with Gradients

October 20th, 2007

The new version 0.3 of ShadedBorder supports gradient backgrounds:

ShadedBorder with Background Gradient

Have a look at the updated example.

The new feature is quite intuitive to use. You need some one pixel wide gradient background image with any height you like, which when repeated in x direction gives you your gradient (grad.png). All you need to know is the color of the last (bottom most) pixel in this image, let it be #444444 a dark gray in this example.

Then simply add the following rule for each of the elements which should be “bordered” to your CSS style sheet:

#shadowed-border .sb-inner { background:#444444 url(grad.png) repeat-x; }

That’s it. Thanks to Piotr for reminding me that this feature was missing ;-) And thanks to all you guys answering questions in the comments section of ShadedBorder - it’s getting kind of a forum, right? :-)

While touching the code I also added an optimization which results in much less DIVs generated and should give quite some speed improvements.

Tags: , , ,

Ruby on Rails: gettext + memcache = trouble

September 29th, 2007

The latest Ruby gettext 1.10.0 gem broke the memcache based fragment caching of the current project I’m working on. I figured out what the problem was. gettext 1.10.0 tries to localize caching of fragments by kind of appending the Locale.current to the fragment cache key, e.g. “items/show/1″ becomes “items/show/1_en”, “items/show/1_de”, …

This by itself isn’t a problem but gettext also overwrites the default Rails implementation for expiring fragments. The gettext mechanism expires each localized cache fragment for a given key, e.g. “items/show/1_*” (where * is a wildcard). The current memcache-client gem (1.5.0) however doesn’t support wildcard based key access and a “delete_if method not defined” exception gets thrown.

Read the rest of this entry »

Ellipsis or “truncate with dots” via JavaScript

August 11th, 2007

Internet Explorer comes with a nice CSS feature for truncating text by appending three little dots: text-overflow:ellipsis. Here’s a screen shot:

IE Ellipsis

Unfortunately text-overflow:ellipsis is no standard and not supported by Firefox, Opera, etc. With some JavaScript hacking however you can have something similar to IE ellipsis on all browsers. It even degrades gracefully if JavaScript is disabled.

Read the rest of this entry »

53725