Skip to content

Instantly share code, notes, and snippets.

(defproject doc-ns "1.0.0-SNAPSHOT"
:description "Writes documentation for a namespace to a text file.
Usage: java -jar doc-ns.jar \"compojure\" \"~/\" \"myfile.txt\""
:dependencies [[org.clojure/clojure
"1.1.0-alpha-SNAPSHOT"]
[org.clojure/clojure-contrib
"1.0-SNAPSHOT"]
[org.clojars.ato/compojure
"0.3.1"]]
:dev-dependencies [[org.clojure/swank-clojure
(ns doc-ns.core
(:gen-class)
[:use clojure.contrib.duck-streams
compojure])
(defn sort-ns
"Sorts the keys from the map returned by ns-publics for a given nspace into alphabetical order."
[nspace]
(sort (keys (ns-publics nspace))))
(ns doc-ns
(:gen-class)
[:use clojure.contrib.duck-streams
compojure])
(defn sort-ns
"Sorts the keys from the map returned by ns-publics for a given nspace into alphabetical order."
[nspace]
(sort (keys (ns-publics nspace))))
@devn
devn / 11*
Created November 30, 2009 05:19
va.lang.NullPointerException
[Thrown class java.lang.RuntimeException]
Restarts:
0: [ABORT] Return to SLIME's top level.
1: [CAUSE] Throw cause of this exception
Backtrace:
0: clojure.lang.LazySeq.sval(LazySeq.java:47)
1: clojure.lang.LazySeq.seq(LazySeq.java:63)
(defn take-tweets [n]
(take n (map read-json
(line-seq (reader
(get-stream))))))
(defn tweet-text [n]
(map #(get % "text")
(take-tweets n)))
(defn search-text [s coll]
@devn
devn / gist:243191
Created November 26, 2009 02:26
This is some rudimentary code to create an http connection to the twitter firehose.
(ns twitjure
(:use clojure.core)
(:use clojure.contrib.http.connection)
(:use clojure.contrib.base64)
(:use clojure.contrib.duck-streams))
(defn get-stream []
(let [conn #^java.net.HttpURLConnection
(http-connection "http://stream.twitter.com/1/statuses/sample.json")]
(.setDoInput conn true)
(defn devin [walters]
(println "yep, it works..."))