Skip to content

Instantly share code, notes, and snippets.

View ashleygwilliams's full-sized avatar

ashley williams ashleygwilliams

  • 10:04 (UTC -05:00)
View GitHub Profile

#Nested Resources

Create 2 resources using a scaffold, nest them.

Build the create action for the nested resource. So for example, posts have many comments, I have a form that can create a new comment for a particular post.

Examples: Parks have many waterslides, build a form for a water slide You guys have many stories (that you won't tell me), build a form for a story

THE CHALLENGE

Create a Command Line Pig Latin translator.

Pig Latin is a game of alterations played on the English language game. To create the Pig Latin form of an English word the initial consonant sound is transposed to the end of the word and an ay is affixed. Read Wikipedia for more information on rules.

Example output:

> pig_latin("banana") #=> "anana-bay"

The Challenge

As a developer it helps to be able to understand a client’s perspective and to build suitable applications to help them in their field. This means knowing a bit about the world. We’ll help this background knowledge by doing looking at some economic data, and also testing our XML parsing skills.

The file cia-1996.xml is the data from the CIA World Factbook of 1996 in XML format. It has details about 260 countries across five continents. Your challenge, should you choose to accept it, is to uncover the following details buried within this file:

  • What is the population of the country with the most people? Yes, we know it’s China, but just how many people lived there in 1996?
  • What are the five countries with the highest inflation rates, and what were those rates in 1996?
  • What are the six continents in the file and which countries belong to which continent? Can you also produce them in alphabetical order?

Once you’ve worked out how to do

The Challenge

Chunky Bacon Begone is a dry-cleaning company known for its speedy service. It guarantees to dry-clean anything within two business hours or less. The problem is, when the customer drops off the clothes, he needs to know what time they are guaranteed to be done.

It is your job to write a Ruby script which will determine the guaranteed time given a business hour schedule. You must create a class called BusinessHours which allows one to define the opening and closing time for each day. It should provide the following interface:

hours = BusinessHours.new("9:00 AM", "3:00 PM")
hours.update :fri, "10:00 AM", "5:00 PM"
hours.update "Dec 24, 2010", "8:00 AM", "1:00 PM"
hours.closed :sun, :wed, "Dec 25, 2010"

Goals

Basic control over Ruby elements, specially command line scripting.

Description

There are several ways to subtitle a movie nowadays, and one of the most well known format is the SubRip format (http://en.wikipedia.org/wiki/SubRip). It has entries like these:

645
01:31:51,210 --> 01:31:54,893
the government is implementing a new policy...

THE CHALLENGE

You owe a big favor and have agreed to pick up a friend at the airport every Friday night. The airline on which your friend flies is cheap, but terrible with reporting delays and departure/arrival times. You soon realize that the 10pm flight is never on time and is usually late by more than an hour. If the plane has arrived at 11:15pm, 12:03am, 11:30pm, 11:23pm and 11:48pm, what is the average arrival time?

Does the solution still work if your friend changes to a flight arriving 6 hours later? What about 12 hours later?

Program Output

The output should look something like this when run from the console:

>> average_time_of_day(["11:51pm", "11:56pm", "12:01am", "12:06am", "12:11am"])

fork this repo: [email protected]:ashleygwilliams/rpcfn-interactive-fiction.git

The Challenge

In this challenge, you'll implement an interactive fiction game which mimics the first few rooms of the grandaddy of all text adventures, Collossal Cave. In order to succeed, your program will need to read in a "story" in the form of a simple DSL, interpret user commands, and track the player's progress and inventory. If you get all that working without too much trouble, I've also included an "extra credit" challenge to implement basic "puzzle" functionality in the game.