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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
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
| class WordAnalytics | |
| def initialize(stringed_words) | |
| @stringed_words = stringed_words | |
| end | |
| def separate_words | |
| @words = [] | |
| split_words = [] | |
| split_words = @stringed_words.split(' ') | |
| split_words.each do |word| |
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
| class AnagramGenerator | |
| attr_reader :word | |
| def initialize(word) | |
| @word = word.downcase | |
| end | |
| def separate_word | |
| @separate_words = @word.split('') | |
| end |
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
| class WordTracker | |
| attr_reader :string | |
| def initialize(string) | |
| @string = string | |
| @word_hash = {} | |
| end | |
| def log_lowercase_words | |
| @words_in_string = @string.split.map.each {|word| word.downcase.to_s} | |
| end |
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
| CREATE TABLE recipes ( | |
| id serial, | |
| name varchar(255), | |
| serving_size varchar(200), | |
| total_time varchar(40), | |
| created_at timestamp NOT NULL, | |
| directions text NOT NULL, | |
| ); | |
| CREATE TABLE ingredients ( |
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
| class Circle | |
| attr_reader :radius | |
| def initialize(radius) | |
| if radius <= 0 | |
| raise "The supplied value #{radius} cannot be used. Supply a positive Float or Integer." | |
| return nil | |
| end | |
| @radius = radius.abs | |
| end |
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
| class PigLatinTranslation | |
| def initialize(phrase) | |
| @phrase = phrase | |
| @vowels = ["a", "e", "i", "o", "u"] | |
| @translation_array = [] | |
| end | |
| def translate | |
| words_array = words | |
| index = 0 |
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
| class PigLatinTranslation | |
| def initialize(phrase) | |
| @phrase = phrase | |
| @vowels = ["a", "e", "i", "o", "u"] | |
| @translation_array = [] | |
| end | |
| def translate | |
| words_array = words | |
| index = 0 |
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
| class Animal | |
| attr_reader :name | |
| def initialize(name) | |
| @name = name | |
| end | |
| def eat | |
| ["Stuff in nature"] | |
| end |
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
| class Car | |
| @@makes = [] | |
| def self.add_make(make, *models) | |
| @@makes << {make => models} | |
| end | |
| def self.valid_makes(make, model) | |
| index = 0 | |
| match = false |
NewerOlder