Sneaky Abstractions

Subscribe to my Feed, follow me on , recommend me on Working With Rails or see my code on GitHub

Ready to take my clothes off

Posted on April 04, 2008 09:55, 1 comments. Tagged with naked day, css, web standards.

April 9 is CSS Naked Day. Here’s a simple Rails helper that determines if Time.now is naked day:

def naked_day?(day=9, month=4)
  start = Time.utc(Time.now.year, month, day) - 12.hours
  stop = Time.utc(Time.now.year, month, day) + 36.hours
  now = Time.now.utc

  now > start && now < stop
end

(Naked day lasts for 48 hours, 24 + 1 hour for each timezone)

Put it in application_helper.rb, and you can use it in your layout like this:

<head>
  <% unless naked_day? -%>
    <%= stylesheet_link_tag 'application' %>
  <% end -%>
</head>

Comments

Atom feed

By Re at

Some people get know that that’s more simple to order the legal dissertation or <a href=“http://www.topthesis.com”>thesis writing</a> related to this post, than to make by own efforts.

Leave a comment

OpenID

Or..

Old school

I’m Sheriff John Bunnell, when you hear police sirens it means one of two things; someone is in trouble or someone is causing trouble. In the next hour, we’re gonna show you trouble, up close, the way the police see it every single day. So fasten your seatbelts, we’re gonna take you for a wild ride.