Skip to content

Instantly share code, notes, and snippets.

View jackieiscool's full-sized avatar

Jacqueline Herrlin jackieiscool

View GitHub Profile
@jackieiscool
jackieiscool / AHHHH!!!!!!!!
Created June 15, 2012 01:38
RECURSION!!!!!!!!!!!!!!!!!!!!
module InWords
def magic
ones_array = %w{ not_called one two three four five six seven eight nine ten}
tens_array = %w{ not_called not_called twenty thirty forty fifty sixty seventy eighty ninety}
teens_array = [ "" ] + %w{ one two three four five six seven eight nine ten eleven twelve
thirteen fourteen fifteen sixteen seventeen eighteen nineteen}
# if self == 0
# return "zero"
# end
@jackieiscool
jackieiscool / Dictionary
Created June 16, 2012 01:05
Creating a dictionary class
class Dictionary
attr_reader :entries
def initialize()
@entries = {}
end
def add(words)
if words.class == String
@entries.merge!({words => nil})
else
@jackieiscool
jackieiscool / gist:2946534
Created June 18, 2012 02:40
Re-implement Array#count -- HELP
class Array
def new_count
final = 0
(1..self.length-1)each do |i|
final += 1 if yield(self[i])
end
return final
end
end
@jackieiscool
jackieiscool / Book Class
Created June 18, 2012 19:46
Book Class
class Book
attr_reader :title
def title=(title)
@title = title.split
@title.each do |word|
a = ["the", "in", "a", "an", "and"]
if a.include?(word.downcase)
word.downcase!
else
class Hero
def initialize(level)
@level = level
@health = @level * 100
end
def life
@health
end
@jackieiscool
jackieiscool / Twitter Recursion
Created June 19, 2012 03:09
Twitter Recursion
require 'jumpstart_auth'
class JSTwitter
attr_reader :client
def initialize
puts "Initializing"
@client = JumpstartAuth.twitter
end
@jackieiscool
jackieiscool / gist:2958223
Created June 20, 2012 05:06
TWITTER RECURSION CONT...
require 'jumpstart_auth'
class JSTwitter
attr_reader :client
def initialize
puts "Initializing"
@client = JumpstartAuth.twitter
end
@jackieiscool
jackieiscool / GAH!
Created June 26, 2012 01:44
Sudoku...started
class Sudoku
def initialize(puzzle) # puzzle == String
@puzzle = puzzle
@cell = Cell.new(puzzle)
@rows = Row.new(puzzle)
@column = Column.new(puzzle)
@three_by_three = ThreeByThree.new(puzzle)
end
end
@jackieiscool
jackieiscool / TWITTER SOME MORE
Created June 26, 2012 01:47
TWITTER SOME MORE
require 'jumpstart_auth'
class JSTwitter
attr_reader :client
def initialize
puts "Initializing"
@client = JumpstartAuth.twitter
end
class EightBall
def response
response_array = ["Signs point to yes",
"Signs point to no",
"AHAHAHAHA!",
"Outlook is positive",
"No way Jose!"]
response_num = rand(response_array.length)
puts response_output = response_array[response_num]