Skip to content

Instantly share code, notes, and snippets.

{
1 => "Highlander",
2 => "Reece's Peanut Butter Cops",
3 => "blind mice",
4 => "ninja turtles",
}

dbrady_trainline

Build a bot that triggers searches on http://thetrainline.com and returns the results in a specific format.

Input

  • The bot should respond to ComThetrainline.find(from, to, departure_at).
  • Assume that the parameters from and to will be EXACTLY what you need.
  • departure_at will be a Ruby DateTime object.
@ordinaryzelig
ordinaryzelig / .ruby-version
Last active August 29, 2015 14:01
Test cases for thread-safety in mocking libraries (http://redningja.com/dev/parallel-tests-with-single-database/)
ruby-2.0.0-p353
{
"token" => "02999FA70DA28B16C1F48D99D07ECEB7.sbg-vm-fe02",
"transaction" => {
"account" => {
"brand" => "PAYPAL"
},
"channel" => "52275ebaf361f20a76b038ba4c806991",
"criterions" => [
[0] {
"name" => "mode",

(steps on soap box)

I think Ruby's Object#tap method is abused. I see code like this all the time:

obj = SomeClass.new.tap do |o|
  o.blah = true
end
@ordinaryzelig
ordinaryzelig / rails_admin_rspec_failures
Last active May 11, 2017 20:02
after fix for updating haml version, these are the rspec failures
Failures:
1) RailsAdmin Config DSL Edit Section has_many with nullable foreign key allow to remove element
Failure/Error: visit edit_path(model_name: 'Team', id: @team.id)
Capybara::Poltergeist::JavascriptError:
One or more errors were raised in the Javascript code on the page. If you don't care about these errors, you can ignore them by setting js_errors: false in your Poltergeist configuration (see documentation for details).
SyntaxError: JSON Parse error: Unrecognized token '&'
SyntaxError: JSON Parse error: Unrecognized token '&'