Learnings for Week 30 2010

Well, I’ve been slacking again, here’s the learnings from a couple weeks ago.

  • IE must “haveLayout for opacity”:http://joseph.randomnetworks.com/archives/2006/08/16/css-opacity-in-internet-explorer-ie/ (alpha filter) to work. You can use the IE zoom rule to give an element layout if needed:
zoom: 1;
  • To add custom Date/Time formats in Rails:
Time::DATE_FORMATS.merge!(:article => "%A, %B %d, %Y")
Date::DATE_FORMATS.merge!(:article => "%A, %B %d, %Y")

Don’t forget to add your custom formats to Date as well, they use a different hash. This can then be used like so:

Date.today.to_s(:article)
  • When using Paypal buttons you can change the Currency that is used by “adding a hidden field”:https://www.paypal.com/us/cgi-bin/webscr?cmd=p/sell/mc/mc_wa-outside:
<input type="hidden" name="currency_code" value="CAD">
  • The Rails Request object has a number of useful methods for “finding the url that was used for the request”:http://programming-tut.blogspot.com/2010/06/ruby-on-rails-request-url.html:
request.host_with_port => example.com:3000
request.path           => /controller/action
request.url            => http://example.com:3000/controller/action
Posted August 17, 2010

Comments

comments powered by Disqus