Skip to content

Instantly share code, notes, and snippets.

View slagyr's full-sized avatar

Micah Martin slagyr

  • Clean Coders, LLC
  • Scottsdale, AZ
View GitHub Profile
@slagyr
slagyr / pyfe.py
Created February 27, 2019 02:17
Game of Life in Python
from funcy import mapcat
class Pyfe:
def __init__(self):
self._living_cells = set()
@property
def living_cells(self):
return self._living_cells
@slagyr
slagyr / autumn.js
Last active January 9, 2019 23:44
Autumn code
/**
* Micah's Autumn setup
*/
alert('Running Autumn!');
/**
* Window management
*/
(def sm {:sleeping {:_on-entry [:tracking-0]
:_default [:sleeping]
:start [:taxiing [:start-leg]]
:stop [:sleeping [:cancel-leg]]
:entry [:treading]
:scud [:scudding [:start-leg]]
:cruise [:cruising [:start-leg]]}
:treading {:_on-entry [:tracking-1]
:_default [:treading]
:start [:taxiing [:start-leg]]
@slagyr
slagyr / gist:09e17d505af1bafa22ed
Created June 19, 2015 16:26
cljsbuild stacktrace
(micahmartin) ~/Projects/clojure/speclj
$ lein cljsbuild once dev
Compiling ClojureScript.
clojure.lang.Compiler$CompilerException: java.io.FileNotFoundException: Could not locate cljs/util__init.class or cljs/util.clj on classpath: , compiling:(cljs/closure.clj:1:1)
at clojure.lang.Compiler.load (Compiler.java:7142)
clojure.lang.RT.loadResourceScript (RT.java:370)
clojure.lang.RT.loadResourceScript (RT.java:361)
clojure.lang.RT.load (RT.java:440)
clojure.lang.RT.load (RT.java:411)
clojure.core$load$fn__5066.invoke (core.clj:5641)
(micahmartin) ~/Projects/clojure/speclj
$ lein deps :tree
warn
[clojure-complete "0.2.3" :scope "test" :exclusions [[org.clojure/clojure]]]
[fresh "1.1.1"]
[mmargs "1.2.0"]
[org.clojure/clojure "1.7.0-RC2"]
[org.clojure/clojurescript "0.0-3308"]
[com.google.javascript/closure-compiler "v20150505"]
[args4j "2.0.26"]
@slagyr
slagyr / Application (Java) run configuration
Last active August 29, 2015 14:19
ANSI color example in IntelliJ/Cursive
Name: ansi
Main class: clojure.main
Program arguments: src/clj/ansi.clj
Working directory: <some path to configured project where you put ansi.clj>
@slagyr
slagyr / gist:42c06f51d9faafe2fc58
Last active January 9, 2019 23:44
asyn exceptions
(ns slagyr.async)
(den foo []
(js/setTimeout
(fn [] (throw (js/Error. "foo")))
100))
(try
(foo)
(catch js/Object e
  • Compiler in REPL seems broken: https://gist.github.com/slagyr/7d52ba4ba98e96172456
  • Not interested in Node.js so I skipped all that
  • Development Mode: Okay... this is where I'm confused.
    • The wiki says include 'hello.js'.
    • hello-dev.html explicitely includes goog.base.js.
    • hello-dev.html also requires hello.core.
    • The generated hello.js loads goog.base if it isn't already.
    • out/cljs_deps.js looks like cljsbuild's :output-to file
    • cljbuild doesn't generate anything like sample/hello.js
  • maybe I'll learn about all these difference later in the guide
(micahmartin) ~/Projects/clojure/clojurescript
$ ./script/repljs
To quit, type: :cljs/quit
ClojureScript:cljs.user> (require '[cljs.closure :as cljsc])
clojure.lang.ExceptionInfo: No such namespace: cljs.closure at line 1 <cljs repl> {:tag :cljs/analysis-error, :file "<cljs repl>", :line 1, :column 1}
at clojure.core$ex_info.invoke(core.clj:4403)
at cljs.analyzer$error.invoke(analyzer.clj:307)
at cljs.analyzer$error.invoke(analyzer.clj:304)
at cljs.analyzer$analyze_deps.invoke(analyzer.clj:1117)
at cljs.analyzer$eval1661$fn__1663.invoke(analyzer.clj:1343)
(micahmartin) ~/Projects/clojure/clojurescript
$ ./script/repljs
To quit, type: :cljs/quit
ClojureScript:cljs.user> (str (ex-info "foo" {}))
org.mozilla.javascript.JavaScriptException: TypeError: Cannot call method "cljs$core$IPrintWithWriter$_pr_writer$arity$3" of undefined (<cljs repl>#12)
at <cljs repl>:12
at <cljs repl>:1
ClojureScript:cljs.user>