This file contains 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
#!/usr/bin/env ruby | |
# Usage: | |
# $ curl http://date.jsontest.com | ./debug_json.rb | |
r = $stdin.dup | |
input = r.read | |
$stdin.reopen("/dev/tty") | |
require 'json' | |
require 'recursive-open-struct' | |
require 'awesome_print' |
This file contains 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 "net/http" | |
require "uri" | |
module Net | |
class HTTP | |
alias old_initialize initialize | |
def initialize(*args) | |
old_initialize(*args) | |
@open_timeout = @read_timeout = 1 # 1 second |
This file contains 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 Node | |
attr_accessor :value, :next_node, :previous_node | |
def initialize(value, next_node, previous_node) | |
@value = value | |
@next_node = next_node | |
@previous_node = previous_node | |
end | |
end |
This file contains 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 Node | |
attr_accessor :value, :next_node, :previous_node | |
def initialize(value, next_node, previous_node) | |
@value = value | |
@next_node = next_node | |
@previous_node = previous_node | |
end | |
end |
This file contains 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
Given the services are running # features/step_definitions/fig_steps.rb:3 | |
Running: fig build && (fig up -d || true) && sleep 10 | |
Process exited successfully | |
nginx version: nginx/1.7.9 | |
And I run "nginx -v" on the "web" service # features/step_definitions/fig_steps.rb:19 | |
Running: fig run -T web bash -c "sleep 1; nginx -v" | |
Process exited successfully | |
Then I should see "nginx" # features/step_definitions/cli_steps.rb:1 | |
And I should see "1.7" # features/step_definitions/cli_steps.rb:1 |
This file contains 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 Animal | |
include Population | |
end | |
class Kangaroo < Animal | |
end | |
class CaptainKangaroo < Kangaroo | |
end |
This file contains 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
defmodule Bar do | |
defstruct herp: "Derp" | |
end | |
defmodule Baz do | |
defstruct herp: "Derp" | |
end | |
defmodule Foo do |
This file contains 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 'rails_helper' | |
describe "seeds.rb script" do | |
def count_all_tables | |
ActiveRecord::Base.descendants | |
.sort_by(&:to_s).map(&:count) | |
end | |
it "is idempotent" do | |
load Rails.root.join("db", "seeds.rb") |
This file contains 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
# inspired by http://faxon.org/2015/02/03/edit-rails-activerecord-json-attributes-in-html-forms | |
# NOTE requires `custom_fields` column! | |
# | |
# class Foo | |
# include HasCustomFieldsBackedByJSON | |
# custom_fields_keys :bar, :baz | |
# end | |
module HasCustomFieldsBackedByJSON | |
extend ActiveSupport::Concern |
This file contains 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
$ ruby click.rb | |
/home/test/.bundle/ruby/1.8/gems/selenium-webdriver-0.0.27/lib/selenium/webdrive | |
r/ie/bridge.rb:594:in `check_error_code': unable to find element by xpath using | |
"//input[@id='signInSubmit']" (17) (Selenium::WebDriver::Error::UnexpectedJavasc | |
riptError) | |
from /home/test/.bundle/ruby/1.8/gems/selenium-webdriver-0.0.27/lib/sele | |
nium/webdriver/ie/bridge.rb:315:in `findElementByXpath' | |
from /home/test/.bundle/ruby/1.8/gems/selenium-webdriver-0.0.27/lib/sele | |
nium/webdriver/ie/util.rb:48:in `create_element' | |
from /home/test/.bundle/ruby/1.8/gems/selenium-webdriver-0.0.27/lib/sele |
OlderNewer