Skip to content

Instantly share code, notes, and snippets.

View oakmac's full-sized avatar

Chris Oakman oakmac

View GitHub Profile
@oakmac
oakmac / changes.diff
Created October 21, 2024 14:19
Standard Clojure Style v0.10.0 on Wolframite
diff --git a/src/wolframite/api/v1.clj b/src/wolframite/api/v1.clj
index 1ba746a..f8c2754 100644
--- a/src/wolframite/api/v1.clj
+++ b/src/wolframite/api/v1.clj
@@ -1,7 +1,8 @@
(ns wolframite.api.v1
(:refer-clojure :exclude [eval])
- (:require [wolframite.core :as core]
- [wolframite.lib.helpers :as helper]))
+ (:require
@oakmac
oakmac / convert-formatted.clj
Created October 6, 2024 16:38
wolframite.base.convert formatted with Standard Clojure Style v0.5.0
(ns wolframite.base.convert
"Convert a Clojure expression into a Wolfram JLink expression"
(:require
[wolframite.base.expr :as expr]
[wolframite.base.express :as express]
[wolframite.impl.jlink-instance :as jlink-instance]
[wolframite.impl.protocols :as proto]
[wolframite.impl.wolfram-syms.intern :as intern]
[wolframite.lib.options :as options]
[wolframite.runtime.defaults :as defaults]))
@oakmac
oakmac / test-failures.txt
Created June 10, 2023 23:17
humanize test failures
➜ humanize git:(hls/31-move-to-java-time) ✗ clj -M:cljs-test
Testing clj-commons.cljc-test
Testing clj-commons.humanize-test
FAIL in (filesize-test) (:)
expected: (= "3.005MB" (f 3005000 nil "%.3f"))
actual: (not (= "3.005MB" "3.0MB"))
@oakmac
oakmac / random_date.clj
Last active August 13, 2021 06:33
find random date between two ranges in Clojure
;; question: i want to generate a random date between 2018 and 2020. how can i do it in clojure?
(require [java-time :as jt])
(defn date-range
"returns a sequences of dates between start and end (exclusive)"
[start-date end-date]
(let [dates-from-start (jt/iterate jt/plus start-date (jt/days 1))]
(take-while #(jt/before? % end-date) dates-from-start)))
@oakmac
oakmac / crunker-interop.cljs
Last active April 9, 2021 02:06
Crunker.js to ClojureScript Interop Example
;; this is a ClojureScript interop example I put together for a student in
;; the Professional ClojureScript course (https://cljs.pro)
(defn fetch-and-merge-files
"Fetches two mp3 files and merges them using the Crunker.js library.
Returns a JavaScript Promise object."
[file1 file2]
(let [js-crunker (new Crunker)]
(-> js-crunker
(.fetchAudio file1 file2)
@oakmac
oakmac / dom.cljs
Last active March 31, 2021 00:43
dom helpers functions
;; this code licensed as CC0 1.0 Universal (SPDX: CC0-1.0)
(ns ^{:doc "DOM helpers"
:author "Chris Oakman"}
com.oakmac.some-project.util.dom
(:require
[goog.dom :as gdom]
[goog.dom.forms :as gforms]))
;; TODO: this could be variadic with some options
@oakmac
oakmac / parinfer-smart-mode-thoughts.md
Last active February 21, 2021 15:17
Parinfer Smart Mode Thoughts

Parinfer Smart Mode Thoughts

21 Feb 2021 - I woke up this morning with these thoughts about Parinfer and wanted to document them.

Smart Mode is a nice enhancement on top of Indent Mode, but many editor APIs do not support the "buffer change" information needed to make Smart Mode work correctly.

What if instead of passing in any buffer change to Smart Mode, we only run Smart Mode on the following keystrokes:

  • space bar
@oakmac
oakmac / deps.edn
Created December 3, 2020 17:47
skija deps.edn
{:deps {
; org.jetbrains.skija/skija-native {:mvn/version "0.0.0-SNAPSHOT"}
org.jetbrains.skija/skija-linux {:mvn/version "0.6.21"}
org.lwjgl/lwjgl {:mvn/version "3.2.3"}
org.lwjgl/lwjgl$natives-macos {:mvn/version "3.2.3"}
org.lwjgl/lwjgl-glfw {:mvn/version "3.2.3"}
org.lwjgl/lwjgl-glfw$natives-macos {:mvn/version "3.2.3"}
org.lwjgl/lwjgl-opengl {:mvn/version "3.2.3"}
org.lwjgl/lwjgl-opengl$natives-macos {:mvn/version "3.2.3"}
nrepl/nrepl {:mvn/version "0.8.3"}}
@oakmac
oakmac / clojure-10182201394873438874.edn
Created December 3, 2020 04:38
skija Clojure Example error
{:clojure.main/message
"Execution error (UnsatisfiedLinkError) at org.lwjgl.system.Library/loadSystem (Library.java:162).\nFailed to locate library: liblwjgl.so\n",
:clojure.main/triage
{:clojure.error/class java.lang.UnsatisfiedLinkError,
:clojure.error/line 162,
:clojure.error/cause "Failed to locate library: liblwjgl.so",
:clojure.error/symbol org.lwjgl.system.Library/loadSystem,
:clojure.error/source "Library.java",
:clojure.error/phase :execution},
:clojure.main/trace
@oakmac
oakmac / cljs-follow-up-questions.md
Last active October 6, 2020 04:03
ClojureScript Questions Follow-Up

ClojureScript Follow Up Questions + Answers

Some follow-up questions and answers from this gist. -- C. Oakman, 05 Oct 2020


when I said CDN/server I meant are you keeping the compiled javascript artifacts in your UI server OR do you keep them on something like S3 and then