Skip to content

Instantly share code, notes, and snippets.

@forsakendaemon
Created January 20, 2012 09:00
Show Gist options
  • Select an option

  • Save forsakendaemon/1646223 to your computer and use it in GitHub Desktop.

Select an option

Save forsakendaemon/1646223 to your computer and use it in GitHub Desktop.
A Clojure Gist that allows you to load a Gist by id.
;requires clj-http (https://github.com/dakrone/clj-http) and clojure.data.json (https://github.com/clojure/data.json) to be available
(require '[clj-http.client :as client] '[clojure.data.json :only (read-json) :as json])
(defn getfiles [id] (get (json/read-json (get (client/get (str "https://api.github.com/gists/" id)) :body)) :files))
(defn getcontent [files] (get (get files (first (keys files))) :content))
(defn loadgist [id] (load-string (getcontent (getfiles id))))
@Raynes
Copy link
Copy Markdown

Raynes commented Feb 8, 2012

http://github.com/Raynes/tentacles has support for the gist api.

@forsakendaemon
Copy link
Copy Markdown
Author

forsakendaemon commented Feb 8, 2012 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment