Saturday, 14 May 2016

Youtube shortcuts

Replace "youtube" with "listentoyoutube" in the URL to download the audio of the video.

Replace "youtube" with "ssyoutube" in the URL to download the video in any quality available.

Replace "youtube" with "listenonrepeat" in the URL to repeat the video automatically .


 To skip the You tube's "Signin to confirm your age" message like on video
Just Change the url from 
http://www.youtube.com/watch?v=Ci6lMQNLKZU
to
http://www.youtube.com/v/Ci6lMQNLKZU

No reason to having to sign in to watch every 3rd video on Youtube.



Pressing keys 1 through 9 will seek the video to 10%, 20% and so on up to 90% of the playback duration.

If the video is of 10 minutes, pressing 2 will seek the video to 2 minutes. i.e., 20% of the total playback duration!! 

Edit : Pressing 'K' will pause the video, and 'J' will seek the video to 10 seconds before, and 'L' seeks 10 seconds further!!

Thursday, 5 May 2016

Ruby

Ruby has four types of variable scope, 

Name Begins WithVariable Scope
$A global variable
@An instance variable
[a-z] or _A local variable
[A-Z]A constant
@@A class variable


Detecting the Scope of a Ruby Variable

x = 10
=> 10
defined? x
=> "local-variable"

$x = 10
=> 10
defined? $x
=> "global-variable"

Ruby Class Variables


A class variable is a variable that is shared amongst all instances of a class.

Class variables must be initialized at creation time.

@@total = 0

Another way of thinking of thinking of class variables is as global variables within the context of a single class.

Ruby Instance Variables


Instance variables are similar to Class variables except that their values are local to specific instances of an object.















----------------------------------------------------------------------------------------------------------------