Skip to content

Instantly share code, notes, and snippets.

@jerefrer
jerefrer / webrick_fix
Created October 18, 2013 10:13
Ruby script to fix webrick issues when running it inside a VM and trying to access it from outside.
#!/usr/bin/env ruby
require 'fileutils'
webricks = Dir.glob(File.join("/home/#{ENV['USER']}/.rvm/rubies/**/webrick/config.rb"))
webricks.each do |webrick|
FileUtils.cp webrick, "#{webrick}.bak"
output = File.read(webrick).gsub('DoNotReverseLookup => nil', 'DoNotReverseLookup => true')
File.open(webrick, "w") {|file| file.puts output}
end
@jerefrer
jerefrer / .bashrc
Last active December 15, 2015 09:29
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
### Increase History size
export HISTSIZE=10000
export HISTCONTROL=erasedups
@jerefrer
jerefrer / log_i18n_label_calls
Created December 14, 2012 19:00
Logs i18n lookups for labels in the server output
require 'i18n'
if Rails.env.development?
module I18n
class << self
def translate_with_debug(*args)
puts "Translate: #{args.inspect}"
translate_without_debug(*args)
end
alias_method_chain :translate, :debug
with_options :env => "test" do |test|
test.gem "cucumber"
test.gem "cucumber-rails"
end
with_options :env => "development" do |dev|
dev.gem "hirb"
end
gem "authlogic"
gem "will_paginate"
gem "haml" # only used for sass so compass works