Skip to content

Instantly share code, notes, and snippets.

View mfikes's full-sized avatar

Mike Fikes mfikes

View GitHub Profile
@mfikes
mfikes / emitted-2.md
Created April 3, 2015 02:20
emitted vars
(defn print-foo [fb]
 (let [f (case fb
           :foo #'foo
           :bar #'bar)]
   (apply f [])))
(function (){try{return cljs.core.pr_str.call(null,(function (){var ret__4021__auto__ = cljs.user.print_foo = (function cljs$user$print_foo(fb){
@mfikes
mfikes / core.js
Created April 3, 2015 14:59
hello_world
// Compiled by ClojureScript 0.0-3169 {}
goog.provide('hello_world.core');
goog.require('cljs.core');
goog.require('clojure.browser.repl');
if(typeof hello_world.core.conn !== 'undefined'){
} else {
hello_world.core.conn = clojure.browser.repl.connect.call(null,"http://localhost:9000/repl");
}
cljs.core.enable_console_print_BANG_.call(null);
cljs.core.println.call(null,"Hello world!");
Exception in thread "Thread-3" java.lang.NullPointerException
at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:26)
at cljs.repl.server$read_request.invoke(server.clj:95)
at cljs.repl.server$handle_connection.invoke(server.clj:153)
at cljs.repl.server$server_loop$fn__4213.invoke(server.clj:164)
at clojure.core$binding_conveyor_fn$fn__4145.invoke(core.clj:1910)
at clojure.lang.AFn.run(AFn.java:22)
at java.lang.Thread.run(Thread.java:745)
@mfikes
mfikes / repl.clj
Created April 3, 2015 15:08
repl.clj
(require 'cljs.repl)
(require 'cljs.closure)
(require 'cljs.repl.browser)
(cljs.closure/build "src"
{:main 'hello-world.core
:output-to "out/main.js"
:verbose true})
(cljs.repl/repl (cljs.repl.browser/repl-env)
Reading analysis cache for jar:file:/Users/mfikes/Desktop/hello_world/cljs.jar!/cljs/core.cljs
Compiling src/hello_world/core.cljs
Analyzing jar:file:/Users/mfikes/Desktop/hello_world/cljs.jar!/clojure/browser/repl.cljs
Analyzing jar:file:/Users/mfikes/Desktop/hello_world/cljs.jar!/clojure/browser/net.cljs
Analyzing jar:file:/Users/mfikes/Desktop/hello_world/cljs.jar!/clojure/browser/event.cljs
Analyzing jar:file:/Users/mfikes/Desktop/hello_world/cljs.jar!/cljs/repl.cljs
Compiling out/cljs/core.cljs
Using cached cljs.core out/cljs/core.cljs
Compiling out/clojure/browser/repl.cljs
Compiling out/clojure/browser/event.cljs
@mfikes
mfikes / emitted.md
Created April 3, 2015 16:53
Emitted JavaScript for var expressions

For the following at the REPL:

(defn print-foo [fb]
  (apply (case fb
            :foo #'foo
            :bar #'bar) []))

This was emitted previously:

@mfikes
mfikes / cljs-repl.md
Last active August 29, 2015 14:19
Simple CLJS REPL

Make a project.clj file in a directory, specifying the version of ClojureScript you'd like to run:

(defproject cljs-repl "0.1.0"
  :dependencies [[org.clojure/clojurescript "0.0-3196"]])

Then start up a Node REPL by

@mfikes
mfikes / himera-update.md
Last active August 29, 2015 14:19
New functions and macros in Himera

In addition to reader conditionals (#?(:cljs "ClojureScript" :clj "Clojure")), it looks like it has almost 150 new functions and macros available:

array-map
as->
assoc! 
bit-count 
bit-shift-right-zero-fill 
booleans 
@mfikes
mfikes / nashorn.txt
Created April 19, 2015 18:51
Nashorn unit test failures
orion:clojurescript mfikes$ pwd
/Users/mfikes/Documents/Projects/clojurescript
orion:clojurescript mfikes$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
orion:clojurescript mfikes$ `which jjs`
orion:clojurescript mfikes$ export NASHORN_HOME=$JAVA_HOME/bin
orion:clojurescript mfikes$ script/test
Analyzing file:/Users/mfikes/Documents/Projects/clojurescript/src/cljs/cljs/core.cljs
Compiling test/hello.cljs
WARNING: hello is a single segment namespace at line 1 test/hello.cljs
@mfikes
mfikes / nashlin.txt
Created April 19, 2015 20:21
Nashorn in Linode
orion:~ mfikes$ ssh [email protected]
The authenticity of host '45.33.88.132 (45.33.88.132)' can't be established.
RSA key fingerprint is e2:b4:90:52:22:49:dc:7f:2e:0c:89:9f:20:81:ba:b6.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '45.33.88.132' (RSA) to the list of known hosts.
[email protected]'s password:
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.19.1-x86_64-linode53 x86_64)
* Documentation: https://help.ubuntu.com/