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 RPNCalculator | |
def initialize | |
@rpn = [] | |
end | |
def push(num) | |
@rpn << num | |
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 Book | |
attr_accessor :title | |
def initialize | |
@title = "" | |
end | |
def title=(name) | |
arr = name.split | |
no_caps = ["the", "an", "a", "and", "in"] |
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 Dictionary | |
def initialize | |
@my_hash = {} | |
end | |
def add(word_hash) | |
if word_hash.is_a?Hash | |
@my_hash.merge!(word_hash) | |
else | |
@my_hash[word_hash] = nil |
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 Fixnum | |
def in_words | |
ten = 10 | |
hundred = 100 | |
thousand = 1_000 | |
million = 1_000_000 | |
billion = 1_000_000_000 | |
trillion = 1_000_000_000_000 |
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 translate(word) | |
start_point = vowels_start(word) | |
end_point = word.length - 1 | |
if start_point == 0 | |
word + "ay" | |
else | |
word[start_point, end_point] + word[0, start_point] + "ay" | |
end | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<script type="text/javascript"> | |
var message = { | |
user: "bob", | |
text: "aldfkja" | |
}; |
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
module InWords | |
def in_words | |
num_digits = self.to_s.length | |
num_string = self.to_s | |
under_ten = { 0 => "zero", 1 => "one", 2 => "two", 3 => "three", | |
4 => "four", 5 => "five", 6 => "six", | |
7 => "seven", 8 => "eight", 9 => "nine" } | |
teens = { 10 => "ten", 11 => "eleven", 12 => "twelve", 13 => "thirteen", | |
14 => "fourteen", 15 => "fifteen", 16 => "sixteen", |
NewerOlder