Doctor Evidence
Pitch
import { tags, styleTags, defaultHighlightStyle } from "@codemirror/highlight"; | |
import { LezerLanguage } from "@codemirror/language"; | |
import { EditorState } from "@codemirror/state"; | |
import { EditorView } from "@codemirror/view"; | |
import { parser } from "lezer-clojure"; | |
let style = { | |
DefLike: tags.keyword, | |
"Operator/Symbol": tags.keyword, | |
"VarName/Symbol": tags.definition(tags.variableName), |
(ns analyze.core | |
(:require [clj-kondo.core :as clj-kondo] | |
[clojure.set :as set])) | |
;; checks re-frame's :<- syntax | |
;; to mark dependency subscriptions as used | |
(def analyze-reg-sub | |
"(require '[clj-kondo.hooks-api :as api]) | |
(fn [{node :node}] | |
(let [[_ kw & children] (:children node) |
# install with brew reinstall --build-from-source ./gh-releases.rb | |
# set GITHUB_TOKEN to a personal Github token | |
# then run: gh-releases list :org babashka :repo :babashka | |
class GhReleases < Formula | |
desc "" | |
homepage "" | |
license "" | |
url "file:///dev/null" | |
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" |
(ns vendor-deps | |
(:require | |
[babashka.classpath :as cp] | |
[babashka.deps :as deps] | |
[babashka.fs :as fs] | |
[clojure.string :as str]) | |
(:import [java.nio.file Files])) | |
(defn unzip [{:keys [^java.io.File zip-file | |
^java.io.File destination-dir]}] |
{:tasks | |
{:requires ([babashka.deps :as deps] | |
[babashka.process :refer [tokenize]] | |
[clojure.edn :as edn] | |
[clojure.java.io :as io]) | |
:init | |
(do | |
(def prepl | |
(delay | |
(do |
var counter = 0; | |
async function randomSleep() { | |
return new Promise(r => setTimeout(r, Math.random() * 100)); | |
} | |
async function doSomething() { | |
await randomSleep(); | |
counter++; | |
await randomSleep(); |
This shows how to require ES modules in a node script which is itself compiled as an ES module by shadow. I made this to verify if nbb's way of requiring ES modules aligns with other tools that accomplish the same using the CLJS compiler.
Build with npx shadow-cljs compile script
.
Run with node out/script.js
. It will print something like:
#js {:columns 202, :rows 45}
[Function: Spinner]
(ns spacedl.spacedl | |
(:require [clojure.string :as string :refer [join starts-with?]])) | |
(.on js/process "uncaughtException" #(js/console.error %)) | |
(defonce http (js/require "http")) | |
(defonce https (js/require "https")) | |
(defonce fs (js/require "fs")) | |
(defn page [gallery-url page-number] |
;; This code works with https://github.com/borkdude/nbb | |
(ns plet | |
{:clj-kondo/config '{:lint-as {plet/plet clojure.core/let}}} | |
(:require ["https" :as https])) | |
(defmacro plet | |
"See https://gitlab.com/clj-editors/repl-tooling/blob/b4962dd39b84d60cbd087a96ba6fccb1bffd0bd6/src/repl_tooling/editor_integration/interpreter.cljs#L26" | |
[bindings & body] | |
(let [binding-pairs (reverse (partition 2 bindings)) |