- 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
| <!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
| require 'sqlite3' | |
| require 'csv' | |
| # If you want to overwrite your database you will need | |
| # to delete it before running this file | |
| $db = SQLite3::Database.new "politicians.db" | |
| module PoliticianDB | |
| def self.setup |
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 | |
| attr_reader :color, :speed, :status | |
| def initialize(args) | |
| @color = args[:color] | |
| @speed = :slow | |
| @status = :stopped | |
| 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 Die | |
| attr_reader :dice, :top | |
| @@dice = [['A','A','E','E','G','N'], | |
| ['E','L','R','T','T','Y'], | |
| ['A','O','O','T','T','W'], | |
| ['A','B','B','J','O','O'], | |
| ['E','H','R','T','V','W'], | |
| ['C','I','M','O','T','U'], |
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 factorial_iterative(number) | |
| until number == 1 | |
| number *= number - 1 | |
| number -= 1 | |
| p number | |
| end | |
| fib_num |
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 powerplant(args) | |
| @engine | |
| @transmission | |
| @drivetrain | |
| end | |
| def chassis(args) |
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 has_ssn?(string) | |
| if string =~ /\d{3}\W\d{2}\W\d{4}/ | |
| true | |
| elsif string =~ /\d{9}/ | |
| true | |
| else | |
| false | |
| 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
| def super_fizzbuzz(array) | |
| array.each do |w| | |
| if w % 15 == 0 | |
| puts "FizzBuzz" | |
| elsif w % 3 == 0 | |
| puts "Fizz" | |
| elsif w % 5 == 0 | |
| puts "Buzz" | |
| else |
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
| # test to see if valid triangle | |
| def valid_triangle?(a, b, c) | |
| if ((a == 0 or b == 0 or c == 0) or (a == nil or b == nil or c == nil)) | |
| return false | |
| end | |
| if a + b > c | |
| return true |