Skip to content

Instantly share code, notes, and snippets.


Michiel Borkent borkdude

View GitHub Profile
borkdude /
Last active Aug 4, 2022
Shadow CLJS require ES Module in script

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]
borkdude / cli_app.clj
Last active Aug 3, 2022
babashka.cli args->opts
View cli_app.clj
(ns cli-app
(:require [babashka.cli :as cli]))
(def spec {:hello {:desc "something"}
:foo {:desc "foo"}
:bar {:desc "bar"
:coerce []}})
(def cli-opts {:spec spec
:args->opts (cons :foo (repeat :bar))})
borkdude / gallery.cljs
Last active Aug 2, 2022 — forked from yogthos/gallery.cljs
script to download walpapers from, adapted for nbb
View gallery.cljs
borkdude / pw.clj
Created Aug 1, 2022
Playwright browser + bb chrome devtools
View pw.clj
;; run npx playwright install to install a browser
(require '[babashka.deps :as deps])
'{:deps {tatut/devtools {:git/url ""
:git/sha "cc96255433ca406aaba8bcee17d0d0b3b16dc423"}
org.babashka/spec.alpha {:git/url ""
:git/sha "1a841c4cc1d4f6dab7505a98ed2d532dd9d56b78"}}})
borkdude / new
Last active Jul 23, 2022
Create clojure project with babashka using deps-new
View new
#!/usr/bin/env bb
(require '[babashka.classpath :as cp]
'[babashka.deps :as deps])
(deps/add-deps '{:deps {org.corfield/deps-new {:git/url ""
:git/sha "76259a27c57dba4530671a3d18c610ed904297d7"}
org.babashka/cli {:mvn/version "0.3.31"}
org.babashka/spec.alpha {:git/url ""
:git/sha "1a841c4cc1d4f6dab7505a98ed2d532dd9d56b78"}}})
View scriptjure.clj
((requiring-resolve 'babashka.deps/add-deps)
'{:deps {scriptjure/scriptjure #_{:mvn/version "0.1.24"}
{:git/url ""
:git/sha "8d1f303557a0f4a021f33f2b01eb10b33509f46e"
:deps/manifest :deps}
#_{:local/root "/tmp/scriptjure" :deps/manifest :deps}}})
(ns scriptjure
'{:config-in-call {com.reasonr.scriptjure/js
borkdude / scrape_tables.clj
Created Oct 5, 2020
Extract HTML tables with babashka and bootleg
View scrape_tables.clj
(ns scrape
(:require [babashka.pods :as pods]
[clojure.walk :as walk]))
(pods/load-pod "bootleg") ;; installed on path, use "./bootleg" for local binary
(require '[babashka.curl :as curl])
(def clojure-html (:body (curl/get "")))
borkdude / shell.nix
Created Dec 26, 2021
Mix and match older tools from nixpkgs
View shell.nix
{ pkgs ? import <nixpkgs> {} }:
graalvm21_2_0 = import (builtins.fetchGit {
# Descriptive name to make the store path easier to identify
name = "graalvm-21.2.0";
url = "";
ref = "refs/heads/nixpkgs-unstable";
rev = "e4dda76e6397fb1e30b907abeaf6a72bb055a1e6";
}) {};
borkdude /
Last active Jun 18, 2022
Zazzle products
borkdude / 1) bb.edn
Last active Jun 15, 2022
Work bb.edn files
View 1) bb.edn
{:tasks {:requires ([babashka.fs :as fs])
:init (do (when (seq (fs/modified-since "deps.edn"
(shell {:dir ".."} "script/gen-deps.clj")))
;; Maintenance tasks
install {:doc "Install frontend dependencies from NPM"
:task (shell "npm install")}
clean {:doc "Clean all artifacts"