Author Archives: piyush

Enhance your Rail’s application performance using home_run

Working with Dates doesn’t always yield lightning fast results. Recently when working on one of my assignments, I came across this superb piece of work called as `home_run`. We deal with Dates every now and then. Ruby Date class is … Continue reading

Posted in My Voice | Leave a comment

RSS parser Ruby

require ‘rss/2.0′ require ‘open-uri’ open(“http://feeds.bbci.co.uk/news/rss.xml?edition=int”) do |response| ping_successful = response.status[0] == “200″ ? true : false if ping_successful content = response.read rss = RSS::Parser.parse(content, false) rss.items.each do |item| puts item.link puts item.title puts item.description puts item.date puts item.author puts item.category … Continue reading

Posted in Technology | Tagged , , | Leave a comment

Sending emails using Gmail and Ruby

require ‘net/smtp’ message = <<MESSAGE_END From: sender@gmail.com To: recipient@gmail.com Subject: Sending emails using Gmail and Ruby Wow ! This is easy ! MESSAGE_END smtp = Net::SMTP.new 'smtp.gmail.com', 587 smtp.enable_starttls_auto smtp.start('gmail.com','sender@gmail.com', PASSWORD, :plain) do |smtp| smtp.send_message(message,'sender@gmail.com','recipient@gmail.com') end

Posted in Rails Training Course, Ruby on Rails Training | Leave a comment

Select multiple option without CTRL Click (or Cmd-Click on Mac)

$(document).ready(function(){ customizeMultiSelect(); }); function customizeMultiSelect(){ $(‘.customize_multiselect option’).click(function(){ var select = $(this).parents(“select:first”); var option = $(this); var option_selected = $.inArray(option.val(), select.val()); // return true if clicked option is selected else false var option_values = new Array(); // use map to avoid … Continue reading

Posted in Technology | Tagged , , | Leave a comment

GIT – How to check in which branches a specific commit is present?

Here’s a quick way of doing it :- 1. Take example of this GIT repository - https://github.com/resolve/refinerycms 2. It has 5 different branches 3. If you need to check if Move mime-types requirement to the gemspec and controller instead of Gem… https://github.com/resolve/refinerycms/commit/738c6a0b189c4fa1d540fceb00de2f1f195bc507 is present … Continue reading

Posted in Technology | Leave a comment