Skip to content

Instantly share code, notes, and snippets.

View makaroni4's full-sized avatar

Anatoli Makarevich makaroni4

View GitHub Profile
RSpec::Matchers.define :terminate do |code|
actual = nil
def supports_block_expectations?
true
end
match do |block|
begin
block.call
require "socket"
socket = TCPSocket.open("www.theonion.com", "80")
TCPSocket.open("www.theonion.com", 80) do |socket|
socket.puts "GET / HTTP/1.0\n\n"
puts socket.read
end
@makaroni4
makaroni4 / deploy.rb
Created September 25, 2012 12:39 — forked from divineforest/deploy.rb
Lock deploy in Capistrano (only 1 deploy at a moment)
at_exit do
deploy.unlock
end
set :deploy_lock_file, "#{shared_path}/tmp/deploing_lock_file"
namespace :deploy do
desc "Check if somebody already is deploing"
task :check_lock do
@makaroni4
makaroni4 / flash_session_cookie_middleware.rb
Created July 22, 2011 13:13 — forked from Bertg/flash_session_cookie_middleware.rb
FlashSessionCookieMiddleware with fix for sessions with url encoded tokens