Skip to content

Instantly share code, notes, and snippets.

@halgari
Created April 28, 2014 15:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halgari/11375663 to your computer and use it in GitHub Desktop.
Save halgari/11375663 to your computer and use it in GitHub Desktop.
(ns quil.cljshttp
(:require-macros [cljs.core.async.macros :refer [go]])
(:refer-clojure :exclude [get])
(:require [cljs-http.client :as http]
[cljs.core.async :refer [<!]]))
(def username (atom "someone"))
(defn get-from-server [login-name]
(go (let [response (<! (http/get "https://api.github.com/users/octocat/gists" {:with-credentials? false\
}))
owner (-> response :body first :owner)]
(.log js/console (:status response))
(.log js/console (clj->js (:login owner)))
(reset! username (:login owner)))))
(go
(.log js/console (clj->js (<! (get-from-server username))))
(.write js/document (str "<p>Hello, " (clj->js (<! (get-from-server (atom "who"))) " </p>"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment