Skip to content

Instantly share code, notes, and snippets.

View mfikes's full-sized avatar

Mike Fikes mfikes

View GitHub Profile
(defn jsc-eval
"Evaluate a JavaScript string in the JSC REPL process."
[repl-env js]
(let [in @(:in repl-env)
out @(:out repl-env)]
(write out js)
(let [result "success" #_(read-response in)]
{:status :success
:value (:value 1)})))
@mfikes
mfikes / gist:c4669e6ba617e2eedadd
Created February 12, 2015 16:01
Custom stack trace printing in Ambly
Default impl:
ClojureScript:cljs.user> (hello-ambly.core/test-exception-one)
Error: 1 is not ISeqable
cljs.core/seq (out/cljs/core.cljs:727:13)
cljs.core/first (out/cljs/core.cljs:736:7)
cljs.core/ffirst (out/cljs/core.cljs:1155:3)
hello-ambly.core/test-exception-two (out/hello_ambly/core.cljs:16:3)
hello-ambly.core/test-exception-one (out/hello_ambly/core.cljs:19:3)
@mfikes
mfikes / path
Created February 13, 2015 20:00
iOS stack path
ClojureScript:cljs.user> (first (js/Date.))
Error: Fri Feb 13 2015 14:58:06 GMT-0500 (EST) is not ISeqable
seq (/private/var/mobile/Containers/Data/Application/A3C9B969-ADB6-435A-967E-EB79E858CF23/Documents/cljs/core.js:4212:17)
first (/private/var/mobile/Containers/Data/Application/A3C9B969-ADB6-435A-967E-EB79E858CF23/Documents/cljs/core.js:4242:22)
nil
@mfikes
mfikes / foo.md
Last active August 29, 2015 14:15
iOS stack traces take 2

I edited some local source at /Users/mfikes/Documents/Projects/hello-ambly/src/hello_ambly/core.cljs

(ns hello-ambly.core)

(defn i-m-gonna-throw [] 
  (ffirst 1))

(defn make-my-day []
  (i-m-gonna-throw))
@mfikes
mfikes / watch.clj
Created February 13, 2015 21:20
watch
(repl/repl* (jsc/repl-env)
{:output-dir "out"
:watch "out"
:cache-analysis true
:source-map true})
(repl/repl* (jsc/repl-env)
{:output-dir "out"
:watch "/Users/mfikes/Documents/Projects/hello-ambly/src"
:cache-analysis true
@mfikes
mfikes / autoconf.txt
Created February 16, 2015 22:23
Ambly AutoConf working for the first time
# No UI yet to let user pick if there are multiple
# devices or a simulator discovered, so it is picking
# the first on behalf of the user.
orion:Clojure mfikes$ ./script/jscrepljs
To quit, type: :cljs/quit
Connecting to Mike's iPod touch
ClojureScript:cljs.user> (+ 3 4)
7
ClojureScript:cljs.user>
@mfikes
mfikes / printing.md
Last active August 29, 2015 14:15
Printing

If Ambly honors the default of :print being println then this sample below would be the behavior. Perhaps this is a non-issue because Ambly startup can override this default so that :print is print.

(As an aside, flush is often only needed in combination with print, as oftentimes streams will flush on newlines.)

ClojureScript:cljs.user> (print "Hi")
Hi
nil
ClojureScript:cljs.user> (println "Hi")
Hi
@mfikes
mfikes / shrimp.md
Created February 23, 2015 18:21
shrimp on master

This is a test with the current masters of ClojureScript, Weasel, Piggieback and simple-brepl of the example sequence at https://github.com/mfikes/shrimp

I made a slight modificaiton to the example sequence to (require 'shrimp.detail-view-controller) here so that symbols in that namespace are available in Weasel.

The error about "cljs.user" being already declared is perhaps a minor concern.

user=> (simple-brepl)
<< Started Weasel server on ws://127.0.0.1:9001 >>
Type `:cljs/quit` to stop the ClojureScript REPL
@mfikes
mfikes / stacks.md
Created March 4, 2015 00:49
REPL-defined functions

First test. Looks good:

ClojureScript:shrimp.detail-view-controller> (my-call)
Error: 1 is not ISeqable
	 cljs.core/seq (jar:file:/Users/mfikes/.m2/repository/org/clojure/clojurescript/0.0-2974/clojurescript-0.0-2974.jar!/cljs/core.cljs:731:13)
	 cljs.core/first (jar:file:/Users/mfikes/.m2/repository/org/clojure/clojurescript/0.0-2974/clojurescript-0.0-2974.jar!/cljs/core.cljs:740:7)
	 cljs.core/ffirst (jar:file:/Users/mfikes/.m2/repository/org/clojure/clojurescript/0.0-2974/clojurescript-0.0-2974.jar!/cljs/core.cljs:1159:3)
	 shrimp.detail-view-controller/throw-down (file:/Users/mfikes/Documents/Projects/shrimp/ClojureScript/src/shrimp/detail_view_controller.cljs:10:3)
	 shrimp.detail-view-controller/call-throw-down (file:/Users/mfikes/Documents/Projects/shrimp/ClojureScript/src/shrimp/detail_view_controller.cljs:13:3)
@mfikes
mfikes / uberjar
Created March 6, 2015 02:16
uberjar
Mike-Fikess-MacBook-Pro:clojurescript mfikes$ script/uberjar
++ git --no-replace-objects describe --match v0.0
+ REVISION=v0.0-3002-g195b254
+ REVISION=3002-g195b254
+ REVISION=3002
++ mktemp /tmp/compiler.clj.XXXXXXXXXXX
+ COMP_FILE=/tmp/compiler.clj.TFJAWu0Gx3G
+ sed -e 's/^.def ^:dynamic \*clojurescript-version\*.*$/(def ^:dynamic *clojurescript-version* {:major 0, :minor 0, :qualifier 3002})/' src/clj/cljs/util.clj
+ mv /tmp/compiler.clj.TFJAWu0Gx3G src/clj/cljs/util.clj
++ mktemp /tmp/core.cljs.XXXXXXXXXXX