Feb 27, 2012

Apache HTTP to HTTPS Redirect


Here's a micro-nugget. The following Apache config redirects incoming HTTP traffic to the equivalent HTTPS page. Nothing special but I don't spend enough time working on Apache configurations to keep this stuff fresh in my mind so I find it useful to record what I learn in case I need to do it again later.

<virtualhost *:80>
  RedirectMatch permanent /(.*)$ https://example.com/$1
</virtualhost>

<virtualhost *:443>
  ServerName example.com
  # config...
</virtualhost>

Feb 20, 2012

Extending Date Parsing In Ruby 1.9.3


I had previously made posts about parsing user supplied dates in Ruby



Apparently in Ruby 1.9.3 the Date library was re-implemented in C for performance and of course that broke my extension.  I updated it to support Ruby 1.9.3 below




This may not work on Ruby versions prior to 1.9.3 I didn't try it.

I also found the american_date gem which apparently existed before I had originally written my extension and is almost certainly a better choice if you don't need any custom formats.

Feb 6, 2012

Generic ".rvmrc" File For Ruby Projects


I'm really lazy and have started using the exact same ".rvmrc" file for all my Ruby projects....

rvm use @$(basename `pwd`) --create

I'm not sure but I think I first seen this exact format while reading this code https://github.com/dkubb/veritas