Do you need a Push Notification Manager? – Redis PubSub to the rescue

Happy New Year! And its indeed an awesome start to a surely prosperous year -- my stunts with Redis PubSub worked ! We have been looking at getting a push notification manager in place to communicate between applications! Here is what we wanted to do: Applications should be able to subscribe for notifications. Notification wildcards … Continue reading Do you need a Push Notification Manager? – Redis PubSub to the rescue

Overriding to_s method for BigDecimal instance

requirement was to display decimal numbers which are having scale values present to be displayed in decimal format otherwise display them as integer. Output expected 12.23 => 12.23 12.00 => 12 While rendering any object on html page by default "to_s" method gets executed.So, i overwrote "to_s" method of BigDecimal class as below. Anyone having … Continue reading Overriding to_s method for BigDecimal instance

Best ways to populate dynamic array of numbers in ruby

Array of years using range((yr=Date.current.year)-9..yr).to_a#=> [2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010]Array of years using lambda Array.new(10){|i| Date.current.year-i}#=> [2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001]Array of monthsDate::MONTHNAMES.compact#=> ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]Array of abbreviated monthsDate::MONTHNAMES.compact.collect{|m| m[0..2]}#=> ["Jan", "Feb", "Mar", "Apr", "May", "Jun", … Continue reading Best ways to populate dynamic array of numbers in ruby