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 String | |
| def mark_twain | |
| self.mark_twain_helper([]) | |
| end | |
| def mark_twain_helper(drafts) | |
| words = self.split(' ') | |
| if words.length > 1 | |
| drafts << "Draft: #{words[0..words.length].join(" ")}." | |
| words[0..words.length-2].join(" ").mark_twain_helper(drafts) |
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 | |
| @lineup = { 1 => { 'Aviles' => 'SS' }, 2 => { 'Pedroia' => '2B' }, 3 => { 'Youkilis' => '1B' }, | |
| 4 => { 'Ortiz' => 'DH' }, 5 => { 'Middlebrooks' => '3B' }, 6 => { 'Gonzalez' => 'OF' }, | |
| 7 => { 'Saltalamacchia' => 'C' }, 8 => { 'McDonald' => 'OF' }, 9 => { 'Byrd' => 'OF' }, | |
| 0 => { 'Lester' => 'P' } } | |
| end | |
| def get_lineup | |
| @lineup |
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 'jumpstart_auth' | |
| require 'bitly' | |
| class JSTwitter | |
| attr_reader :client | |
| def initialize | |
| puts "Initializing..." | |
| @client = JumpstartAuth.twitter | |
| @screen_names = @client.followers.collect{|follower| follower.screen_name} |
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
| # Dependencies | |
| require "csv" | |
| require 'sunlight' | |
| require 'date' | |
| # Class Definition | |
| class EventManager | |
| Sunlight::Base.api_key = "e179a6973728c4dd3fb1204283aaccb5" | |
| INVALID_PHONE_NUMBER = "0" * 10 |
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
| #gems | |
| require 'twitter' | |
| require 'csv' | |
| class Follower_Data | |
| def initialize(filename) | |
| puts "Twitter_Follower Initialized." | |
| @list_file = CSV.open(filename, {:headers => true, :header_converters => :symbol}) | |
| 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
| <html> | |
| <head> | |
| <title>CodeClassChat</title> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
| <link rel="stylesheet" type="text/css" href="http://codeclasschat.herokuapp.com/bootstrap/css/bootstrap.css"> | |
| <link rel="stylesheet" type="text/css" href="http://codeclasschat.herokuapp.com/style.css"> | |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
| <script src="http://codeclasschat.herokuapp.com/helpers.js"></script> |
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 'time' | |
| require 'csv' | |
| class TaskItem | |
| attr_accessor :task, :created_at, :completed, :completed_at | |
| ###Intialize with optional hash values for existing todos | |
| def initialize(task_string, optional_values = {}) | |
| values = {created_at: Time.now, completed: false, completed_at: ""}.merge(optional_values) | |
| @task = task_string | |
| @created_at = values[:created_at] |
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
| # module SudokuSolver | |
| class Gameboard | |
| attr_reader :board, :rows, :columns, :quadrants | |
| def initialize(initial_values) | |
| @board = [] | |
| @rows = [] | |
| @columns = [] | |
| @quadrants = [] | |
| generate_cells(initial_values) |
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
| # Using an optional hash | |
| # | |
| # **branch based off of the optional hash | |
| def initialize(task_string, created_at = Time.now, completed_at = nil) | |
| end | |
| def initialize(task_string, optional_values = {}) | |
| values = {created_at: Time.now, completed_at: nil}.merge(optional_values) | |
| @task = task_string |
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 'rspec' | |
| require 'simplecov' | |
| SimpleCov.start | |
| require './list.rb' | |
| require './task.rb' | |
| #require './todo.rb' | |
| describe Todo::Task do | |
| before :all do | |
| @new_task = Todo::Task.new("This is a task string") |