This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
# ====================================== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'open-uri' | |
html_tag = | |
'<html> | |
<head> | |
</head> | |
<body> | |
<ul> | |
LI TAGS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def my_each(array) | |
i = 0 | |
while i < array.length | |
raise (yield(array[i])).inspect | |
i+=1 | |
end | |
array | |
end | |
array = [1, 2, 3] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
game = | |
{ | |
:team1 => | |
{ | |
:name => "New York Necks", | |
:colors => ["yellow", "brown"], | |
:players => | |
{ | |
"Giraffe 1" => | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def my_each(array) | |
i = 0 | |
while i < array.length | |
raise (yield(array[i])).inspect | |
i+=1 | |
end | |
array | |
end | |
array = [1, 2, 3] |