Skip to content

Instantly share code, notes, and snippets.

View ahimmelstoss's full-sized avatar

Amanda Himmelstoss ahimmelstoss

View GitHub Profile
pigeon_data = {
:color => {
:purple => ["Theo", "Peter Jr.", "Lucky"],
:grey => ["Theo", "Peter Jr.", "Ms .K"],
:white => ["Queenie", "Andrew", "Ms .K", "Alex"],
:brown => ["Queenie", "Alex"]
},
:gender => {
:male => ["Alex", "Theo", "Peter Jr.", "Andrew", "Lucky"],
:female => ["Queenie", "Ms .K"]
# # Binary Secret Handshake
# > There are 10 types of people in the world: Those who understand binary, and those who don't.
# You and your fellow flatirons are of those in the "know" when it comes to binary decide to come up with a secret "handshake".
# ```
# 1 = wink
# 10 = double blink
# 100 = close your eyes
# Download this file:
# https://gist.github.com/scottcreynolds/ac1b5c8d96de0c91bf7c/download
# Run it from your terminal with:
# ruby ruby_phone_format.rb
# (Just make sure you are in the right directory)
# ======================================
# Ignore All This Code
# ======================================
@ahimmelstoss
ahimmelstoss / pigeon.rb
Created October 11, 2013 18:50
currently refactoring
# Start with the following collected data on NYC pigeons.
pigeon_data = {
:color => {
:purple => ["Theo", "Peter Jr.", "Lucky"],
:grey => ["Theo", "Peter Jr.", "Ms .K"],
:white => ["Queenie", "Andrew", "Ms .K", "Alex"],
:brown => ["Queenie", "Alex"]
},
:gender => {
require 'json'
require 'open-uri'
html_tag =
'<html>
<head>
</head>
<body>
<ul>
LI TAGS
def my_each(array)
i = 0
while i < array.length
raise (yield(array[i])).inspect
i+=1
end
array
end
array = [1, 2, 3]
def prime?(number)
tries = 0 #keep track for efficiency
prime = !(2...number).any? do |i|
tries += 1
number % i == 0
end
#is prime if it is NOT divisible by any number evenly from 2 through the number
prime_in_words = prime ? "prime" : "not prime" #if true, else false
@ahimmelstoss
ahimmelstoss / hasketball.rb
Created October 11, 2013 18:45
hasketball
game =
{
:team1 =>
{
:name => "New York Necks",
:colors => ["yellow", "brown"],
:players =>
{
"Giraffe 1" =>
{
# Write a method that returns whether a given letter is a vowel, using if and elsif
def is_vowel1(letter)
letter.downcase!
if letter == "a"
return true
elsif letter == "e"
return true
elsif letter == "i"
return true
def my_each(array)
i = 0
while i < array.length
raise (yield(array[i])).inspect
i+=1
end
array
end
array = [1, 2, 3]