Skip to content

Instantly share code, notes, and snippets.

View fsvehla's full-sized avatar

Ferdinand Svehla fsvehla

View GitHub Profile
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
#
FinancialTransaction::ErsteBankImporter.any_instance.expects(:initialize).once.with(anything, {:foo => 42})
FinancialTransaction.detect_importer(
StringIO.new("Bezeichnung;Valutadatum;Betrag;Währung\n"),
:foo => 42
)
var lastKnownOrientation = null;
function rotate() {
if(window.orientation != lastKnownOrientation) {
lastKnownOrientation = window.orientation;
updateRotation();
}
}
function updateRotation() {
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;
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 = (
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) {
module Faxonline
class MultiLogger
def initialize(*loggers)
@loggers = loggers.collect do |logger|
if logger.is_a?(Logger)
logger
else
Logger.new(logger)
end
end
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
require "thread"
class Mailbox
def initialize
@stop = false
end
def stop!
@stop = true
end
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