Posted on October 14, 2010, 1:48 am, by Mayank Jain (makuchaku).
Ever wondered how can you have something like this <% some_helper do %> Some text here <% end %> Well, here how it is… def some_helper(&block) content = capture(&block) concat(“this comes before the block”, block.binding) concat(content, block.binding) # adds “Some text here” to the view concat(“this comes after the block”, block.binding) end Neat! Isn’t it
Posted on August 30, 2010, 10:53 pm, by Mayank Jain (makuchaku).
Now this is going to be fun! Workshop for MAIT students (part 1 of 2)
Posted on March 15, 2010, 12:11 pm, by Mayank Jain (makuchaku).
Fatal – you don’t have any automated test cases Recoverable – you have some sorts of test suite in place Best – you are already using unit/integration tests or have TDD/RSpec in place Without wasting words, I’d put you right to the Cucumber and Webrat goodness… Points worth noting… This was ALL the code I [...]
Posted on February 12, 2010, 9:58 am, by Mayank Jain (makuchaku).
Just bought “Programming Ruby 1.9” from Flipkart. From For Blog When I joined IBM ISS UI team and my tech lead suggested that we should start doing things in Rails- and I was prompt enough to pop up a suggestion – “that why don’t we use Python based web app frameworks Django or Turbo Gears [...]
Posted on August 28, 2009, 1:54 am, by Mayank Jain (makuchaku).
With an Amazon EC2 instance up, next very obvious task was to get the hosting up. Objective was to host static content along with multiple Rails apps on the same EC2 instance. Purists might not agree to this, but getting up and running was the first target. Apache is configured with DocumentRoot as /mnt/app/shared My [...]
Posted on August 7, 2009, 9:56 am, by Mayank Jain (makuchaku).
I’ve been in love with Ruby for long now – and its only obvious that I should get serious about it. Hence, I’ve decided to go through Programming Ruby 1.9 – a chapter a day. Understanding Array.each and blocks #!/usr/bin/env ruby class MyObject attr_accessor :data def initialize @data = [...]
Posted on July 23, 2009, 10:54 am, by Mayank Jain (makuchaku).
Courtesy – yet again, Ruby! #!/usr/bin/env ruby require "rubygems" require "mechanize" module SMS class OneSixtyByTwo attr_accessor :agent, :uid attr_accessor :urls def initialize(username, password) @urls = { :login => "http://m.160by2.com", :sms => "http://m.160by2.com/SaveCompose.asp?l=1" [...]
Posted on June 29, 2009, 11:39 am, by Mayank Jain (makuchaku).
Google Suggest – (as put by Google) use a wide range of information to predict the queries users are most likely to want to see. For example, Google Suggest uses data about the overall popularity of various searches to help rank the refinements it offers. An example of this type of popularity information can be [...]
Posted on September 21, 2008, 5:07 am, by Mayank Jain (makuchaku).
Havn’t you just wished sometimes that all the html, script and style tags would just vanish from the html pages and all you get is pure text (for fun and profit). Well, here’s how I am managing it require “open-uri” require “hpricot” require “sanitize” html = open(“http://www.google.com”) hp = Hpricot(html.read) hp.search(“script”).remove hp.search(“style”).remove sanitize(hp.innerHTML, okTags=”") And [...]
Posted on August 3, 2008, 9:31 pm, by Mayank Jain (makuchaku).
Drawing boards are so much more fun than paper’n pencil