Skip to content

Instantly share code, notes, and snippets.

@zaphar
zaphar / graph.clj
Created January 16, 2012 21:44 — forked from artdent/graph.clj
Ways by node
(defn collect-ways-by-node [ways]
(reduce (fn [m m2] (merge-with #(concat %1 %2) m1 m2))
(for [way ways]
(for [id (:nodes way)]
(hash-map (:id way) [id])))))
(ns com.freiheit.clojure.appengine.appengine-local
(:use
[compojure.http routes servlet helpers]
clojure.contrib.test-is
compojure.server.jetty
[clojure.contrib def str-utils duck-streams])
(:require
[clojure.contrib.logging :as log])
(:import
[com.google.appengine.api.labs.taskqueue.dev LocalTaskQueue]
;;; all code in this function lifted from the clojure-mode function
;;; from clojure-mode.el
(defun clojure-font-lock-setup ()
(interactive)
(set (make-local-variable 'lisp-indent-function)
'clojure-indent-function)
(set (make-local-variable 'lisp-doc-string-elt-property)
'clojure-doc-string-elt)
(set (make-local-variable 'font-lock-multiline) t)
; minihttpd, tiny barebones clojure web server
; http://alan.xen.prgmr.com/
(ns alandipert.minihttpd
(:use [clojure.contrib.duck-streams :only (reader writer read-lines spit to-byte-array)]
[clojure.contrib.str-utils :only (re-split str-join re-gsub)])
(:import (java.net ServerSocket URLDecoder)
(java.io File)))
(def codes {200 "HTTP/1.0 200 OK"