⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def north_korean_cipher(coded_sentence) | |
input = coded_sentence.downcase.split("") # takes the input and splits each letter into its own string. Check out this method in IRB to see how it works! Also refer to the ruby docs. | |
decoded_sentence = [] #blank array | |
cipher = {"e" => "a", # This is technically a shift of four letters...Can you think of a way to automate this? Is a hash | |
"f" => "b", # the best data structure for this problem? What are the pros and cons of hashes? | |
"g" => "c", | |
"h" => "d", | |
"i" => "e", | |
"j" => "f", | |
"k" => "g", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// refactored code | |
// first set of functions received from Jake | |
// sum function worked upon receiving; did not modify | |
var sum = function(array){ | |
var total = 0; | |
for(var index in array) | |
total += array[index]; | |
return total; | |
} | |