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 DeepFreezing | |
# „Deep freezes“ the array, that is: | |
# - if the element responds to deep_freeze itself, | |
# like Array and Hash should, call it. | |
# - if the element responds to freeze, call it | |
# - freeze self | |
# | |
# ==== Returns | |
# self | |
# |
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
FinancialTransaction::ErsteBankImporter.any_instance.expects(:initialize).once.with(anything, {:foo => 42}) | |
FinancialTransaction.detect_importer( | |
StringIO.new("Bezeichnung;Valutadatum;Betrag;Währung\n"), | |
:foo => 42 | |
) |
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
var lastKnownOrientation = null; | |
function rotate() { | |
if(window.orientation != lastKnownOrientation) { | |
lastKnownOrientation = window.orientation; | |
updateRotation(); | |
} | |
} | |
function updateRotation() { |
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
html, body, div, span, applet, object, iframe, | |
h1, h2, h3, h4, h5, h6, p, blockquote, pre, | |
a, abbr, acronym, address, big, cite, code, | |
del, dfn, em, font, img, ins, kbd, q, s, samp, | |
small, strike, strong, sub, sup, tt, var, | |
dl, dt, dd, ol, ul, li, | |
fieldset, form, label, legend, | |
table, caption, tbody, tfoot, thead, tr, th, td { | |
margin: 0; | |
padding: 0; |
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
class Routing::Router | |
def initialize(recipient, options = {}) | |
options.assert_valid_keys(:customer) | |
@customer = options[:customer] | |
@recipient = PhoneNumber.new(recipient).internationalise(:local_country => @customer.site_country) | |
end | |
def destination | |
destination = ( |
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
document.observe('dom:loaded', function() { | |
if(!document.location.href.match(/#podcenter_ch/)) { | |
return false; | |
} | |
var allElementsWithPrices = $$('*').select(function(e) { | |
return e.innerHTML.match(/^€/); | |
}); | |
allElementsWithPrices.each(function(e) { |
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 Faxonline | |
class MultiLogger | |
def initialize(*loggers) | |
@loggers = loggers.collect do |logger| | |
if logger.is_a?(Logger) | |
logger | |
else | |
Logger.new(logger) | |
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
class Hash | |
def lookup_path(query) | |
path = query.split('.') | |
path.inject(self) do |result, key| | |
result[key] or return nil # || won't work. | |
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
require "thread" | |
class Mailbox | |
def initialize | |
@stop = false | |
end | |
def stop! | |
@stop = true | |
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
FacadedImapMethods = [:uid_search, :uid_fetch, :uid_copy, :uid_store, :expunge, :append, :select, :login].deep_freeze | |
FacadedImapMethods.each do |sig| | |
class_eval <<-CLASS_METHOD, __FILE__, __LINE__ +1 | |
def #{ sig }(*args) # def uid_search(*args) | |
imap_method(:#{ sig }, *args) # imap_method(:uid_search, *args) | |
end # end | |
CLASS_METHOD | |
end |