Skip to content

Instantly share code, notes, and snippets.

View mfikes's full-sized avatar

Mike Fikes mfikes

View GitHub Profile
@mfikes
mfikes / nashvol.txt
Created April 20, 2015 18:57
Nashorn volatiles in terms of atoms
$ git diff
diff --git a/src/cljs/cljs/core.cljs b/src/cljs/cljs/core.cljs
index 2794acc..4f69f06 100644
--- a/src/cljs/cljs/core.cljs
+++ b/src/cljs/cljs/core.cljs
@@ -3882,18 +3882,18 @@ reduces them without incurring seq initialization"
[iref]
(.-validator iref))
-(deftype Volatile [^:mutable state]
@mfikes
mfikes / nashpad.txt
Last active August 29, 2015 14:19
Nashorn volatiles "like" atoms
$ git diff
diff --git a/src/cljs/cljs/core.cljs b/src/cljs/cljs/core.cljs
index 2794acc..8f15796 100644
--- a/src/cljs/cljs/core.cljs
+++ b/src/cljs/cljs/core.cljs
@@ -3882,7 +3882,7 @@ reduces them without incurring seq initialization"
[iref]
(.-validator iref))
-(deftype Volatile [^:mutable state]
@mfikes
mfikes / bensu2.js
Created April 21, 2015 21:13
Smaller
cljs = {};
cljs.core = {};
cljs.core._deref = function cljs$core$_deref(o) {
if (o.cljs$core$IDeref$_deref$arity$1 != undefined) {
return o.cljs$core$IDeref$_deref$arity$1(o);
} else {
throw Error(["No protocol method IDeref defined for type :", o].join(""));
}
};
Testing with Nashorn
Exception in thread "main" java.lang.AssertionError: Failed generating bytecode for builds/out-adv/core-advanced-test.js:11659
at jdk.nashorn.internal.codegen.CompilationPhase$13.transform(CompilationPhase.java:486)
at jdk.nashorn.internal.codegen.CompilationPhase.apply(CompilationPhase.java:728)
at jdk.nashorn.internal.codegen.Compiler.compile(Compiler.java:620)
at jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.compileTypeSpecialization(RecompilableScriptFunctionData.java:512)
at jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.getBest(RecompilableScriptFunctionData.java:729)
at jdk.nashorn.internal.runtime.ScriptFunctionData.getBestConstructor(ScriptFunctionData.java:243)
at jdk.nashorn.internal.runtime.ScriptFunction.findNewMethod(ScriptFunction.java:480)
at jdk.nashorn.internal.runtime.ScriptObject.lookup(ScriptObject.java:1878)
@mfikes
mfikes / bytecode.txt
Created April 22, 2015 11:27
Nashorn 8u60 b11
Exception in thread "main" java.lang.AssertionError: Failed generating bytecode for builds/out-adv/core-advanced-test.js:3720
at jdk.nashorn.internal.codegen.CompilationPhase$13.transform(CompilationPhase.java:486)
at jdk.nashorn.internal.codegen.CompilationPhase.apply(CompilationPhase.java:728)
at jdk.nashorn.internal.codegen.Compiler.compile(Compiler.java:620)
at jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.compileTypeSpecialization(RecompilableScriptFunctionData.java:512)
at jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.getBest(RecompilableScriptFunctionData.java:729)
at jdk.nashorn.internal.runtime.ScriptFunctionData.getBestConstructor(ScriptFunctionData.java:243)
at jdk.nashorn.internal.runtime.ScriptFunction.findNewMethod(ScriptFunction.java:480)
at jdk.nashorn.internal.runtime.ScriptObject.lookup(ScriptObject.java:1878)
at jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:100)
@mfikes
mfikes / min.js
Last active August 29, 2015 14:19
Nashhorn Failed generating bytecode 8u60 b11
! function() {
function t(t, i) {
for (var $ = !0, r = t.length - 1; r >= 0; r--) {
$ && e == i
}
}
function i(i) {
return r = new t(0)
} {
i(0)
@mfikes
mfikes / Compare.md
Created April 23, 2015 17:47
Compare perf of two ways to remove an element from vector by index
(defn remove-idx [coll idx] 
  (into (subvec coll 0 idx) (subvec coll (inc idx))))
(defn remove-idx' [coll idx] 
  (vec (concat (subvec coll 0 idx) (subvec coll (inc idx)))))
@mfikes
mfikes / AppDelegate.m
Created April 24, 2015 23:00
My copy
/**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
@mfikes
mfikes / ad.m
Created April 25, 2015 03:43
current ad
/**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
This file has been truncated, but you can view the full file.
$ bin/ios-sim
Titanium Command-Line Interface, CLI version 3.4.2, Titanium SDK version 3.5.1.GA
Copyright (c) 2012-2015, Appcelerator, Inc. All Rights Reserved.
Please report bugs to http://jira.appcelerator.org/
Tue Apr 28 2015 19:40:57 GMT-0400 (EDT)
Operating System
Name = Mac OS X