CSS Browser Selector

Simple trick to help you on CSS hacks! Official Page: http://rafael.adm.br/css_browser_selector/ EXAMPLE With this script you can set a different background color of one div for each browser. Internet Explorer - yellow Firefox - gray Opera - green Konqueror - blue Safari - black Source of this example: </pre> DOWNLOAD css_browser_selector.js.txt (> 1K...

Continuar Lendo

Better gsub method for Prototype library.

Today I needed to use the method gsub implemented by the Prototype, the javascript library used by Rails. I perceived that it was a little different of ruby’s one. The ruby method return a array if called without replacement string, but prototype’s doesn’t. So, I wrote my own gsub method to be used with prototype that return an array when called without replacement string....

Continuar Lendo

Zidane

Impressionante como o cara conseguiu em um minuto arruinar uma carreira. Abaixo uma diversão para o pessoal: http://www.corriere.it/Primo_Piano/Sport/2006/07_Luglio/10/pop_zidane.shtml Não desista e veja o que acontece!

Continuar Lendo

Simple tooltip helper for Ruby on Rails

A simple tooltip helper with span tag and title attrbute for Ruby on Rails framework. app/helpers/application_helper.rb def tooltip(content, options = {}, html_options = {}, *parameters_for_method_reference) html_options[:title] = options[:tooltip] html_options[:class] = html_options[:class] || 'tooltip' content_tag("span", content, html_options) end app/views/foo/bar.rhtml...

Continuar Lendo

Globalize time_ago_in_words method of Rails

To localize the distance_of_time_in_words and time_ago_in_words methods of Ruby on Rails with Globalize Plugin, put these lines on your app/helpers/application_helper.rb [ruby] def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false) from_time = from_time.to_time if from_time.respond_to?(:to_time) to_time = to_time.to_time if to_time.respond_to...

Continuar Lendo