Skip to content

Instantly share code, notes, and snippets.

View billdozr's full-sized avatar

Alen Ribic billdozr

View GitHub Profile
(defn fizz-buzz
([] (fizz-buzz (range 1 101)))
([lst]
(letfn [(fizz? [n] (zero? (mod n 3)))
(buzz? [n] (zero? (mod n 5)))]
(let [f "Fizz"
b "Buzz"
items (map (fn [n]
(cond (and (fizz? n) (buzz? n)) (str f b)
(fizz? n) f
(defn update-guest [new]
(let [old (fetch-guest-by-invite-code (:invite_code new))
event (fetch-event-by-guest (:invite_code new))]
(update-event
(update-in event
[:guests]
(fn [o n]
(conj (filter
#(not= (:invite_code %) (:invite_code n)) o) n))
new))))
(defun compile-query (q body)
(case (car q)
(and (compile-and (cdr q) body))
(or (compile-or (cdr q) body))
(not (compile-not (cadr q) body))
(lisp `(if ,(cadr q) ,body))
(t (compile-simple q body))))
(defmacro in? [obj & choices]
(let [insym (gensym)]
`(let [~insym ~obj]
(or ~@(map (fn [c] `(= ~insym ~c))
choices)))))
(autoload 'paredit-mode "paredit"
"Minor mode for pseudo-structurally editing Lisp code." t)
(add-hook 'emacs-lisp-mode-hook (lambda () (paredit-mode +1)))
(add-hook 'lisp-mode-hook (lambda () (paredit-mode +1)))
(add-hook 'lisp-interaction-mode-hook (lambda () (paredit-mode +1)))
(put 'scroll-left 'disabled nil)
# MacPorts system wide configuration file
# $Id: macports.conf.in 55280 2009-08-08 02:45:30Z [email protected] $
# Set the directory in which to install ports
prefix /opt/local
# Set the user to run MacPorts compiles, etc as when privileges are dropped during an install
macportsuser root
# Where to store MacPorts working data
DEBUG: Found port in file:///opt/local/var/macports/sources/rsync.macports.org/release/ports/devel/omake
DEBUG: Changing to port directory: /opt/local/var/macports/sources/rsync.macports.org/release/ports/devel/omake
DEBUG: OS Platform: darwin
DEBUG: OS Version: 10.0.0
DEBUG: Mac OS X Version: 10.6
DEBUG: System Arch: i386
DEBUG: setting option os.universal_supported to yes
DEBUG: org.macports.load registered provides 'load', a pre-existing procedure. Target override will not be provided
DEBUG: org.macports.unload registered provides 'unload', a pre-existing procedure. Target override will not be provided
DEBUG: org.macports.distfiles registered provides 'distfiles', a pre-existing procedure. Target override will not be provided
$ sudo port install omake
---> Computing dependencies for omake
---> Fetching ocaml
---> Verifying checksum(s) for ocaml
---> Extracting ocaml
---> Applying patches to ocaml
---> Configuring ocaml
---> Building ocaml
---> Staging ocaml into destroot
---> Installing ocaml @3.11.1_2
diff --git a/src/compojure/http/middleware.clj b/src/compojure/http/middleware.clj
index eb0c276..b79e544 100644
--- a/src/compojure/http/middleware.clj
+++ b/src/compojure/http/middleware.clj
@@ -32,9 +32,9 @@
existing headers."
[handler headers]
(fn [request]
- (let [response (handler request)
- merged-headers (merge (:headers response) headers)]
(defn test-create-label [request]
(let [spring-ctx
(WebApplicationContextUtils/getWebApplicationContext (request :servlet-context))
label-dao (.getBean spring-ctx "labelDao")
new-label (Label.)]
(doto new-label
(.setName "Label 1")
(.setDescription "testing"))
(.create label-dao new-label)
(.read label-dao (.getId new-label))))