From adfffa12679a24f7d64633c1299c3312736833ed Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sat, 26 Dec 2020 21:32:39 +0100 Subject: [PATCH] clj-kondo example --- examples/bootleg.clj | 10 ++++++++++ examples/brisk.clj | 8 ++++++++ examples/clj-kondo.clj | 11 +++++++++++ examples/hsqldb.clj | 13 +++++++++++++ examples/lanterna.clj | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 75 insertions(+) create mode 100644 examples/bootleg.clj create mode 100644 examples/brisk.clj create mode 100755 examples/clj-kondo.clj create mode 100644 examples/hsqldb.clj create mode 100644 examples/lanterna.clj diff --git a/examples/bootleg.clj b/examples/bootleg.clj new file mode 100644 index 0000000..25c9beb --- /dev/null +++ b/examples/bootleg.clj @@ -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)) diff --git a/examples/brisk.clj b/examples/brisk.clj new file mode 100644 index 0000000..6e6e687 --- /dev/null +++ b/examples/brisk.clj @@ -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")) diff --git a/examples/clj-kondo.clj b/examples/clj-kondo.clj new file mode 100755 index 0000000..25577a0 --- /dev/null +++ b/examples/clj-kondo.clj @@ -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) + diff --git a/examples/hsqldb.clj b/examples/hsqldb.clj new file mode 100644 index 0000000..e9819da --- /dev/null +++ b/examples/hsqldb.clj @@ -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;"]) diff --git a/examples/lanterna.clj b/examples/lanterna.clj new file mode 100644 index 0000000..83a0633 --- /dev/null +++ b/examples/lanterna.clj @@ -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) +