- Download this application skeleton.
- Convert the app to use AJAX.
- Add any files you changed to your gist and submit your 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
| def mode(array) | |
| hash = Hash.new(0) | |
| array.each { |elem| hash[elem] += 1 } | |
| hash.keep_if { |k, v| v == hash.values.max }.keys | |
| 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 Vehicle | |
| def initialize(args) | |
| @color = args[:color] | |
| @wheels = args[:wheels] | |
| @gas_mileage = [true,false] | |
| end | |
| def drive | |
| @status = :driving | |
| end | |
| def brake |
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
| <!doctype html> | |
| <html> | |
| <head> | |
| <link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css"> | |
| <link rel="stylesheet" href="main.css"> | |
| <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800"> | |
| <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900"> | |
| <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css"> | |
| </head> |
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
| //------------------------------------------------------------------------------------------------------------------ | |
| // YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here. | |
| //------------------------------------------------------------------------------------------------------------------ | |
| function Animal(kind,legs) { | |
| this.kind = kind; | |
| this.legs = legs; | |
| }; | |
| var Zoo = { |
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
| /* Here is your chance to take over Socrates! | |
| Spend 10 minutes on each of the following hacks to the socrates website. | |
| Enter them in the console to make sure it works and then save | |
| your results here. | |
| Choose a new pair for each. Add your names to the section you complete. | |
| */ |
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 new repository on the command line | |
| touch README.md | |
| git init | |
| git add README.md | |
| git commit -m "first commit" | |
| git remote add origin https://github.com/1neway/quotations.git | |
| git push -u origin master | |
| Push an existing repository from the command line |
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
| <html> | |
| <head></head> | |
| <body> | |
| <pre style="word-wrap: break-word; white-space: pre-wrap;"> | |
| [{"id":1,"name":"John","created_at":"2013-08-14T20:55:47Z","updated_at":"2013-08-14T20:55:47Z"},{"id":2,"name":"Samantha","created_at":"2013-08-14T20:56:40Z","updated_at":"2013-08-14T20:56:40Z"}] | |
| </pre> | |
| </body> | |
| </html> |
From http://pages.apigee.com/rs/apigee/images/api-design-ebook-2012-03.pdf
Routes
- 2 base urls per resource ("/dogs" and "/dogs/1234")
- Keep verbs out of base URLs -HTTP verbs to operate on collections and elements -Shouldn't need URL deeper than /resource/identifier/resource -Sweep parameters under HTTP ? ("GET /dogs?color=red&state=running&location=park")