Skip to content

Instantly share code, notes, and snippets.

View jesseract's full-sized avatar

Jessa Pearce jesseract

View GitHub Profile
require 'minitest/autorun'
require 'minitest/pride'
# Write a method which accepts one parameter. The method should return true if
# the string passed to it is a palindrome. It should return false if the string
# is not a palindrome
# WRITE YOUR CODE HERE.
def palindrome?(string)
s = string.downcase.delete('^a-z ')
@jesseract
jesseract / split_puzzle
Created February 25, 2015 02:40
Split test
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.
# WRITE YOUR CODE HERE.
def first_name(name)
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.
# WRITE YOUR CODE HERE. Name your method `names`.
def names( array )
hash = {}
@jesseract
jesseract / 2:23_challenge
Created February 23, 2015 14:16
2/23_challenge
require 'minitest/autorun'
require 'minitest/pride'
# Write a method which accepts an array as the first paramater and a number
# as the second parameter. Return true if two of the numbers in the array sum
# to the second parameter.
# WRITE YOUR CODE HERE. Name your method `complements?`.
def complements?(number, sum)
return false if array == nil || array.length < 2
@jesseract
jesseract / 2:18_challenge
Created February 18, 2015 14:22
2/18_challenge
def complements?(number)
array = []
array.each do |n|
assert n + n =
else
false
end
I *never* finish these things. Are they hard or am I just dumb?
@jesseract
jesseract / survey_goat
Created February 18, 2015 01:07
SQL queries
Second, write SQL statements (in your gist) and model methods (in your model files) to accomplish the following:
1. Find all authors with an email address of "[email protected]"
SELECT name
FROM authors
WHERE email = "[email protected]"
2. Find the author who was created most recently
SELECT name, created_at
@jesseract
jesseract / 2:12_puzzle
Created February 12, 2015 14:21
2:12_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.
# WRITE YOUR CODE HERE. Name your method `names`.
def names(name)
array = [first_name, last_name]
@jesseract
jesseract / jess_puzzle
Created February 11, 2015 14:21
2/11 Ruby Puzzle
def palindrome?(str)
str = str.downcase
str == str.reverse
end
#there's a gets.chomp in here somewhere, I'm sure of it
@jesseract
jesseract / tech_interview
Created February 10, 2015 21:30
Technical interview notes
# Technical interview:
-take your laptop
##Questions the interviewer might ask you:
1. Describe the project you are most proud of
* get technical, describe the tech you used
* if you go more than five minutes, you're not doing it right
* if you have your laptop, offer to show interviewer your app/site/etc (may or may not take you up on it)
* distinguish between exciting tech (stripe) and not (rails gems)
2. Testing
@jesseract
jesseract / 2:10_quiz
Created February 10, 2015 14:22
Ruby Quiz
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.
# WRITE YOUR CODE HERE.
def names