Skip to content

Instantly share code, notes, and snippets.

View pabuisson's full-sized avatar

Pierre-Adrien Buisson pabuisson

View GitHub Profile

Kata Potter

If you want to try this Kata for yourself or at your dojo meeting, read the problem description and see if the Kata appeals to you. The rest is commentary and helpful clues for if you get stuck solving it. I would recommend trying the Kata for yourself before reading too much of it.

Problem Description

Once upon a time there was a series of 5 books about a very English hero called Harry. (At least when this Kata was invented, there were only 5. Since then they have multiplied) Children all over the world thought he was fantastic, and, of course, so did the publisher. So in a gesture of immense generosity to mankind, (and to increase sales) they set up the following pricing model to take advantage of Harry’s magical powers.

One copy of any of the five books costs 8 EUR. If, however, you buy two different books from the series, you get a 5% discount on those two books. If you buy 3 different books, you get a 10% discount. With 4 different books, you get a 20% discount. If you go the whole h

require 'rack/handler/thin'
Capybara.register_server :thin_ssl do |app, port, host|
Rack::Handler::Thin.run(app, Port: port, Host: host)
end
require 'rack/handler/thin'
Capybara.register_server :thin_ssl do |app, port, host|
Rack::Handler::Thin.run(app, Port: port, Host: host) do |server|
server.ssl = true
server.ssl_options = {
private_key_file: "#{Rails.root}/config/ssl/key.pem",
cert_chain_file: "#{Rails.root}/config/ssl/cert.pem",
}
end
Capybara.server = :thin_ssl
# https://github.com/teamcapybara/capybara/issues/1121
class SslServer
def responsive?
return false if @server_thread && @server_thread.join(0)
http = Net::HTTP.new(host, @port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
res = http.get('/__identify__')
Capybara.register_driver :https_chrome do |app|
browser_options = Selenium::WebDriver::Chrome::Options.new
browser_options.add_argument('allow-insecure-localhost') # Ignore TLS/SSL errors on localhost
browser_options.add_argument('ignore-certificate-errors') # Ignore certificate related errors
Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
end
class ActionDispatch::IntegrationTest
setup do
https!
end
end
@pabuisson
pabuisson / gist:3482439
Created August 26, 2012 18:39
new brew install -vd macvim
pabuisson@macbook-du-pad:~$ brew update
Checking out files: 100% (75/75), done.
Updated Homebrew from 2aaaa7f5 to a8cb83a9.
==> New Formula
bup libmetalink tika
==> Updated Formula
aalib ctail imagesnap monetdb reattach-to-user-namespace subversion vimpc
appledoc darwinbuild jstalk mu robodoc swi-prolog vpnc
aview elasticsearch libgphoto2 nauty scm-manager symphony vrpn
blueutil erlang libpng objective-caml socat teem vsftpd
@pabuisson
pabuisson / gist:3343170
Created August 13, 2012 18:49
brew --config
pabuisson@macbook-du-pad:~$ brew --config
HOMEBREW_VERSION: 0.9.2
HEAD: dc4c40b90c0bc8e6901bf2755a3968d757eb7c5e
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: dual-core 64-bit penryn
OS X: 10.8-x86_64
Xcode: 4.4.1
CLT: 4.4.0.0.1.1249367152
GCC-4.0: N/A