Skip to content

Instantly share code, notes, and snippets.

@hchood
hchood / cash_ii_refactor_finished.rb
Last active August 29, 2015 14:05
Cash II refactoring clinic -- with methods
##############################
# METHODS
##############################
# prompts user to enter a sale price and gets the sale price
def get_sale_price
puts "What is the sale price?"
gets.chomp
end
@hchood
hchood / cash_ii_refactoring_clinic.rb
Created August 18, 2014 18:59
Starting point for Cash II refactoring clinic
##############################
# METHODS
##############################
# Insert methods here
@hchood
hchood / recipes.md
Created May 30, 2014 14:21
Example solution to SQL challenge, Part II

SQL Challenge: Create Recipes Database

1. Create tables

CREATE TABLE recipes (
id serial PRIMARY KEY,
name varchar(255) NOT NULL,
servings integer,
@hchood
hchood / billboard.csv
Created May 21, 2014 14:25
billboard.csv
artist album song position
John Legend All Of Me All Of Me 1
Pharrell Happy Happy 2
Iggy Azalea Fancy 3
Ariana Grande Problem 4
Katy Perry Prism Dark Horse 5
@hchood
hchood / basic_array_and_hash_drills.rb
Last active August 29, 2015 14:01
array and hash drills
############################
# Array & hash drills
############################
first_names = ["Richard", "Adam", "Sam", "Helen", "Eric"]
# Print each name in the array
# Downcase each name in the array
# Print the third name in the array
full_names = [
@hchood
hchood / return_value_drills2.rb
Last active August 29, 2015 14:01
return_value_drills2
# RUBY FUNDAMENTALS III: NON-CORE RETURN VALUE DRILLS
# ----------------------------
def is_a_fixnum?(some_input)
some_input.class == Fixnum
end
is_a_fixnum?(10)
is_a_fixnum?("10")
@hchood
hchood / git_workflow.md
Last active August 29, 2015 14:01
git workflow

Git workflow for Ruby Challenges

For the first several challenges, you'll do all your work in a local git repo and submit a Gist to your solution in Apollo. Here's a breakdown of the workflow:

  1. Create a directory for the challenge and cd into it.
  2. Run git init to create your local git repo.
  3. Write your code, periodically running git add and git commit to save your progress.
  4. When finished, create a gist and supply a link to the gist in the Apollo assignment.

To create a gist, navigate to gist.github.com, where you should see a form to create a gist. Copy and paste the code for your solution into the in-browser editor. Give your gist a name ending in .rb (which will provide the appropriate syntax highlighting), and an optional description. Click 'Create Public Gist' and supply a link to that gist in Apollo.

# Acceptance Criteria:
# Wins and losses are tallied up for each team
# The team with the highest quantity of wins is shown first and is sorted accordingly
# If two teams have the same number of wins, check to see if one team has beaten the other. If they have, they should be listed first.
# *** League Standings ***
# 1 Good Will Bunting: 2W, 0L
# 2 Sick Kicks: 1W, 1L
# 3 Angels in the Outfield: 0W, 2L
@hchood
hchood / upcoming.rb
Created March 3, 2014 21:37
Upcoming movies
{
total: 20,
movies: [
{
id: "771311994",
title: "Need For Speed",
year: 2014,
mpaa_rating: "PG-13",
runtime: 130,
release_dates: {
@hchood
hchood / return_value_drills.rb
Last active August 29, 2015 13:56
return_value_drills
# RUBY FUNDAMENTALS III: NON-CORE RETURN VALUE DRILLS
# ----------------------------
def is_a_number?(some_string)
if some_string =~ /\A\d*[.]{0,1}\d*\z/
true
else
false
end