Skip to content

Instantly share code, notes, and snippets.

View oberfoerster's full-sized avatar

Jörg Weißmantel oberfoerster

View GitHub Profile
<FilesMatch "\.(pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "public"
ExpiresActive On
ExpiresDefault "access plus 10 years"
FileETag None
Header unset Last-Modified
Header unset ETag
</FilesMatch>
module I18n
module Backend
class SnippetBackend < Simple
protected
def init_translations
load_translations(*I18n.load_path.flatten)
load_translations_from_database
@initialized = true
end
# If your workers are inactive for a long period of time, they'll lose
# their MySQL connection.
#
# This hack ensures we re-connect whenever a connection is
# lost. Because, really. why not?
#
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar)
#
# From:
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/
module CurrentMethodName
def current_method_name
caller[0][/`([^']*)'/, 1]
end
end
# Example:
#
# class MyClass
# include CurrentMethodName