Ruby Case statement (aka Switch statement)

11/20/15  Public, Ruby General

Standard Case

print "Enter your grade: "
grade = gets.chomp
case grade
when "A"
  puts 'Well done!'
when "B"
  puts 'Try harder!'
when "C"
  puts 'You need help!!!'
  puts "You just making it up!"


1 vote - harrylevine

Sharing your GitHub SSH public key

10/16/15  Public, Git

Check if you have an SSH key by calling $ ls -al ~/.ssh. If you have these in there:


Then continue on. If not, follow the steps in the link at the bottom of the page.

1 - In your terminal, go to the root ...

1 vote - harrylevine

How to show & hide hidden dot (.) files in the Mac Finder window

10/15/15  Public, Command Line

1 - In Terminal, enter $ defaults write AppleShowAllFiles YES
2 - Press return
3 - Hold the ‘Option/alt’ key, then right click on the Finder icon in the dock and click Relaunch.

To hide them, repeat the above steps, expect ...

1 vote - harrylevine

Change remote Git URL after forking a repository

10/13/15  Public, Git

After you have forked and cloned the repository:

$ cd into-the-repository
$ git remote set-url origin

So for example, if your GitHub username is hpjaj, and the repo is holo-alfa, h...

1 vote - harrylevine

How the ruby Tap method works

10/09/15  Public, Ruby General

First, let's define a couple of terms: caller and mutated.

The caller is what tap is being called on. In the below, the caller is arr:

arr = [2, 3, 1]
arr.tap do |x|

Mutated permanently change...

1 vote - harrylevine

Sublime text shortcut for moving whole line up or down

10/03/15  Public, Shortcuts

On a mac:

command + control + up-arrow

command + control + down-arrow

1 vote - harrylevine

Add all Google Fonts to Sketch 3

10/03/15  Public, Online Resources


All you have to do is paste the code below into Terminal:

curl | sh

If yo...

1 vote - harrylevine

In a controller spec, calling a PUT or POST action

09/18/15  Public, Testing / TDD

From users_controller_spec.rb:

put :update, :id =>, :user => { :active => false }

1 vote - harrylevine