View extension.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The module 'vscode' contains the VS Code extensibility API | |
// Import the module and reference it with the alias vscode in your code below | |
const vscode = require('vscode'); | |
const path = require('path'); | |
// this method is called when your extension is activated | |
// your extension is activated the very first time the command is executed | |
/** | |
* @param {vscode.ExtensionContext} context |
View reaction.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[promesa.core :as p] | |
'[reagent.ratom :as ratom]) | |
(def app-state (ratom/atom {:state-var-1 {:var-a 2 | |
:var-b 3} | |
:state-var-2 {:var-a 7 | |
:var-b 9}})) | |
(def app-var2a-reaction (ratom/make-reaction | |
#(get-in @app-state [:state-var-2 :var-a]))) |
View class_to_package.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[clojure.java.io :as io] | |
'[clojure.string :as str]) | |
(defn class->package | |
"Implementation by Marco Marini." | |
[class-file] | |
(with-open [dis (java.io.DataInputStream. (io/input-stream class-file))] | |
;; skip first 8 bytes | |
(.skipBytes dis 8) | |
(let [constant-pool-count (.readUnsignedShort dis) |
View deploy.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# command line to deploy the project | |
gcloud functions deploy hello --runtime nodejs14 --trigger-http |
View find_git_dirs.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[babashka.fs :as fs]) | |
(let [counter (volatile! 0)] | |
(fs/walk-file-tree "." {:pre-visit-dir (fn [d _] | |
(if (= ".git" (fs/file-name d)) | |
(do (vswap! counter inc ) | |
:skip-subtree) | |
:continue))}) | |
@counter) |
View polyglot.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ $GRAALVM_HOME/bin/node --jvm --polyglot --vm.cp=$(clojure -Spath) $(which nbb) | |
user=> (.-version js/process) | |
"v14.18.1" | |
user=> (require '["path" :as path]) | |
nil | |
user=> (path/resolve ".") | |
"/Users/borkdude" | |
user=> (def Clojure (js/Java.type "clojure.java.api.Clojure")) | |
#'user/Clojure | |
user=> (def clj:require (.var Clojure "clojure.core" "require")) |
View dev.docgen.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns dev.docgen | |
(:require [clojure.pprint :refer [pprint]] | |
[rewrite-clj.zip :as z] | |
[clojure.string :as str] | |
[clojure.java.io :as io]) | |
(:import (java.io File))) | |
(defn -form->markdown | |
"Clojure forms are evaluated and the result is automatically inserted in the generated markdown. | |
There is a special handling for 'def, we show their var binding instead" |
View guestbook.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns guestbook | |
(:require [cheshire.core :as cheshire] | |
[hiccup2.core :as hiccup] | |
[clojure.string :as str])) | |
(require '[babashka.pods :as pods]) | |
(pods/load-pod "./pod-babashka-postgresql") | |
(def db {:dbtype "postgresql" | |
:user "guestbook" |
View shell.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs ? import <nixpkgs> {} }: | |
let | |
graalvm21_2_0 = import (builtins.fetchGit { | |
# Descriptive name to make the store path easier to identify | |
name = "graalvm-21.2.0"; | |
url = "https://github.com/NixOS/nixpkgs"; | |
ref = "refs/heads/nixpkgs-unstable"; | |
rev = "e4dda76e6397fb1e30b907abeaf6a72bb055a1e6"; | |
}) {}; |
View Segfault
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ bb nrepl-server | |
Started nREPL server at 127.0.0.1:1667 | |
For more info visit: https://book.babashka.org/#_nrepl | |
[ [ SubstrateSegfaultHandler caught a segfault in thread 0x00007feb86c0ae00 ] ] | |
siginfo: si_signo: 11, si_code: 1, si_addr: 0x0000000000000039 | |
General purpose register values: | |
RAX 0x0000700003f2bf60 points into the stack for thread 0x00007feb86c0ae00 | |
RBX 0x0000000107d78120 points into the image heap (read-only huge) |