clojure-hungary

onetom 2020-07-24T13:50:16.000800Z

mit szoltok a nubank-cognitect aquisition-hoz?

valerauko 2020-07-26T11:11:26.008500Z

felmerult bennem, hogy lehet erdemes lenne megtanulni portugalul 🙂

onetom 2020-07-28T14:37:27.009800Z

tobb felol is hallottam h erre a kovetkeztetesre jutottak az emberek 🙂 fonokom portugal amugy... ;D

onetom 2020-07-29T17:18:48.010Z

Babashka-t probalta mar valaki elesben? https://github.com/borkdude/babashka nekunk mar nagyon viszket a tenyerunk h lecsereljuk a mindenfele bash script-jeinket meg makefile-jainkat babashka script-ekre inkabb...

onetom 2020-07-24T13:54:31.002700Z

anyway, masik dolog amivel a napokban probalkoztam, az a Reveal, avagy Read Eval Visualize Loop https://github.com/vlaaad/reveal a fejlesztoje segitsegevel hekkeltem bele egy egyszeru deep-diff supportot https://github.com/lambdaisland/deep-diff2

onetom 2020-07-24T13:56:41.004200Z

sajnos a kulonbozo hatterszin hasznalatahoz meg kellett valtoztatni a renderelo rutint a vlaaad.reveal.layout/draw-ban:

(dotimes [i drawn-line-count]
      (transduce
        (mapcat :segments)
        (completing
          (fn [x {:keys [text width style]}]
            (if (< x canvas-width)
              (let [end (+ x width)
                    y (-> (* i font/line-height)
                          (+ font/ascent)
                          (- scroll-y-remainder))]
                (if (<= end 0)
                  end
                  (do
                    (when-let [bg-color (:bg style)]
                      (doto ctx
                        (.setFill (fx.coerce/color bg-color))
                        (.fillRect x (- y font/ascent)
                                   width font/line-height)))

                    (.setFill ctx (fx.coerce/color
                                    (if-let [fill (:fill style)]
                                      (get style/style fill fill)
                                      "#000")))
                    (.setFont ctx font/font)
                    (.fillText ctx text x y)
                    end)))
              (reduced nil))))
        scroll-x
        (lines (+ i dropped-line-count))))

onetom 2020-07-24T13:58:40.005Z

de ennelkul is mukodik. itt a teszt kod aminek a kimenetet screenshot-oltam:

(let [inserted-color {:bg "#0F04"}
        deletion-color {:bg "#F004"}]
    (require '[vlaaad.reveal.stream :refer :all]
             '[lambdaisland.deep-diff :as ddiff])

    (defmethod emit lambdaisland.deep_diff.diff.Insertion [diff]
      (horizontal
        (raw-string "+" inserted-color)
        (emit (:+ diff))
        (raw-string "+" inserted-color)))

    (defmethod emit lambdaisland.deep_diff.diff.Deletion [diff]
      (horizontal
        (raw-string "-" deletion-color)
        (emit (:- diff))
        (raw-string "-" deletion-color)))

    (defmethod emit lambdaisland.deep_diff.diff.Mismatch [diff]
      (horizontal
        (raw-string "<-" deletion-color)
        (emit (:- diff))
        (raw-string ">" deletion-color)
        (raw-string " ")
        (raw-string "<+" inserted-color)
        (emit (:+ diff))
        (raw-string ">" inserted-color)))

    (let [d (ddiff/diff {:removed 123
                         :common  "data"
                         :changed {:value "old value"}}
                        {:common  "data"
                         :added   456
                         :changed {:value "new value"}})]
      (just (emit d))))

onetom 2020-07-24T14:02:10.007200Z

a Clojure/north conferencian volt egy erdekes talk az editscript library-rol. https://github.com/juji-io/editscript az editscript szerzoje nem ismerte a deep-diff-et, de miutan rakerdeztem youtube kommenten keresztul, irt egy osszehasonlito cikket a kerdesrol es a readme-hez is hozzaadott egy deep-diff referenciat: https://youtu.be/n-avEZHEHg8

onetom 2020-07-24T14:03:11.008200Z

tudom javasolni ezeket a megoldasokat, mert rengeteget tudnak segiteni teljesen kulonbozo helyzetekben is.

👍 2