Skip to content

Instantly share code, notes, and snippets.

@cgrand
cgrand / heredoc.clj
Last active March 6, 2021 17:16
An ugly hacky heredoc for Clojure
(defn heredoc []
(let [delim (.readLine *in*)]
(->> (repeatedly #(.readLine *in*))
(take-while #(not= delim %))
(interpose \newline)
(apply str))))
; The following lines are read (by the reader) as:
; "Look )(\"\\T\na here doc!\n"
#=(heredoc)"""
@jmlsf
jmlsf / gist:d691e53e1fea4019a393412f781e2561
Last active September 13, 2021 12:58
(Rough Notes) Importing a javascript module into ClojureScript

Importing a JavaScript Module into ClojureScript

Clojurescript.org Documentation

Documentation for interop is spread all over the place. Under the "Reference" section:

  1. "Dependencies": mostly about how to consume javascript libraries
  2. clojurescript.org: "Packaging Foreign Dependenciees": mostly about how to provide javascript libraries for others to consume
  3. "Advanced Compilation": mostly duplicative, but also describes how to access cljs vars from javascript
  4. "JS Module Support": describes an alpha-quality feature from GCC to allow optimized imports of GCC compatible libraries without using goog.provide
@mfikes
mfikes / comparison.md
Last active October 2, 2015 05:15
Compare embedded JavaScriptCore and Node.js (iojs)

Since an embedded JavaScriptCore can be made to launch quickly, I've been pondering whether it is justified in converting Planck to be a portable (OS X, Linux, Windows) C-based wrapper around JavaScriptCore (so that it is more broadly useful). Right now Planck is not portable owing to the use of Cocoa/Foundation and Objective-C.

I think this partially boils down to wether the launch latency is faster than an equivalent based on Node.js (which is already portable and has a much richer ecosystem). That latency has to be significantly different, and I also think you'd need to be convinced that it is going to remain that way (perhaps V8 will be further optimized, but perhaps the outright launch speed of Node.js isn't a priority).

@d11wtq
d11wtq / docker-ssh-forward.bash
Created January 29, 2014 23:32
How to SSH agent forward into a docker container
docker run -rm -t -i -v $(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK ubuntu /bin/bash