This file contains hidden or 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
if Rails.env.test? | |
module I18n | |
def self.just_raise_that_exception(*args) | |
raise args.first | |
end | |
end | |
I18n.exception_handler = :just_raise_that_exception | |
module ActionView::Helpers::TranslationHelper | |
def translate_with_raise(key, options = {}) |
This file contains hidden or 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
module LessStupidTranslationHelper | |
include ActionView::Helpers::TranslationHelper | |
class Interpolator | |
attr_reader :variables | |
def initialize(context) | |
@variables = HashWithIndifferentAccess.new | |
@context = context |
This file contains hidden or 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
describe MailPreview do | |
MailPreview.new.public_methods(false).each do |e| | |
example "##{e}" do | |
subject.send(e).should_not be_blank | |
end | |
end | |
end |
This file contains hidden or 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
if ENV['RUBY_DEBUG_PORT'] # NOTE no RUBY_DEBUG_PORT in the environment means no remote debugging, okay? | |
Byebug.start_server 'localhost', ENV['RUBY_DEBUG_PORT'].to_i | |
end |
This file contains hidden or 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 | |
# NOTE current directory is assumed | |
# NOTE run with 'rm {}' to remove duplicate copies (while taking necessary caution) | |
exec_command = ARGV[0] || 'echo {}' | |
require 'digest/md5' | |
require 'shellwords' | |
filenames_by_md5 = {} |
This file contains hidden or 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 'digest/md5' | |
hash = {} | |
Dir.glob("**/*", File::FNM_DOTMATCH).each do |filename| | |
next if File.directory?(filename) | |
# puts 'Checking ' + filename | |
key = Digest::MD5.hexdigest(IO.read(filename)).to_sym | |
if hash.has_key? key |
This file contains hidden or 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
[ -r $HOME/.bashrc ] && . $HOME/.bashrc |
This file contains hidden or 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 i18n | |
# XXX experiment | |
I18n._boring_translate = I18n.translate | |
I18n.t = I18n.translate = (scope, options)-> | |
if typeof scope == 'string' && scope[0] == '.' | |
scope = scope.slice 1 | |
options ||= {} | |
options.scope ||= I18n._local_scope |
This file contains hidden or 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
if defined? PusherFake | |
PusherFake.configure do |config| | |
config.logger = Rails.logger | |
config.verbose = true | |
# NOTE won't work with DJ pushing OR with a pre-defined port | |
config.socket_options = {host: ENV['DOMAIN_NAME'], port: config.send(:available_port)} | |
end | |
require 'pusher-fake/support/base' if ENV['FAKE_PUSHER'] # NOTE should be set for a single process only |
This file contains hidden or 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
shared_context "pusher server client" do | |
before do | |
@_pusher_stub = stub_pusher if do_stub_pusher && !@_pusher_stub | |
end | |
after do | |
remove_request_stub @_pusher_stub if @_pusher_stub | |
@_pusher_stub = nil | |
end |