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
| require_relative 'song_library.rb' | |
| def jukebox(command) | |
| if command.downcase == "list" | |
| list_library | |
| else | |
| parse_command(command) | |
| end | |
| end |
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
| class Anagram | |
| def initialize(test_word) | |
| @test_word = test_word | |
| end | |
| def match(dictionary) | |
| out = dictionary.select do |x| | |
| @test_word.split("").sort == x.split("").sort | |
| end | |
| end | |
| end |
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 'rest_client' | |
| reddit_hash = JSON.parse(RestClient.get('http://reddit.com/.json')) | |
| reddit_hash["data"]["children"][2]["data"]["over_18"] | |
| str = "" | |
| reddit_sfw_hash = reddit_hash["data"]["children"].delete_if {|x| x["data"]["over_18"] == 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
| ######################## | |
| # NYC PIGEON ORGANIZER # | |
| ######################## | |
| # Start with the following collected data on NYC pigeons. | |
| pigeon_data = { | |
| :color => { | |
| :purple => ["Theo", "Peter Jr.", "Lucky"], | |
| :grey => ["Theo", "Peter Jr.", "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
| movie_collection = { | |
| comedy: ["The Hangover", "Forest Gump"], | |
| action: ["Saving Private Ryan", "Pulp Fiction", "The Matrix"], | |
| cartoon: ["Finding Nemo", "WallE", "Toy Story"] | |
| } | |
| recipes = { | |
| macaroni_and_cheese: ["macaroni", "cheese"], | |
| pj_sandwich: ["peanut butter", "jelly", "bread"], | |
| salad: ["lettuce", "tomato", "cucumbers", "feta cheese"] |
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 apple_picker(arr) | |
| apples_only = arr.collect do |x| | |
| if x == "apple" | |
| x | |
| else | |
| next | |
| end | |
| end | |
| apples_only.delete(nil) | |
| apples_only |
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 take_a_number(current_line, new_person) | |
| current_line << new_person | |
| current_line.length | |
| end | |
| def now_serving(current_line) | |
| puts "Currently serving #{current_line.first}" | |
| current_line.shift | |
| end |
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
| holiday_supplies = { | |
| :winter => { | |
| :christmas => ["Lights", "Wreath"], | |
| :new_years => ["Party Hats"] | |
| }, | |
| :summer => { | |
| :forth_of_july => ["Fireworks", "BBQ"] | |
| }, | |
| :fall => { | |
| :thanksgiving => ["Turkey"] |
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
| # Hashketball Nests | |
| # | |
| # Great news! You're going to an NBA game! The only catch is that you've been | |
| # volunteered to keep stats at the game. | |
| # | |
| # Using Nested Hashes, define a game, with two teams, their players, and the players stats: | |
| # | |
| # The game has two teams. | |
| # | |
| # A team has: |