Fork me on GitHub
#beginners
<
2021-09-05
>
popeye06:09:27

I am trying to install datomic in my local and getting below error, Can anyone help me please

Benjamin09:09:26

Is there a beginner friendly way to create graalvm programs? I tried https://github.com/luchiniatwork/cambada but there is something wrong with the clojure class path or something. I followed the readme example and needed to add clojure do deps.edn to make it compile but the resulting program throws Caused by: java.io.FileNotFoundException: Could not locate clojure/core__init.class,

delaguardo10:09:54

There is a channel #graalvm where you can ask for help. And here is a nice collection of useful resources - https://github.com/lread/clj-graal-docs

👍 2
Thanh Nguyen13:09:59

Hi guys. I am learning reagent and trying to write a simple CRUD app. There is a weird behavior that I am being confused about, however. If my code is like this, the atomic immediately becomes null after every of the input change:

(defonce selected-user-map (reagent.core/atom {:name "" :surname ""}))
[:input
     {:value (:name @selected-user-map)
      :on-change (fn [event]
                   (let [new-name (-> event .-target .-value)]
                     (swap! selected-user-map assoc :name new-name)))}]
If I change the swap! to reset!, stuff works as expected:
(reset! selected-user (merge @selected-user-map {:name new-name}))
Is there any special reason on the behavior? I thought that swap! and reset! should have yielded similar result, or I misunderstood something? Thanks in advance.

Thanh Nguyen13:09:27

This is a GIF for clarification. It records the behavior when I use swap! • Select an user • Try modifying the selected user with the input • The selected user become null

Vlad Kryvokoniev13:09:30

Hi, I have problem adjusted to shadow-cljs env variables As the https://shadow-cljs.github.io/docs/UsersGuide.html#shadow-env "not clearly" says I can read a variable via #shadow/env "TWITCH_AUTHORIZATION_TOKEN" but instead i get an error No reader function for tag shadow/env. my version of shadow-cljs is "2.15.2" here is my shadow-cljs.edn:

{:source-paths
 ["src/main"]


 :dependencies
 [[reagent "1.1.0"]
  [cljs-ajax "0.8.4"]]

 :dev-http {8080 "public"}
 :builds
 {:frontend
  {:target :browser
   :modules {:main {:init-fn app/start}}
   :closure-defines {events.async/TWITCH_AUTHORIZATION_TOKEN #shadow/env "TWITCH_AUTHORIZATION_TOKEN"}}}} 
also my .env:
TWITCH_AUTHORIZATION_TOKEN="blalbbllba"
so my question is how to read a env variable then?

hiredman14:09:02

That file looks like a weird amalgamation of a project.clj, a deps.edn, and the shadow-cljs.edn file described in those docs

hiredman14:09:53

And that is exactly the error I would expect in you tried to use the shadow tag readers in a deps.edn file

hiredman14:09:11

Ah, I just missed the other keys in the docs

ChillPillzKillzBillz17:09:34

how do you write hiccup for @keyframes tag for css animation? Muchos Gracias!

dgb2307:09:49

https://github.com/noprompt/garden has support for media queries and keyframes

dgb2307:09:44

I think with hiccup you would have to create a style tag, or include a CSS file.

ChillPillzKillzBillz17:09:32

HI I had a look at garden... but I still can't generate the keywords definition.

(println (css [(keyword "@keyframes") {:from {:background {:color "red"}}
                        :to {:background {:color "blue"}}}
               "example"]))
Generates ->
@keyframes {
  from-background-color: red;
  to-background-color: blue;
}
Which looks good... but I want to generate
@keyframes example {
  from-background-color: red;
  to-background-color: blue;
}
However when I run the following
(println (css [(keyword "@keyframes") "example" {:from {:background {:color "red"}}
                        :to {:background {:color "blue"}}}]))
I get
@keyframes, example {
  from-background-color: red;
  to-background-color: blue;
}

ChillPillzKillzBillz18:09:02

@U01EFUL1A8M Many thanks for your help. But I can't figure out how to still use it! Please can you show me 1 example? I'll be forever grateful!

ChillPillzKillzBillz18:09:35

@U06MDAPTP Sorry to bother you. Is there a proper tutorial for using garden somewhere?

dgb2319:09:28

Does this help?

(ns user
  (:require [garden.stylesheet :refer [at-keyframes]]
            [garden.core :refer [css]]))

(css (at-keyframes :slidein
                   [:from {:transform "translateX(0%)"}]
                   [:to {:transform "translateX(100%)"}]))

dgb2319:09:02

(edited syntax error)

ChillPillzKillzBillz19:09:37

ahh... I see what the problem is... the name of the keyframes also needs to be a keyword... instead of a string!! Thank you very much @U01EFUL1A8M!! I would have never figured this out! Many thanks!

dgb2319:09:54

No problem! All I have done is: fire up a REPL, look at the source code of CSS garden and searched it and played around a bit. All good and fun.

👍 2
🙌 2