Skip to content

Instantly share code, notes, and snippets.

@tobias
tobias / core.clj
Last active August 29, 2015 14:02 — forked from marianoguerra/core.clj
(ns logerror.core
(:require
[immutant.cache :as cache]
[clojure.tools.logging :as log]))
(println @#'clojure.tools.logging/*logger-factory*)
(try
(def my-cache (cache/create "cache"))
(catch Exception e
(.printStackTrace e)
(if (resolve 'clojure.java.jdbc/transaction*)
(do
(in-ns 'clojure.java.jdbc)
(def ^{:dynamic true} xa-transaction* transaction*)
(defn transaction* [& args] (apply xa-transaction* args))
(in-ns 'immutant.xa.transaction))
(println "Using XA with java.jdbc 0.1.x is not supported"))
class PostCodeGo
include TorqueBox::Messaging::Backgroundable
always_background :postcode, :priority => :normal
def postcode(time, origin, mode, email)
iso = Real::Chrone.new_or_cached(time: time, origin: origin, mode: mode.to_sym)
csvs = [iso.postcode_csv, iso.postcode_sector_csv, iso.postcode_district_csv]
CsvMailer.files(csvs, time, mode, email).deliver
end
@tobias
tobias / database.yml
Created January 24, 2012 13:34 — forked from sfalsin/database.yml
Sfalsin Database.yml
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: jdbcmysql
xa: false
encoding: utf8
@tobias
tobias / long_running_job.rb
Created January 16, 2012 16:34 — forked from abstractj/long_running_job.rb
integration_test
# in the test:
queue = TorqueBox::Messaging::Queue.new( '/queue/response' )
queue.receive( :timeout => 120_000 ).should == 'started'
queue.receive( :timeout => 5_000 ).should be_nil
service AService {
name = 'x'
singleton = true
config :foo => :bar
}
service AService {
name = 'y'
singleton = true
config :foo => :baz
service AService {
name = 'x'
singleton = true
config :foo => :bar
}
service 'x' {
class AService
singleton true
config :foo => :bar
}
[
[true, 'prop = true'],
[true, 'prop <> false'],
[5, 'prop = 5'],
[5, 'prop > 4'],
[5.5, 'prop = 5.5'],
[5.5, 'prop < 6'],
['string', "prop = 'string'"]
].each do |value, selector|
it "should be able to select with property set to #{value} using selector '#{selector}'" do
def initialize(destination, connection_factory = inject( 'connection-factory' ) )
@name = destination
@connection_factory = ConnectionFactory.new( connection_factory )
end