Skip to content

Instantly share code, notes, and snippets.

<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 ([email protected]) has joined ##bittorrent
<-- Exancillatus ([email protected]) 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))))
cljs-complete.core-test> (clojure.pprint/pprint ('chan (cc/ns-vars (test-env) 'cljs.core.async)))
{:arglists '([] [buf-or-n]),
:name cljs.core.async/chan,
:protocol-impl nil,
:max-fixed-arity 1,
:methods
({:tag cljs.core.async.impl.channels/ManyToManyChannel,
:variadic false,
:max-fixed-arity 0}
{:tag cljs.core.async.impl.channels/ManyToManyChannel,
@gtrak
gtrak / gist:7897543
Last active December 30, 2015 22:59
Every individual is at once the beneficiary and the victim of the linguistic tradition
into which he has been born — the beneficiary inasmuch as language gives access to the
accumulated records of other people's experience, the victim in so far as it confirms him
in the belief that reduced awareness is the only awareness and as it bedevils his sense
of reality, so that he is all too apt to take his concepts for data, his words for actual
things.
- Aldous Huxley, in The Doors of Perception (1954)
@gtrak
gtrak / EDN.txt
Last active April 9, 2018 06:59
EDN Resources
Obligatory Philosophical Rich Hickey talk about systems-level IPC and data formats
http://www.youtube.com/watch?v=ROor6_NGIWU
* EDN
EDN Spec and Rationale:
https://github.com/edn-format/edn
(ns playingwithmacros.core
(:require [clojure.java.browse :refer [browse-url]]
[clojure.pprint :as pp]
[clojure.core.strint :as strint]))
(defmacro my-simple-macro
"A docstring"
[first-arg second-arg & varargs]
"A return value of some kind")