This file contains 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 Dictionary | |
attr_accessor :entries | |
attr_accessor :keywords | |
def initialize | |
@entries = Hash.new | |
end | |
def add(entry) | |
if entry.is_a? Hash |
This file contains 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
#The main method, it takes a string that is an English word and returns that word in Pig Latin. | |
#All words have "ay" appended to them in the line just before the return statement. If the word | |
#begins with a vowel, it is sent to the << "ay" line unmodified. | |
#If it is exactly three letters long, the second two characters of english_word are made the first | |
#two of pig_latin_word, then the first letter of english_word is made the third character of | |
#pig_latin_word. Then the word is ready to get the << "ay" treatment. | |
def translate(english_word) | |
if is_vowel?(english_word[0]) | |
pig_latin_word = english_word |
This file contains 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
#The main method, it takes a string that is an English word and returns that word in Pig Latin. | |
#All words have "ay" appended to them in the line just before the return statement. If the word | |
#begins with a vowel, it is sent to the << "ay" line unmodified. | |
#If it is exactly three letters long, the second two characters of english_word are made the first | |
#two of pig_latin_word, then the first letter of english_word is made the third character of | |
#pig_latin_word. Then the word is ready to get the << "ay" treatment. | |
def translate(english_word) | |
if is_vowel?(english_word[0]) | |
pig_latin_word = english_word |
This file contains 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
module InWords | |
#The method for turning integers 1-19 into the appropriate strings. | |
def under20 | |
array_small_numbers = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"] | |
return array_small_numbers[self] | |
end | |
#The method for turning integers 20-99 into the appropriate strings. | |
def under100 |
This file contains 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 Book | |
attr_accessor :title | |
def initialize | |
@title = "" | |
end | |
def title=(new_title) | |
fixed_title = "" | |
title_array = new_title.split | |
title_array.each do |word| |
This file contains 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
module InWords | |
#The method for turning integers 1-19 into the appropriate strings. | |
def under20 | |
array_under20 = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"] | |
return array_under20[self] | |
end | |
#The method for turning integers 20-99 into the appropriate strings. | |
def under100 |
This file contains 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 print_grid(x = 5, y =5) | |
row_0 = "00000" | |
row_1 = "00000" | |
row_2 = "00000" | |
row_3 = "00000" | |
row_4 = "00000" | |
if y == 0 | |
row_0[x] = "X" |
This file contains 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 Shape | |
def get_color | |
return color | |
end | |
def set_color(color) | |
@color = color | |
end | |
def can_fit?(shape) |
This file contains 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
#!/usr/bin/env ruby | |
require 'open-uri' | |
require 'json' | |
raw = open('http://api.wunderground.com/api/59431618fd2e7dae/geolookup/conditions/q/CA/Yuba_City.json').read | |
processed = JSON.parse(raw) | |
yuba_city = processed['current_observation'] | |
puts "Yuba City is " + yuba_city['feelslike_string'] |
This file contains 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
info: Welcome to Nodejitsu coleman | |
info: jitsu v0.12.8, node v0.8.21 | |
info: It worked if it ends with Nodejitsu ok | |
info: Executing command deploy | |
info: Analyzing application dependencies in node server.js | |
warn: Local package version appears to be old | |
warn: The package.json version will be incremented automatically | |
warn: About to write /Users/colemanfoley/code/playlist-me/public/playlist-me-helper/package.json | |
data: | |
data: { |
OlderNewer