Skip to content

Instantly share code, notes, and snippets.

View bendoane's full-sized avatar

Ben Doane bendoane

  • Spring Health
  • Columbus, Ohio
View GitHub Profile
@bendoane
bendoane / SQLite work
Created November 2, 2015 20:50
week 5 day 1 - SQLite work
sqlite3 classroom.sqlite3
CREATE TABLE students (id INTEGER, first_name TEXT, last_name TEXT)
INSERT INTO students (id, first_name, last_name) VALUES (1,"Ben","Doane"),(2,"Ben","Barnett"),(3,"Matt","Fair"),(4,"Angie","Martaus"),(5,"Lauren","Imhoff"),(6,"Shirley","Grigsby"),(7,"Anna","Lioubimova"),(8,"Michelle","Caudle");
sqlite> SELECT * FROM students;
1|Ben||Doane
2|Ben||Barnett
3|Matt||Fair
@bendoane
bendoane / blackjack.rb
Last active October 19, 2015 15:58
Homework: Weekend 2
require_relative "blackjack_cards"
require_relative "blackjack_deck"
class Blackjack
attr_accessor :player_hand, :computer_hand, :p_score, :c_score, :bjdeck, :shoe
def initialize
puts "Welcome to Blackjack, sir. Please press [Enter] to deal."
STDIN.gets
@bendoane
bendoane / cards.rb
Created October 16, 2015 18:02
Homework: day 8
class Cards
attr_accessor :suit, :face, :value
def initialize(face, suit)
self.face = face
self.suit = suit
if face == "Ace"
self.value = 14
elsif face == "King"
@bendoane
bendoane / dice. rb
Created October 14, 2015 04:31
Homework: day 7
class Dice
attr_accessor :sides
def initialize
self.sides = (1..6).to_a
end
def roll
sides.sample
@bendoane
bendoane / Rochambeau
Created October 12, 2015 21:01
Homework: day 6
class Game
attr_accessor :player_one_choice, :computer, :computer2,
def initialize
puts "Let's play Rock, Paper, Scissors!"
end
def reset(computer_wins=0,user_wins=0)
vs_user(computer_wins,user_wins)
@bendoane
bendoane / Homework_day4.rb
Created October 12, 2015 04:21
Planet Express Reporting
#Homework - Day 4
#NORMAL MODE
#Good news Rubyists!
#We have a week of records tracking what we shipped at Planet Express.
#I need you to answer a few questions for Hermes.
#How much money did we make this week?
require 'csv'
week_total = []
@bendoane
bendoane / homework_day3.rb
Created October 7, 2015 20:19
Day 3: Like a Robot
# Homework - Day 3
# NORMAL MODE-----------------------------------------------
# Define a robot class. A robot should have a name
class Robot
attr_accessor :name
attr_accessor :height
#creat a robot instance method for saying "hi"
def say_hi
puts "Greetings"
@bendoane
bendoane / homework_day2
Created October 7, 2015 11:08
Homework: Array Play
[1] pry(main)> our_class=["Ben","Anna","Shirley","Lauren","Ben","Michelle","Angie","Matt"]
=> ["Ben", "Anna", "Shirley", "Lauren", "Ben", "Michelle", "Angie", "Matt"]
[6] pry(main)> our_class.each do |name|
[6] pry(main)* if name.length<5
[6] pry(main)* less_than5 << name
[6] pry(main)* end
[6] pry(main)* end
=> ["Ben", "Anna", "Shirley", "Lauren", "Ben", "Michelle", "Angie", "Matt"]
[7] pry(main)> less_than5
@bendoane
bendoane / lipsum_generator.rb
Created October 6, 2015 03:49
Week One, Day One: Generate some lipsum
lipsum_wanted = ARGV[0].dup if ARGV[0]
paragraphs_wanted = ARGV[1].dup if ARGV[1]
if lipsum_wanted
lipsum_wanted.downcase!
end
paragraphs_wanted= paragraphs_wanted.to_i
if paragraphs_wanted<1