Skip to content

Instantly share code, notes, and snippets.

View jmscholen's full-sized avatar

Jeff Scholen jmscholen

  • IOU Financial
  • Johns Creek
View GitHub Profile
@jmscholen
jmscholen / blackjackgame.rb
Last active August 29, 2015 13:57
BlackJack Game
#BlackJack Game created by Jeff Scholen. Iron Yard Rails Engineering Class 3/31/2014
puts "Would you like to play blackjack? Yes or No"
playtime = gets.chomp
exit if playtime.downcase == "no"
my_cards = []
my_cards.push(base_card = rand(10))
puts "Your first card is #{base_card}."
@jmscholen
jmscholen / guessinggame.rb
Last active August 29, 2015 13:57
Guessing Game HW
#Guessing Game for user to guess the items in the array by Jeff Scholen with user feedback. Iron Yard Rails Engineering 3/31/2014
@n = 0
@atv_values = ["Be Nice.", "Dream Big.", "Pay It Forward.", "Work Hard. Play Hard."]
@atv_guess = ["Be ----.", "----- Big.", "Pay It -------.", "Work-------Play Hard."]
@atv_hints = ["---- guys finish last.", "I have a -----.", "Kevin Spacey, Haley Joel Osment Movie",
"A serious and fun work culture motto." ]
@atv_missing_values = ["nice", "dream", "forward", "hard"]
def match_answer(user_input)
case user_input
@jmscholen
jmscholen / personalityquiz.rb
Last active August 29, 2015 13:57
Personality Quiz HW
#personality quiz by jeff scholen. Iron Yard Rails Engineering Class 4/1/2014
#refactored 4/2/2014
multi_user = {}
calm_questions = {question1: "I like living on the Beach.", question2: "I like living in a mountain cabin.", question3: "I prefer a walk on the beach versus going to a bar.", question4: "I like to be alone with my thoughts.", quesiton5: "I prefer working in an office rather than a coffee shop."}
party_questions = {question1: "I like living in the city.", question2: "When staying at a hotel, I prefer staying on the very high floors.", question3: "I like hanging out at a party with lots of people.", question4: "I like owning a high performance car.", question5: "I like working for start-ups rather than a large stable company.", }
5.times{puts " "}
def check_integer_value(value_to_check)
print "#{value_to_check} -- How would you score yourself?"
@jmscholen
jmscholen / horseracing.rb
Last active August 29, 2015 13:58
Horse Racing Game
# Horse Racing Application by Jeff Scholen. Iron Yard Rails Engineering Class 4/3/14
################################HORSE CLASS##################################
class Horse
def initialize
@whisper = 0
@whip = 0
@kick = 0
@jmscholen
jmscholen / gist:10267631
Created April 9, 2014 13:02
Testing HW - cell game
require 'rspec'
################creating the world class####################
class World
attr_reader :cells, :cells_with_neighbors, :living_neighbors, :dead_neighbors
def initialize
#@cells = Array.new(10, Array.new(10, Cell.new)) optional method for creating multidimentional array
@cells = Array.new(10) { Array.new(10) {Cell.new}}
end
@jmscholen
jmscholen / gist:10267795
Created April 9, 2014 13:03
Racing Horse Testing HW
#not started
me
@jmscholen
jmscholen / gist:e492589fe3f8c627e5bb
Last active August 29, 2015 14:04
CodeKata 1: SuperMarket Pricing
Some things in supermarkets have simple prices: this can of beans costs $0.65. Other things have more complex prices. For example:
three for a dollar (so what’s the price if I buy 4, or 5?)
$1.99/pound (so what does 4 ounces cost?)
buy two, get one free (so does the third item have a price?)
The exercise is to experiment with various models for representing money and prices that are flexible enough to deal with these (and other) pricing schemes, and at the same time are generally usable (at the checkout, for stock management, order entry, and so on). Spend time considering issues such as:
does fractional money exist?
when (if ever) does rounding take place?
@jmscholen
jmscholen / Project Euler Problem 1
Created July 18, 2014 18:34
Project Euler Problem 1
CODE
******************************
------------------------------
def value_returned(number)
if is_divisible_by?(number)
return number
else
return 0
end
SomeList.find(:all, :conditions => ["some_id = ?", some_object.attribute_of_some_object.id])
SomeList.where(some_id: some_object.attribute_of_some_object.id)