Skip to content

Instantly share code, notes, and snippets.

(ns cljs-app.data
(:require [clojure.string :as string]
[cljs-app.node-bits :as node]
[cljs-app.logging :as log]
[cljs.core.async :as async :refer [<! >!]])
(:require-macros [cljs.core :refer [specify!]]
[cljs-app.macros :refer [when-node]]
[cljs.core.async.macros :refer [go go-loop]]))
;; in a macros clj file:
(defn parse-string
[s]
(h/as-hickory (h/parse s)))
(defn link
[entry]
(-> (s/select (s/tag "link")
entry)
first
:attrs
(defn upload [data owner]
(reify
om/IRender
(render [this]
(html [:div {:class "upload"}
[:form {:enc-type "multipart/form-data"
:ref "fileUpload"
:role "form"
:class "form-inline"}
[:div {:class "form-group"}
(defn upload-form-file [node url method on-success]
(.send goog.net.XhrIo "/log/upload"
(fn [e]
(on-success))
"POST"
(new js/FormData node)))
(defn upload [data owner]
(reify
<gtrak> hey, I figured this might be the place to ask, but do bencode and implementations support an empty-list encoding, like 'le'?
<gtrak> because I have one impl that's producing it (clojure), and another that can't read it correctly (emacs elisp), I didn't write either :-)
--> Exancillatus (~Exancilla@127-29-190-109.dsl.ovh.fr) has joined ##bittorrent
<-- Exancillatus (~Exancilla@127-29-190-109.dsl.ovh.fr) has quit (Ping timeout: 264 seconds)
<-- badon (~badon@pdpc/supporter/active/badon) has quit (Ping timeout: 252 seconds)
<TheSHAD0W> Empty list should be in the spec.
<TheSHAD0W> You may need to fix that lisp implementation.
<gtrak> yea, cool.
<gtrak> I'm guessing null isn't :-)
<gtrak> but I can use empty-list for the relevant logic
java.lang.NullPointerException
at com.google.javascript.jscomp.Compiler.newTracer(Compiler.java:967)
at com.google.javascript.jscomp.Compiler.compile(Compiler.java:605)
at cljs.closure$optimize.doInvoke(closure.clj:577)
at clojure.lang.RestFn.applyTo(RestFn.java:139)
at clojure.core$apply.invoke(core.clj:619)
at cljs.closure$build.invoke(closure.clj:961)
at cemerick.austin$compile_client_js.invoke(austin.clj:342)
at cemerick.austin$create_client_js_file$fn__5644.invoke(austin.clj:359)
at cemerick.austin$create_client_js_file.invoke(austin.clj:359)
@gtrak
gtrak / gist:9349175
Last active August 29, 2015 13:57
deps hack
(defn- compiled-files
[compiler-env]
(->> (for [[path js] (-> compiler-env deref :cljs.compiler/compiled-cljs)]
js)
cljs-deps/dependency-order))
(defn- compile-client-js [opts compiler-env]
(let [;; the options value used as an ifn somewhere in cljs.closure :-/
opts (-> (into {} opts)
;; TODO why isn't the :working-dir option for the brepl env
cljs-tooling.test-complete> (keys (cljs-tooling.util.analysis/ns-vars env 'cljs.core.async))
(t10554 unmix-all alts! ->t10504 ->t10548
->t10545 ->t10501 tap unmix >! random-array nop admix* ->t10542
alt-handler ->t11729 mapcat* split partition-by pub ->t10517 onto-chan
t10514 put! t11449 ->t11449 untap-all* dropping-buffer ->t10514 t10520
t11729 buffer sub pipe close! t10523 muxch* unsub-all* t10517 mix map
filter> t11979 Pub ->t11838 alt-flag take! filter< solo-mode*
unmix-all* fn-handler ->t10554 timeout into map< ->t10523 t11838
t10533 map> t11226 ->t10551 ->t10520 reduce Mix unsub-all ->t12103
unmix* tap* Mux mult untap-all to-chan ->t10539 admix sliding-buffer
;;; JRuby/Clojure fun
(def c (ScriptingContainer. LocalContextScope/SINGLETHREAD LocalVariableBehavior/PERSISTENT))
(defn run
[s]
(. c runScriptlet s))
(def ruby (.getRuntime c))
(defprotocol Conv
(defun cider-help-jump (val)
(let* ((val (car (read-from-string value)))
(file (cadr (assoc "file" val)))
(line (cadr (assoc "line" val))))
(cider-jump-to-def-for
(vector file file line))))