Fork me on GitHub
#babashka
<
2020-10-19
>
borkdude09:10:46

$ 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
borkdude14:10:23

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

Jakub Zika15:10:55

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 Douglass15:10:28

are you deref'ing the request?

Darin Douglass15:10:37

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

1
Jakub Zika15:10:57

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

borkdude15:10:33

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

Jakub Zika15:10:00

@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

borkdude15:10:12

@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 Zika15:10:45

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

Jakub Zika15:10:12

Works like a charm, thanks @borkdude and @ddouglass

Jakub Zika16:10:23

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?

borkdude16:10:00

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

Jakub Zika16:10:22

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);
    }
}

borkdude16:10:16

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

Jakub Zika16:10:12

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

borkdude16:10:23

@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