API changes:
item:
ends_at_string: "4 maj kl. 12:31 CET"
bids:
- timestamp_string_short: "4 maj kl. 12:31"
- timestamp_string_long: "4 maj 2015 kl. 12:31 CET"
# Overwrite `t` helper in Rails views to raise in tests, | |
# which it otherwise doesn't do, even if I18n is configured to. | |
# | |
# Installation: | |
# put in lib/i18n_raise_on_missing_in_action_view.rb | |
# and require "i18n_raise_on_missing_in_action_view" in e.g. config/environments/test.rb | |
if Rails.env.test? | |
module ActionView::Helpers::TranslationHelper | |
def t_with_raise(*args) |
NUMBER = DATA.readlines.inject({}) { |h, line| | |
number, name = line.chop.split(". ", 2) | |
h[number] = name | |
h | |
} | |
def osascript(cmd) | |
system "osascript", "-e", cmd | |
end |
(* | |
"ID3 track numbers from filename prefixes" for iTunes | |
By Henrik Nyh, http://henrik.nyh.se, 2007-01-14. | |
Based on "Filenames to Song Names" by Doug Adams. | |
*) | |
tell application "iTunes" | |
if kind of container of view of front window is not library or selection of front browser window is {} then | |
display dialog "Select some tracks in iTunes first." buttons {"Cancel"} default button 1 with icon 2 giving up after 15 |
class Module | |
def const_missing(const_name) | |
puts "[ModuleConstMissing] #{self} missing #{const_name}" | |
end | |
end | |
class FakeDelegator < BasicObject | |
def self.const_missing(name) | |
puts "[FakeDelegator] missing #{name}" | |
if ::Object.const_defined?(name) |
# See: | |
# * http://thepugautomatic.com/2014/03/simpledelegator-autoloading-issues-with-rails/ | |
# * https://groups.google.com/forum/#!topic/rubyonrails-core/PjGUK72BmFA | |
# * https://gist.github.com/henrik/9314943 | |
require "delegate" | |
class RailsCompatibleSimpleDelegator < SimpleDelegator | |
def self.const_missing(name) | |
if ::Object.const_defined?(name) |
class MIME::Type | |
# Compares the MIME::Type based on how reliable it is before doing a | |
# normal <=> comparison. Used by MIME::Types#[] to sort types. | |
def priority_compare(other) | |
PriorityComparison.new(self, other).value | |
end | |
end |
# 1. Get the source however you like
wget http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.1.tar.gz
tar xfz ruby-2.1.1.tar.gz
cd ruby-2.1.1
# 2. Apply this patch! This is the interesting part.
curl https://gist.githubusercontent.com/henrik/10880288/raw/fe228cf0524873c992fa5c31b1173537dca76a2c/patch.diff | patch -p0
# 3. Build it however you like
# Notify devs about an actual exception, or unexpected situation, | |
# without necessarily letting it appear to the user as a 500 error. | |
# | |
# Decouples the rest of the app from the specific exception logger service. | |
# | |
# Suggested location in a Rails project: lib/ | |
class ExceptionNotifier | |
def self.notify(exception) | |
Honeybadger.notify(exception) |