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> | |
| <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
| <title>Per_month_graph</title> | |
| <script src="http://d3js.org/d3.v2.js"></script> | |
| </head> | |
| <body> |
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 new_cat(string1, string2) | |
| new_string = string1 + string2 | |
| end | |
| new_cat("Chad", "Bidwell") | |
| def sum(numbers) | |
| sum = 0 |
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 SudokuBoard | |
| def initialize(board_str) | |
| @example_board ="123456789578139624496872153952381467641297835387564291719623548864915372235748916" | |
| @board = board_str.split("").map { |value| Cell.new(value.to_i) } | |
| @groups = [] | |
| (generate_rows + generate_cols + generate_grids).each do |group_member_indices| | |
| group_cell_members = group_member_indices.map { |index| @board[index] } | |
| @groups << Group.new(group_cell_members) | |
| 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 "docopt" | |
| require "csv" | |
| class Task | |
| attr_accessor :description, :creation_time, :completion_time, :completed | |
| def initialize(description) | |
| @description = description | |
| @creation_time = Time.new.to_s | |
| @completion_time = "" |
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 "csv" | |
| require "sunlight" | |
| class EventManager | |
| INVALID_ZIPCODE = "0"*5 | |
| Sunlight::Base.api_key = "e179a6973728c4dd3fb1204283aaccb5" | |
| def initialize(filename) | |
| puts "EventManager Initialized." | |
| @file = CSV.open(filename, {:headers => true, :header_converters => :symbol}) |
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
| Huoquitlan: https://github.com/quavmo/huoquitlan.git | |
| Gem: http://flori.github.com/term-ansicolor/ |
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 game(two_players) | |
| two_players.inject do |player1, player2| | |
| p1 = player1[1].upcase | |
| p2 = player2[1].upcase | |
| if p1 == p2 | |
| "It's a Tie!" | |
| elsif p1 == "R" && p2 =="P" | |
| player2 | |
| elsif p1 == "R" && p2 == "S" |
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 BaseballTeam | |
| def initialize() | |
| @line_up = { 1 => { 'Aviles' => 'SS' }, | |
| 2 => { 'Pedroia' => '2B' }, | |
| 3 => { 'Youkilis' => '1B' }, | |
| 4 => { 'Ortiz' => 'DH' }, | |
| 5 => { 'Middlebrooks' => '3B' }, | |
| 6 => { 'Gonzalez' => 'OF' }, | |
| 7 => { 'Saltalamacchia' => 'C' }, |
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 Array | |
| def new_inject(*default_value) | |
| if default_value == [] | |
| total = self.first | |
| new_array = self.drop(1) | |
| else | |
| total = default_value[0] | |
| new_array = self | |
| end | |
| new_array.each do |element| |
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 RPNCalculator | |
| attr_accessor :value | |
| def initialize() | |
| @numbers = [] | |
| @value = 0 | |
| end | |
| def push(num) | |
| @numbers << num |
NewerOlder