 
 (def link-re #"(([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?")
 
+(defn safe-slurp [s]
+  (when s
+    (try
+      (slurp s)
+      (catch java.io.FileNotFoundException e nil))))
+
+(defn guess-gist-ns [root-path]
+  (->> (file-seq (java.io.File. root-path))
+       (map #(.getAbsolutePath %))
+       (filter #(.endsWith % ".cljs"))
+       first
+       safe-slurp
+       parse-meta
+       :ns))
+
 (defn format-doc [s]
   (when s
     (-> s
         (str/replace link-re (fn [[href & rest]]
                                (str "<a href=\"" href "\">" href "</a>")))
         (str/replace #"\n\n" "<br /><br />"))))
-
-(def compile-cljs comp/compile-cljs)
 
 (defn parse-meta [source]
   (let [forms (read-string (str "[" source "]"))

                   (->> second-half
                        (drop half-take-out)
                        (apply str)))))))

(defn safe-slurp [s]
  (when s
    (try
      (slurp s)
      (catch java.io.FileNotFoundException e nil))))

(defn guess-gist-ns [root-path]
  (->> (file-seq (java.io.File. root-path))
       (map #(.getAbsolutePath %))
       (filter #(.endsWith % ".cljs"))
       first
       safe-slurp
       parse-meta
       :ns))

(defn sketch-page [login gist-id {:keys [doc ns created url user source inky-version]}]
  (let [sketch-url (str "/" login "/" gist-id "/sketch")

  (get @in-progress hash))

(defn html-response [body]
  {:headers {"Content-Type" "text/html; utf-8"}
   :body body})

(defn gist-data [gist-id]
