Skip to content

Instantly share code, notes, and snippets.

View sgrove's full-sized avatar
💭
Infinigraph, and beyond!

Sean Grove sgrove

💭
Infinigraph, and beyond!
View GitHub Profile
@sgrove
sgrove / curl->clj.clj
Last active August 18, 2021 14:27
Convert Chrome's `copy-as-curl` to clj-http calls
(defn curl->clj*
"Given a (single) curl string from Chrome's copy-as-curl, convert it either
into a clj-http call, a task-based http entry, or a shortened
task-based entry"
([curl-str]
(curl->clj* curl-str {}))
([curl-str conv-opts]
(let [clean-opts (:clean conv-opts)
merge-opts (:merge conv-opts)
headers (->
@sgrove
sgrove / Test.re
Last active December 9, 2016 18:37
/**
* Welcome to Reason.
*/
open Lwt;
open Cohttp;
open Cohttp_lwt_unix;
let body =
@sgrove
sgrove / console.re
Created December 8, 2016 17:20
Example Reason+Bucklescript bindings
external log : 'anything => unit = "console.log" [@@bs.val];
external trace : 'anything => unit = "console.trace" [@@bs.val];
@sgrove
sgrove / build
Created September 10, 2015 17:48
$ lein cljsbuild once pseudo
Compiling ClojureScript.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/s/.m2/repository/ch/qos/logback/logback-classic/1.1.2/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/s/.m2/repository/org/slf4j/slf4j-log4j12/1.6.2/slf4j-log4j12-1.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
10:34:17.824 [main] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider
10:34:18.666 [main] DEBUG com.amazonaws.AmazonWebServiceClient - Internal logging succesfully configured to commons logger: true
10:34:18.813 [main] DEBUG com.amazonaws.metrics.AwsSdkMetrics - Admin mbean registered under com.amazonaws.management:type=AwsSdkMetrics
10:34:19.620 [main] DEBUG c.a.internal.config.InternalConfig - Configuration override awssdk_config_override.json not found.
@sgrove
sgrove / example.clj
Created September 10, 2015 15:33
cljs + webpack interop sketch
;; Example config
:libs [;; Provides is what you would (:require [ReactMotion :as rm
;; and ends up as exports.ReactMotion
{:provides ["ReactMotion"]
:native-name ["react-motion"]
:preprocess :webpack
:webpack-options {. .}}
{:provides ["React"]
:native-name ["react"]
:preprocess :webpack
@sgrove
sgrove / core.cljs
Created September 9, 2015 16:40
ReactMotion + ClojureScript
(ns motionable.core
(:require [om.core :as om]
[om.dom :as dom]
[React :as r :refer [createElement createClass render]]
[ReactMotion :as rm]))
(enable-console-print!)
(def app-state
(atom {:text "Hello world!"}))
@sgrove
sgrove / clj-handle-alt-and-case.cljs
Created July 27, 2015 20:26
align-cljlet support for case and alt!
diff --git a/elpa/align-cljlet-0.3/align-cljlet.el b/elpa/align-cljlet-0.3/align-cljlet.el
index 072d19a..e105dc1 100644
--- a/elpa/align-cljlet-0.3/align-cljlet.el
+++ b/elpa/align-cljlet-0.3/align-cljlet.el
@@ -98,6 +98,8 @@
(string-match " *cond" name)
(string-match " *condp" name)
(string-match " *defroutes" name)
+ (string-match " *case" name)
+ (string-match " *alt" name)
$ rm -rf ~/.m2/repository/org/clojure/clojurescript/0.0-2411; rm -rf resources/public/js/bin-debug/; rm -rf resources/public/js/out/; lein clean; lein cljsbuild once dev
Compiling ClojureScript.
Retrieving org/clojure/clojurescript/0.0-2411/clojurescript-0.0-2411.jar from central
Compiling "resources/public/js/bin-debug/main.js" from ["src/cljs"]...
WARNING: Wrong number of args (1) passed to UUID at line 561 file:/Users/s/.m2/repository/org/clojure/clojurescript/0.0-2411/clojurescript-0.0-2411.jar!/cljs/reader.cljs
WARNING: Use of undeclared Var clojure.browser.repl/bootstrap at line 86 file:/Users/s/.m2/repository/weasel/weasel/0.7.0-SNAPSHOT/weasel-0.7.0-SNAPSHOT.jar!/weasel/repl.cljs
WARNING: Use of undeclared Var clojure.browser.repl/bootstrap at line 86 resources/public/js/bin-debug/weasel/repl.cljs
WARNING: Wrong number of args (1) passed to UUID at line 561 resources/public/js/bin-debug/cljs/reader.cljs
Successfully compiled "resources/public/js/bin-debug/main.js" in 6.157 seconds.
@sgrove
sgrove / test_01.cljs
Created June 17, 2015 22:15
Basic GD vertices test
(ns gampg.perf.test-01
(:require [gamma.api :as g]
[gamma.program :as p]
[gamma-driver.api :as gd]
[gamma-driver.drivers.basic :as driver]
[thi.ng.geom.core :as geom]
[thi.ng.geom.core.matrix :as mat :refer [M44]]))
(def title
"1. Testing basic performance")
@sgrove
sgrove / buffferSubDataSuccess.cljs
Created June 16, 2015 21:04
bufferSubData Success!
(defn tick
"Takes the old world value and produces a new world value, suitable
for rendering"
[state time]
;; We get the elapsed time since the last render to compensate for
;; lag, etc.
(let [time-now (.getTime (js/Date.))
elapsed (- time-now (:last-rendered state))
pyramid-diff (/ (* 50 elapsed) 100000)
cube-diff (/ (* 75 elapsed) 100000)