Skip to content

Instantly share code, notes, and snippets.

View bsjohnson's full-sized avatar

Brandon Johnson bsjohnson

  • Indianapolis
View GitHub Profile
@bsjohnson
bsjohnson / birth_date.rb
Created November 9, 2015 13:46
Girl DevelopIt - Birth Date calculations and printing
require "time"
puts "Enter your birthday:"
birthday = gets.chomp
puts "You entered: #{Time.parse(birthday)}\n"
birth_date = Time.parse(birthday) # Parse what we entered and store it in a variable
# Calculate the time difference between now and the birth date. This gives us the difference in SECONDS.
@bsjohnson
bsjohnson / random_address.rb
Last active August 28, 2015 14:46
Find a random address in the general vicinity of the United States
require "geocoder"
require "awesome_print"
NORTH = 49.3457868
WEST = -124.7844079
EAST = -66.9513812
SOUTH = 24.7433195
def random_lat_long
{ :long => rand * (EAST - WEST) + WEST, :lat => rand * (NORTH - SOUTH) + SOUTH }