Skip to content

Instantly share code, notes, and snippets.

@devn
devn / memo.md
Created February 19, 2014 19:52 — forked from yokolet/memo.md
(defn write-file [filename file]
(with-open [w (clojure.java.io/output-stream filename)]
(.write w (:body file))))
(let [base-uri "http://google.com"
img-path (-> (get-page base-uri)
(first-by-xpath "//img[@alt='Google']")
(comp :src attrs))
img-url (str base-uri img-path)]
(->> (clj-http.client/get img-uri {:as :byte-array
@devn
devn / keybase.md
Created March 24, 2014 17:36
keybase.md

Keybase proof

I hereby claim:

  • I am devn on github.
  • I am devn (https://keybase.io/devn) on keybase.
  • I have a public key whose fingerprint is C1FC 786D C713 AFC5 CE9F 41E8 8233 12B2 4DA1 AA3D

To claim this, I am signing this object:

;;
;; paths
;;
(setq system-uses-terminfo nil)
(add-to-list 'exec-path (expand-file-name "~/bin"))
(add-to-list 'exec-path (expand-file-name "/usr/local/bin"))
(setenv "PATH" (concat (expand-file-name "~/bin")
":/usr/local/bin:"
(defn devin [walters]
(println "yep, it works..."))
@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 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 / 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)
(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))))
(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))))