Skip to main content

Featured

Ruby Tips - How to figure out where a method is defined

The other day when I was dabbling with the huge codebase, I was wondering where a particular method was being declared for a specific method. I wanted to know this because my greps didn't turn out to volatile and didn't return any results



The Solution The Ruby interpreter has certain methods that can be used for identifying under which module or class, the particular method is being defined. See the example below.

So using the .source_location you will be able to figure which file it has been declared.

ssh-copy-id using a different/custom port


Have you ever created your own cloud server and changed your ssh port from the default 22 to something else? And have you ever tried to use ssh-copy-id to copy your local ssh public key to the remote and it doesn't work?

The answer is simple. There are no parameters that you can provide for ssh-copy-id command. Instead do the following:

ssh-copy-id -i id_rsa.pub "user@domain.com -p 12345"
That's it. It should work without a problem. 

Comments

Popular Posts

You will receive wonderful short stories written by him and inspirational articles once every month.