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 'fiber' | |
require 'eventmachine' | |
module Actor | |
class << self | |
def current | |
Mailbox.current | |
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
webkit_server (capybara-webkit) leaks memory on the following environment: | |
* Mac OS X Mountain Lion (10.8.2) | |
* XQuartz 2.7.4 | |
* Qt 4.8.3 | |
How to fix: | |
1) Downgrade Qt to 4.7.4 | |
brew unlink qt | |
cd `brew --prefix` |
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
# In Rails, add this to your Initializer/ folder | |
# | |
# Fix by @richardsondx - Richardson Dackam | |
# | |
# Thi monkey patch is not actually forcing farady to uncompress the response but it's telling it not to compress | |
# So it forces Faraday to avoid compressing the response. | |
# The gresponse from google had the header 'accept-encoding': 'gzip' | |
# unlike http.net, http.request doesn't automatically uncompress gzip request | |
# more info about http.request at https://github.com/ruby/ruby/blob/ruby_2_2/lib/net/http.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
#!/usr/local/rvm/wrappers/ruby-1.9.3-p194/ruby | |
require "cgi" | |
require "uri" | |
require "socket" | |
SCREEN_WIDTH = 1280 | |
SCREEN_HEIGHT = 1024 | |
cgi = CGI.new |
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
unless ENV.include?('CI') | |
ENV['DISPLAY'] = ':99' | |
pid = Process.spawn('Xvfb :99 -ac', out: '/dev/null', err: '/dev/null') | |
at_exit { Process.kill(:SIGINT, pid) } | |
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
require 'ipaddr' | |
IPAddr.new('1.2.3.4').to_i | |
IPAddr.new(16909060, Socket::AF_INET).to_s | |
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 | |
require 'base64' | |
require 'socket' | |
require 'fileutils' | |
require 'securerandom' | |
# UnixSocketForker is an experiment of inter-process communication using | |
# plain unix sockets to communicate between forked processes and the | |
# parent process. This can also be done via IO.pipe. In this experiment, |
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
# https://github.com/heroku/rails_stdout_logging/blob/master/lib/rails_stdout_logging/rails.rb | |
module RailsStdoutLogging | |
class Rails | |
def self.heroku_stdout_logger | |
logger = Logger.new(STDOUT) | |
logger = ActiveSupport::TaggedLogging.new(logger) if defined?(ActiveSupport::TaggedLogging) | |
logger.level = Logger.const_get(log_level) | |
logger | |
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
#!/usr/bin/env ruby | |
require 'bundler' | |
require 'hirb' | |
require 'csv' | |
lock_file = Bundler::LockfileParser.new(Bundler.read_file("Gemfile.lock")) | |
def url_for(spec) | |
case spec.source |
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 | |
require 'rubygems' | |
require 'bundler' | |
require 'fileutils' | |
require 'net/http' | |
require 'net/https' | |
require 'uri' | |
TMP_DIR = "/tmp/gems" |