Skip to content

Instantly share code, notes, and snippets.

View aellispierce's full-sized avatar

Ashley Ellis Pierce aellispierce

View GitHub Profile
@aellispierce
aellispierce / battleship.md
Last active August 29, 2015 14:13
Battleship Instructions

Battleship

Variables

  • carrier_hits=0

  • battleship_hits=0

  • cruiser_hits=0

<span id="checkout">Checkout</span>
@aellispierce
aellispierce / fizzbuzz.rb
Created February 9, 2015 14:20
Ruby Fizzbuzz quiz
require 'minitest/autorun'
require 'minitest/pride'
# Write a method which returns:
#
# * "Fizz" if the number is divisible by 3
# * "Buzz" if the number is divisible by 5
# * "FizzBuzz" if the number is divisible by 3 and 5
# * Otherwise, return the number itself
#
require 'minitest/autorun'
require 'minitest/pride'
# Write two methods:
#
# * `first_name`: given a name in string, return the first name.
# * `last_name`: given a name in string, return the last name.
def first_name(name)
if name== nil
@aellispierce
aellispierce / gist:5f9badce12902cb57a68
Last active August 29, 2015 14:15
Palindrome Puzzle
def palindrome?(word)
if word.downcase == word.downcase.reverse
result = true
else
result = false
end
result
end
class StringPalindromePuzzle < MiniTest::Test
@aellispierce
aellispierce / gist:06160720d0e894c6245c
Last active August 29, 2015 14:15
Array/Hash Puzzle
require 'minitest/autorun'
require 'minitest/pride'
# Write a method which accepts an array and returns a hash. Each item in the
# array will be a string, and the returned hash should have last names as keys
# and first names as values.
def names(array)
if array = Array.new || nil
Hash.new
require 'minitest/autorun'
require 'minitest/pride'
# Write a method which returns a hash.
def get_hash
{"Pizza"=>"Unhealthy", "French Fries" => "Okay", "Broccoli" => "Healthy", "Chocolate" => "Healthy"}
end
Find all authors with an email address of "shakespeare@example.com"
SELECT *
FROM authors
WHERE email= "shakespeare@example.com";
Find the author who was created most recently
SELECT *
@aellispierce
aellispierce / gist:0dcec7392c8a3ea6cb1a
Created February 17, 2015 14:15
Enumerable Challenge
require 'minitest/autorun'
require 'minitest/pride'
# Write a series of methods which use the .any, .all, .map, .select, .reject, and
# .reduce methods in Enumerable. Each of your methods should be one line.
# WRITE YOUR CODE HERE. In this challenge, names longer than 5 characters are
# considered long.
def has_even?(array)