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 'awesome_print' | |
| holiday_supplies = { | |
| :winter => { | |
| :christmas => ["Lights", "Wreath"], | |
| :new_years => ["Party Hats"] | |
| }, | |
| :summer => { | |
| :fourth_of_july => ["Fireworks", "BBQ"] | |
| }, |
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, name) | |
| current_line << name | |
| puts current_line.index(name)+1 | |
| 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
| require 'pry' | |
| # 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. |
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 'pry' | |
| require 'awesome_print' | |
| # create a method called create_groups that, given an array of student names, | |
| # a group size, and a number of groups, will return an array of groups of | |
| # of students with no student in adjacent groups | |
| def create_groups(students, group_size=4, num_groups=20) | |
| students.shuffle! | |
| student_groups = [] |
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 'awesome_print' | |
| ######################## | |
| # NYC PIGEON ORGANIZER # | |
| ######################## | |
| # Start with the following collected data on NYC pigeons. | |
| pigeon_data = { | |
| :color => { |
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
| -- Create a schema based on the following information: | |
| -- A project has a title, a category, a funding goal, a start date, and an end date. Valid categories are: music, books, charity. | |
| -- A user has a name and an age | |
| -- A pledge has an amount. It belongs to a user, and it also belongs to a project. | |
| -- Insert some records into the datbase |
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 'student_profiles_rake' | |
| require 'pry' | |
| def students_scrape_loop | |
| Student.make_schema | |
| Student.get_students.each do |student_url| | |
| obj = Student.new(student_url) | |
| obj.scrape_data | |
| obj.save_to_database | |
| 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 'pry' | |
| class Anagram | |
| attr_accessor :match_word | |
| def initialize(match_word) | |
| @match_word = match_word | |
| 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
| # setup code whereby the world of gridsize "x" by "x" cells is | |
| # generated has been omitted for brevity, but know that the world | |
| # argument below refers to an array of arrays giving us a 2D 'map' | |
| # of sorts full of cells; if a cell's value == 1, that cell is alive; | |
| # if its value == 0, that cell is dead. whether a cell lives or dies | |
| # in the next generation of life depends solely on its # of neighbors | |
| # and that logic is contained below. | |
| def run_generation_of_life(world) | |
| new_world = [] |
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". | |
| # Write a program that will convert a binary number, represented as a string (i.e. "101010"), and convert it to the appropriate sequence of events for a secret handshake. | |
| # The program should consider strings specifying an invalid binary as the value 0. |