Last active
October 5, 2023 01:18
-
-
Save tombarys/f1d5896cddfc655fa72b822de6ecbcbc to your computer and use it in GitHub Desktop.
Show children block count
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Instructions for including the Clojure script (this) into your Roam can be found in my article | |
;; here: https://lifehacky.net/how-to-list-namespaces-and-find-more-in-roam-research-5c25d9f24556 | |
;; Search for section "How to make it work in your Roam?" and think of "better-search" as of "children-block-count" | |
(ns reddit.8-7-2022-reagent | |
(:require [roam.datascript :as rd] | |
[reagent.core :as r] | |
[roam.datascript.reactive :as rdr])) | |
(defn show-num [uid] | |
(r/with-let [*kids (rdr/q '[:find (count ?b) . | |
:in $ ?uid | |
:where | |
[?a :block/uid ?uid] | |
[?b :block/parents ?a]] uid)] | |
[:span @*kids])) | |
(defn main [{:keys [block-uid]}] | |
(show-num block-uid)) |
Christian-Klaperek
commented
Oct 5, 2023
via email
Done!
Thank you and see you soon.
Christian
…On Thu, Oct 5, 2023 at 1:54 AM Tomáš Baránek ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Sorry, Christian, your e-mail is hidden as of GitHub policy. Please write
me through the https://barys.me form (remember to fill in the e-mail) at
the bottom left. I will send you a Zoom link then at 15:30 ICT. :)
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/tombarys/f1d5896cddfc655fa72b822de6ecbcbc#gistcomment-4713924>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMEJWU6YJPIGLDZSVAAKOUDX5WWFXBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTCNZSGU2DONBUU52HE2LHM5SXFJTDOJSWC5DF>
.
You are receiving this email because you commented on the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment