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
| diff --git a/db/schema.rb b/db/schema.rb | |
| index 81ac000..6680ff5 100644 | |
| --- a/db/schema.rb | |
| +++ b/db/schema.rb | |
| @@ -53,13 +53,6 @@ ActiveRecord::Schema.define(version: 20131105015734) do | |
| t.string "call_source" | |
| end | |
| - create_table "most_recent_outcome_choices", id: false, force: true do |t| | |
| - t.integer "id" |
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
| # https://github.com/rails/rails/blob/e20dd73df42d63b206d221e2258cc6dc7b1e6068/activesupport/lib/active_support/core_ext/object/try.rb | |
| class Object | |
| def try(*a, &b) | |
| if a.empty? && block_given? | |
| yield self | |
| else | |
| public_send(*a, &b) if respond_to?(a.first) | |
| 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 ENV.assert(key) | |
| ENV[key] or raise "missing required ENV value for key: #{key}" | |
| 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
| task :default do | |
| require 'rspec/core/rake_task' | |
| RSpec::Core::RakeTask.new(:spec) | |
| Rake::Task[:spec].invoke | |
| 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 'spec_helper' | |
| describe Requester do | |
| let(:requester) do | |
| Class.new{ include Requester }.new | |
| end | |
| describe ".get" do | |
| it "limits the number of redirects to follow" do | |
| uri = 'http://www.example.com/_status' |
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 timeout(seconds = nil) | |
| timer_thread = Thread.start(Thread.current, Time.now) { |app_thread, start| | |
| sleep(seconds) | |
| app_thread.raise 'Execution timed out' | |
| } | |
| yield | |
| ensure | |
| timer_thread.kill | |
| timer_thread.join |
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 'devise/mailer' | |
| # | |
| # General mailer proxy class to send emails in the background w/ Sidekiq | |
| # | |
| class BackgroundMailer | |
| def self.reset_password_instructions(record, token, opts={}) | |
| new(Devise::Mailer, :reset_password_instructions, record, token, opts) | |
| end | |
| def initialize(mailer_klass, method, *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
| # The following is recognized as removing Topic::Error and adding Topic::Topic::Error. | |
| # Changing from this: | |
| module Topic | |
| class Error < StandardError; end | |
| end | |
| # to this: |
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
| desc "Rename this application" | |
| task :rename, [:name] => :environment do |t, args| | |
| files = Dir.glob(%w(rb yml).map{ |ext| Rails.root.join("**/*.#{ext}") } + %w(Rakefile)) | |
| before = Rails.application.class.name.split('::').first | |
| after = args.name or raise "Pass a new name as an argument: $ rake rename[MyCivicApp]" | |
| files.each do |file| | |
| # Swap in the new name | |
| renamed = File.read(file).gsub(/#{before}/, after).gsub(/#{before.underscore}/, after.underscore) | |
| # Write the updated contents |
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 2.
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
| id label prediction negative_probability neutral_probability positive_probability text | |
| 0-1391107570 positive 0.172 0.294 0.534 Overheard: @dget browsing Google font pairings. "Something tells me you don't always want Creepster." #cfa2014 | |
| 1-1391109571 neutral 0.022 0.936 0.042 Hard not to think of http://t.co/fPn9J4HXLL while practicing app demos. (cc @dget, @mollyampersand) #cfa2014 | |
| 2-1391109768 neutral 0.023 0.906 0.071 RT @fureigh: Hard not to think of http://t.co/fPn9J4HXLL while practicing app demos. (cc @dget, @mollyampersand) #cfa2014 | |
| 3-1391110031 neutral 0.041 0.844 0.115 It's safe for work, I swear: http://t.co/j2gkzlaroF #catsforamerica #cfa2014 (cc @_jden) | |
| 4-1391110164 neutral 0.037 0.703 0.26 *giggle* RT @fureigh: It's safe for work, I swear: http://t.co/H7yga8fFHX #catsforamerica #cfa2014 (cc @_jden) | |
| 5-1391110333 neutral 0.378 0.501 0.121 @fureigh @_jden OH GOD #CFA2014 IS GOING DOWN THE @MAXOGDEN PATH #teamcorgi | |
| 6-1391111279 neutral 0.046 0.741 0.213 Streetreel, the 1st CfA app project pit |