Wednesday, December 7, 2011

Search and Replace in Multiple Files Using Single Command

Tuesday, December 6, 2011

Custom timeout for Net::HTTP Requests in Ruby


http = Net::HTTP.new(host, port)
http.read_timeout = "timeout in milliseconds"


Saturday, December 3, 2011

Open current directory in terminal from nautilus

install nautilus-open-terminal.
1 . sudo apt-get install nautilus-open-terminal.

2 . logout and login or give "nautilus -q" in terminal.


Now in your right-click menu you can open a terminal, and it will be in what ever directory you are currently in in Nautilus

Wednesday, November 30, 2011

Partial deploy using capistrano

Real projects are big and often have several megabytes of code. Sometimes, you need to quickly apply a ‘hotfix’ for a critical bug. Usually, a fix like that is small enough (containing only several lines of code) and affects only a part of the application. If so. it’s not necessary to restart the whole application – you need to restart only part of the running processes. In the end, you don’t need to go through the entire deployment process.


check this out  http://blog.railsware.com/2011/10/25/delivery-via-patch/



Thursday, September 15, 2011

Ctrl+C to exit from exception ruby


rescue SystemExit, Interrupt
  raise
rescue Exception => e
 
#...
end

you can use SystemExit, Interrupt classes to exit from script with Ctrl+C

Thursday, August 18, 2011

IndexError: string not matched ruby hash


irb(main):001:0> s = "string"

=> "string"

irb(main):006:0> s[ 'hi' ] = 'foo'

IndexError: string not matched

from (irb):6:in
Here you already declared 's' as string then you can't use it as hash.