clj-kondo example

This commit is contained in:
Michiel Borkent 2020-12-26 21:32:39 +01:00
parent 8e4ebf78b4
commit adfffa1267
5 changed files with 75 additions and 0 deletions

10
examples/bootleg.clj Normal file
View file

@ -0,0 +1,10 @@
(require '[babashka.pods :as pods])
(pods/load-pod 'retrogradeorbit/bootleg "0.1.9")
(require '[pod.retrogradeorbit.bootleg.utils :as utils])
(-> [:div
[:h1 "Using Bootleg From Babashka"]
[:p "This is a demo"]]
(utils/convert-to :html))

8
examples/brisk.clj Normal file
View file

@ -0,0 +1,8 @@
(require '[babashka.pods :as pods])
(pods/load-pod 'justone/brisk "0.2.0")
(require '[pod.brisk :as brisk])
(brisk/freeze-to-file "pod.nippy" {:han :solo})
(prn (brisk/thaw-from-file "pod.nippy"))

11
examples/clj-kondo.clj Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env bb
(require '[babashka.pods :as pods])
(pods/load-pod 'borkdude/clj-kondo "2020.12.12")
(require '[pod.borkdude.clj-kondo :as clj-kondo])
(-> (clj-kondo/run! {:lint ["src"]})
:summary)

13
examples/hsqldb.clj Normal file
View file

@ -0,0 +1,13 @@
(require '[babashka.pods :as pods])
(pods/load-pod 'org.babashka/hsqldb "0.0.1")
(require '[pod.babashka.hsqldb :as db])
(def db "jdbc:hsqldb:mem:testdb;sql.syntax_mys=true")
(db/execute! db ["create table foo ( foo int );"])
(db/execute! db ["insert into foo values (1, 2, 3);"])
(db/execute! db ["select * from foo;"])

33
examples/lanterna.clj Normal file
View file

@ -0,0 +1,33 @@
(require '[babashka.pods :refer [load-pod]])
(load-pod 'org.babashka/lanterna "0.0.1-SNAPSHOT" {#_#_:force true #_#_:transport :socket})
(require '[pod.babashka.lanterna.terminal :as terminal])
(def terminal (terminal/get-terminal))
(terminal/start terminal)
(terminal/put-string terminal
(str "Hello TUI Babashka!")
10 5)
(terminal/put-string terminal
(str "The size of this terminal: "
(terminal/get-size terminal))
10 6)
(terminal/put-string terminal
"Press q to exit."
10 7)
(terminal/flush terminal)
(def k (terminal/get-key-blocking terminal))
(terminal/put-string terminal
(str "You pressed: " k)
10 8)
(Thread/sleep 1000)
(terminal/stop terminal)