This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-21
Channels
- # adventofcode (8)
- # announcements (20)
- # babashka (43)
- # beginners (8)
- # biff (12)
- # calva (2)
- # cider (5)
- # clerk (6)
- # clj-commons (12)
- # clj-kondo (16)
- # clojure (20)
- # clojure-denver (1)
- # clojure-europe (14)
- # clojure-nl (1)
- # clojure-norway (105)
- # clojure-uk (2)
- # clojuredesign-podcast (5)
- # clojurescript (29)
- # datomic (2)
- # hyperfiddle (13)
- # jackdaw (1)
- # jobs (4)
- # jobs-discuss (4)
- # lsp (2)
- # malli (12)
- # pathom (2)
- # pedestal (1)
- # re-frame (22)
- # shadow-cljs (37)
- # squint (28)
- # xtdb (28)
- # yamlscript (4)
Hi all! I've been working on small library called "balloon". I did some integrations a while ago, for zapier and for flowxo. It happens that you need to flat objects often. Back then I created a python script for that, then I found a library for nodejs but I couldn't find anything for clojure (or maybe I didn't look hard enough? or maybe bc you can make this stuff yourself). I decided to give it a go, you know, for the learning experience and, what's more fun than staying a Friday night coding instead of hanging out with friends right? Anyway, today I released version "0.1.0" and you can find it here https://github.com/roboli/balloon And you can do stuff like this:
(b/deflate {:my-map {:one "one"
:two "two"
:any {:other "other"}}
:my-array [{:a "a"} "b" "c"]})
;;=>
;; {:my-map.one "one",
;; :my-map.two "two",
;; :my-map.any.other "other",
;; :my-array.0.a "a",
;; :my-array.1 "b",
;; :my-array.2 "c"}
And it also has a CLI. Hope you find it useful!Might be a nice enhancement to support a delimiter of "/"
and handle qualified keywords:
user=> (b/inflate {:user/id 1 :user/name "Sean" :user/addressid 2 :address/id 2 :address/street "123 Main St"} :delimiter "/")
{:id 2, :name "Sean", :addressid 2, :street "123 Main St"}
I was hoping for {:user {:id ...} :address {:street ..}}
Cool idea and library, re-wrote this one function while I was reading... hth π
(defn- keys->deflated-key
[delimiter]
(fn [ks]
(->> (for [k ks] (if (number? k) (str k) (name k)))
(string/join delimiter)
(keyword))))
> what's more fun than staying a Friday night coding instead of hanging out with friends balance π
i was reading something like this for javascript recently. json notation has the benefit of exploding to valid json so you can turn sub parts of it back into json
i was just about to mention gron too.
when i tried to do something like gron, but for "edn", i was thinking of using vectors as keys, so i can do the inverse operation via something like (reduce (fn [m [k v]] (assoc-in m k v) {[:a] 1 [:a 0] 2 [:b] 3})
eg, this works:
(->> [[:a] []
[:a 0] 2
[:b] 3
[:c] {}
[:c :d] 4]
(partition-all 2)
(reduce (partial apply assoc-in) nil))
=> {:a [2], :b 3, :c {:d 4}}
it assumes an ordered input, which explicitly expresses whether a nesting level is a map or vector, so that nesting level is ready to receive subsequent inputs.
this way there is no magic needed during reconstruction.Interesting about gron, I didn't know it. It's just matter of doing some pretty print on lein-balloon output and should be ready for grep :thinking_face:
Announcing the first official release of https://github.com/cjohansen/powerpack - a batteries included static website framework. It's based on the excellent https://github.com/magnars/stasis toolkit, and comes with: β’ Lots of development convenience: live reload of content, CSS, and code, strong error handling, and more β’ Streamlined data flow: put static content in markdown and EDN files, have them automatically ingested into an in-memory Datomic database, and build pages from that Datomic database. β’ i18n tooling β’ Image transformation (crop, resize, duotone, etc) β’ Production ready exporting tools β’ Asset optimization pipeline Even though this is the first official release, the product is very stable - it's based on five years of work with static web sites, and has been polished while building a 5000 page static web page over the past few months. There is a fairly extensive step by step guide in a separate repo: https://github.com/cjohansen/powerblog
People might be interested in https://sumar.io. Itβs written in Python but due to problems with its dependencies, namely its authentication library, a rewrite in Clojure is probable.
Sod's law this came out just as a redid my blog π Time to re-migrate again! Curious why datomic over xt here; is the strict schema needed or is it just a preference thing?
I also note that the datomic schemas are used to import structured data more easily when adding metadata to markdown files.
Okay this is really good work π Gonna take me a little bit to grok the datomic bits, but this is really cool work π Might be worth a #stasis π
Awesome, just what I was looking for! special thanks for the walkthrough guide @U9MKYDN4Q
Babashka https://github.com/babashka/fs: file system utility library for Clojure
v0.5.20 (2023-12-21)
β’ https://github.com/babashka/fs/issues/119: fs/delete-tree
: add :force
flag to delete read-only directories/files. Set the flag to true in fs/with-temp-dir
(https://github.com/jlesquembre)
β’ https://github.com/babashka/fs/issues/102: add gzip
and gunzip
functions
β’ https://github.com/babashka/fs/issues/113: fs/glob
: enable :hidden
(when not already set) when pattern
starts with dot (https://github.com/eval).
β’ https://github.com/babashka/fs/issues/117: fix fs/match
and fs/glob
not finding files in root-folder (https://github.com/eval).