Skip to content

Instantly share code, notes, and snippets.

@TylerRockwell
TylerRockwell / Time Entry SQL Practice
Created September 16, 2015 11:55
Time Entry SQL Practice
Find all time entries.
SELECT *
FROM time_entries;
# Results Returned: 500
Find the developer who joined the company most recently.
SELECT *
FROM developers
ORDER BY joined_on DESC
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
#
@TylerRockwell
TylerRockwell / gist:39d8f5d68a7f2a2a51e0
Last active August 31, 2015 22:38
Week 1 Exercise 1 - User Input Statistics
#WARNING! This code is functional but has some redundancy
#LEVEL: NIGHTMARE
def is_a_number(input)
true if Float(input) rescue false
end
def get_input()
puts "Please give me your input:"
gets.chomp
@TylerRockwell
TylerRockwell / scale_app
Last active August 29, 2015 14:25
Scale App
#Compares weight of 2 items
def weigh(item1, item2)
$totalWeighings += 1
if item1 > item2
return 0
elsif item2 > item1
return 1
else
return 2
end