Skip to content

Instantly share code, notes, and snippets.

require 'pry'
def game_of_threes number, num_arr=[], extra_arr=[]
if number == 1
puts "1!"
return 1
else
if number % 3 == 0
puts "#{number} 0"
require 'pry'
def harvest(people, plants, weeks=1)
puts plants
if plants > people
return weeks
else
return harvest(people, plants + orig_fruit(plants, weeks), weeks+1)
end
end
require 'pry'
@blocks = [['B','O'],
['X','K'],
['D','Q'],
['C','P'],
['N','A'],
['G','T'],
['R','E'],
['T','G'],
require 'pry'
the_end = Time.new(2016, 06, 03, 17)
now = Time.now
while true
sleep(1)
the_end = Time.new(2016, 06, 03, 17)
now = Time.now
require 'pry'
# inital state is open
# all primes will be open
# all evens factored numbers will be closed
final_array = []
(1..100).each do |num|
num_array = (1..num).select { |n|num % n == 0}
if num_array.length % 2 != 0
require 'pry'
def convert_roman numeral
roman_hash_singles = { 1 => 'I', 4 => 'IV', 5 => 'V', 9 => 'IX' }
roman_hash_tens = { 10 => 'X', 40 => 'XL', 50 => 'L', 90 => 'XC' }
roman_hash_hundreds = { 100 => 'C' 400 => 'CD', 500 => 'D', 900 => 'CM' }
roman_hash_thousands = { 1000 => 'M' }
roman_hash_arr = [roman_hash_singles, roman_hash_tens, roman_hash_hundreds, roman_hash_thousands]
console.log('geocoords');
var myResults = [ {name: "six pack of beer", location: {lat: 37.767182, long: -122.5}},
{name: "whacky glasses", location: {lat: 37.767182, long: -122.51}},
{name: "whiskey bottle", location: {lat: 37.767282, long: -122.49}},
{name: "diving goggles", location: {lat: 37.770282, long: -122.503}},
{name: "running shoes", location: {lat: 37.7669, long: -122.457}},
{name: "paint brushes", location: {lat: 37.76800, long: -122.4580}}]
var current_loc = {name: "current loc", location: {lat: 37.76422, long: -122.474}}
require 'pry'
def get_squares num_arr
root_arr = []
non_int_root_arr = []
num_arr.each do |num|
root = Math.sqrt(num)
require 'pry'
puts "Enter a phrase: "
phrase = gets.chomp
def typogly phrase
word_arr = []
punct_arr = []
punct_flag = true
require 'pry'
puts "How many players?"
players = gets.chomp
def poker(players)
deck = [ "2h", "3h", "4h", "5h", "6h", "7h", "8h", "9h", "Th", "Jh", "Qh", "Kh", "Ah", "2c", "3c", "4c", "5c", "6c", "7c", "8c", "9c", "Tc", "Jc", "Qc", "Kc", "Ac", "2d", "3d", "4d", "5d", "6d", "7d", "8d", "9d", "Td", "Jd", "Qd", "Kd", "Ad", "2s", "3s", "4s", "5s", "6s", "7s", "8s", "9s", "Ts", "Js", "Qs", "Ks", "As"]
num_play = players