Offsetting Ruby Time

Managing local time is such a huge challenge when making webapps. There’s always going to be users from all over the world clocking in on different timezones. Basecamp’s local_time solves this problem in a elegant way – it doesn’t care how you store timezone, it interprets the users local time and prints it out on the view accordingly.

But, all hell breaks loose when you try to recreate this on the server side. Here there’s no information on what user is from what timezone. And even if you persist the users timezone information, surprisingly Rails doesn’t come with an out of the box solution to offseting time(s).

Read All 202 Words →

Scheduling Backup Jobs With Crontab

Backup is an insanely useful gem for, well backups. I use it in production all the time. It can run independent of your Rails app, which in in production can be quite helpful. I’m going to skip ahead and assume your Backup jobs are already set.

Read All 256 Words →

Useful Imagemagick Commands

Imagemagick is one of those tools that’s there on literally every developers computer. It’s such a nifty and powerful tool, there’s so much you can do with it.

Imagemagick is a suite of command line tools that can edit, create and convert various image formats. Here’s a few commands I use regularly.

Read All 452 Words →

Saving water got me some Chaaipani love

I’ve always been ridiculously OCD about saving water. I hate the drip-drip sound of leaky taps, unnecessary usage of sprinklers in the summer, and on and on. So, there’s a little thing we do at Skcript on this cause.

Read All 168 Words →

If-ElseIf-Else-Ception

I HATE when my code looks like a monstrosity of conditions.

If this, do that;
else if this + 5, do this;
else if this - 5, do this*5;
else don't do anything.
Read All 1041 Words →