Wednesday, July 30, 2014

Points and Animation


A simple code pen for travel between points and animation. Works for Firefox atleast!

See the Pen iebuc by Dinesh Vasudevan (@dinks) on CodePen.

Monday, May 26, 2014

seconds_until_end_of_day expires for Cache in Rails

A colleague of mine had to cache some html until the end of the day but found it difficult because cache expects expires_in which is relative. We cant pass an absolute Time.now :P

So we now have seconds_until_end_of_day in 4.0.2, but we use Rails 3 :(

But patching Time is simple

def seconds_until_end_of_day
  end_of_day.to_i - to_i
end

http://apidock.com/rails/v4.0.2/Time/seconds_until_end_of_day

Tuesday, April 29, 2014

Observers and Migratios

The past day we created a model migration and then added an observer for the model after the migration. Surprisingly, the observer (now added in the application.rb file) was loaded first by environment which then checks for the model and tries to fire a DB query for columns.

This fails and therefore the migration does not go through.

So for future reference, always migrate first and then add the observer! 

Friday, March 28, 2014

Chuck Norris Hubot

I stumbedupon an API which spits out random Chuck Norris Jokes and I ended up writing a smal hubot for this :)


Try it out Chuck Norris Hubot