babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
2020-10-19T00:15:39.476600Z

For ii, I’m using glam to provide repeatable tool versions for makejack, Makejack invokes tools directly without using.a shell, The new glam.edn file can be used to fix the version of the tool. Currently it uses the install command and parses the output path string to get the tool’s path. Ideally makejack would be able to install tools whether or not glam has been explicitly installed by the user. It currently use clojure to install a babashka version, then uses babashka to run glam.

borkdude 2020-10-19T09:29:46.477Z

$ is a convenience macro around process:

(def config {:output {:format :edn}})
(-> ($ clj-kondo --config ~config --lint "src") :out slurp edn/read-string)
{:findings [], :summary {:error 0, :warning 0, :info 0, :type :summary, :duration 34}}

💯 4
❤️ 3
borkdude 2020-10-19T14:31:23.478400Z

Just pushed the above to master. Please try it out. Binaries are in #babashka_circleci_builds

Jakub Zika 2020-10-19T15:10:55.482300Z

Hi, i wanted to use http-kit in babashka. So i imported         [org.httpkit.client :as client] but now i am recieving … #object[org.httpkit.client$deadlock_guard$reify__14437 0x202e5d90 {:status :pending, :val nil}] #object[org.httpkit.client$deadlock_guard$reify__14437 0x5e587c9f {:status :pending, :val nil}] #object[org.httpkit.client$deadlock_guard$reify__14437 0x9c51ba6 {:status :pending, :val nil}] #object[org.httpkit.client$deadlock_guard$reify__14437 0x98a5229 {:status :pending, :val nil}] #object[org.httpkit.client$deadlock_guard$reify__14437 0x617e2f53 {:status :pending, :val nil}])) … for every post request on my localhost:3000/api/… thanks

Darin Douglass 2020-10-19T15:11:28.482600Z

are you deref'ing the request?

Darin Douglass 2020-10-19T15:11:37.482900Z

http-kit requests are async, thus you need to @ them

1
borkdude 2020-10-19T15:12:41.483100Z

@jakub.zika-extern Yes, check out http://http-kit.github.io/

Jakub Zika 2020-10-19T15:13:57.484300Z

I forget to add that using clj-http-kit works fine.

borkdude 2020-10-19T15:14:33.484800Z

@jakub.zika-extern You can also use babashka.curl which is more like clj-http, and shells out to curl

Jakub Zika 2020-10-19T15:16:00.486700Z

@borkdude i would like to have this code usable in my clj+cljs webapp and in standalone mode like client and i did not find babashka.curl as a lein dependency

borkdude 2020-10-19T15:18:12.488300Z

@jakub.zika-extern I would be happy to make a lein release for babashka.curl. But you can also use .cljc with a :bb reader conditional. But httpkit also just works fine. Just put an @ like @(org.httpkit.client/get ...)

👍 1
Jakub Zika 2020-10-19T15:22:45.493100Z

Ok, Thanks. I will try it (and try to find something about a diference between requesting [http-kit] and [org.http-kit.client])

Jakub Zika 2020-10-19T15:30:12.493900Z

Works like a charm, thanks @borkdude and @ddouglass

Jakub Zika 2020-10-19T16:05:23.496500Z

Hi, another question 🙂 I see that I can use java.time for various time function but I can not access java.text. My use case.- I have a string in DDMMYYYYHHMMSS pattern that i would like to get into java.time easily and then parse it back into DD-MM-YYYY HH:MM:SS string. How would you do this in BB?

borkdude 2020-10-19T16:06:00.497100Z

@jakub.zika-extern Can you give an example using java.text?

Jakub Zika 2020-10-19T16:06:22.497300Z

import java.text.DateFormat;
import java.util.Date;
import java.text.SimpleDateFormat;
public class Demo {
    public static void main(String[] args) throws Exception {
       String strTime = "20:15:40";
       DateFormat dateFormat = new SimpleDateFormat("hh:mm:ss");
       Date d = dateFormat.parse(strTime);
       System.out.println("Resultant Date and Time = " + d);
    }
}

borkdude 2020-10-19T16:07:16.498Z

I'm pretty sure you can do that using java.time

Jakub Zika 2020-10-19T16:08:12.498400Z

I do not see any function to load/parse a string in its api

borkdude 2020-10-19T16:14:23.499700Z

@jakub.zika-extern

(def fmt (java.time.format.DateTimeFormatter/ofPattern "ddMMyyyy"))
(java.time.LocalDate/parse "01022000" fmt)
https://docs.oracle.com/javase/tutorial/datetime/iso/format.html

👏 2
borkdude 2020-10-19T21:51:14.000800Z

First signs of babashka/process usage! https://github.com/borkdude/babashka/issues/575#issuecomment-712460781

🎉 1