Monthly Archives: November 2009

Today: Fun with Unicode, Regex and Java.

03-Nov-09

Some would say, i have 3 problems 😉 private final static Pattern placeholder = Pattern.compile("#\\{(\\w+?)\\}");private final static Pattern placeholder = Pattern.compile("#\\{(\\w+?)\\}"); won’t match “Mot#{ö}rhead” for example. To replace the word character \w you either need the list of possible unicodeblocks like [\p{InLatin}|\p{InEtc}] (you get the codes for the blocks through “Character.UnicodeBlock.forName” or you’re lazy like […]

Read the complete article »

How to change the image assets path in Rails

01-Nov-09

I found no other way to change the path of “images” in a Rails application than monkey patching the AssetTagHelper like so: module ActionView module Helpers #:nodoc: module AssetTagHelper def image_path(source) compute_public_path(source, ‘static_images’) end alias_method :path_to_image, :image_path # aliased to avoid conflicts with an image_path named route end end endmodule ActionView module Helpers #:nodoc: module […]

Read the complete article »