Created
January 20, 2012 09:00
-
-
Save forsakendaemon/1646223 to your computer and use it in GitHub Desktop.
A Clojure Gist that allows you to load a Gist by id.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;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)))) |
Author
forsakendaemon
commented
Feb 8, 2012
via email
Ah, thanks! I only needed something really simple, for livecoding and
such, though, and must have used too narrow search terms... lol
DAemon
…On 09/02/2012, at 8:11 AM, Anthony Grimes ***@***.*** wrote:
http://github.com/Raynes/tentacles has support for the gist api.
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/1646223
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment