Skip to content

Instantly share code, notes, and snippets.

View laczoka's full-sized avatar

Laszlo (@laczoka on Twitter) laczoka

View GitHub Profile
@laczoka
laczoka / core.clj
Created November 27, 2012 18:49
Log4j vs. datomic-free
(ns logtest.core
(:use [clojure.tools.logging]
[clojure.tools.logging.impl :only [log4j-factory]]))
(defn foo
"I don't do a whole lot."
[]
(binding [*logger-factory* (log4j-factory)] (info "!")))
@laczoka
laczoka / acm-mai-p1-solution.clj
Created July 11, 2012 20:39
Solution to first puzzle published in the Communications of the ACM May 2012 issue
(ns acmcom-mai-puzzle.alt
(:require [clojure.math.combinatorics :refer [subsets]]
[clojure.set :refer [subset?]]))
(def puzzle-pieces (set (map set (reverse (subsets [:h :v :d1 :d2])))))
(def default-path (range 0 16))
@laczoka
laczoka / snippet.js
Created July 21, 2011 14:31
String.replace
function markMicrodata(str) {
var re = new RegExp('(itemprop="[^"]+")');
alert("!");
var marked = str.replace(re, "{{$1}}");
return marked;
}
// if you place the alert after str.replace it doesn't show up, and the extension silently fails
============== project.clj ================
(defproject sampleweb "1.0.0-SNAPSHOT"
:description "sample application"
:dependencies [[org.clojure/clojure "1.2.0"]
[org.clojure/clojure-contrib "1.2.0"]
[compojure "0.6.0-RC1"]]
:dev-dependencies [[lein-ring "0.2.6"]]
:ring { :handler sampleweb.core/app-routes }
)
============== src/sampleweb/core.clj ======