Skip to content

Instantly share code, notes, and snippets.

View tombarys's full-sized avatar

Tomáš Baránek tombarys

View GitHub Profile
@tombarys
tombarys / better-search.clj
Last active February 27, 2024 09:48
Better-search for Roam (V 2.11 improved + sorting)
(ns better-search-V2.1
(:require [reagent.core :as r]
[roam.datascript :as rd]
[roam.util :refer [parse]]))
(defn query-list [s-type search]
"creates a list of pages"
(sort (case s-type
:starts (rd/q '[:find ?fulltitle
:in $ ?search
@tombarys
tombarys / namespace-roam.css
Created May 29, 2022 17:41
Roam namespace styling CSS
span[data-link-title*="Video/"] span.rm-page-ref {
color: #795548;
font-weight: bold;
}
span[data-link-title*="Video/"]::before {
content: "📺"
}
@tombarys
tombarys / erase_roam_block.clj
Last active August 6, 2022 18:46
Erase Roam block (including children) V1.2
;; Warning: this plugin adds a "X Erase this block" item on both mobile and desktop Roam apps, but to activate Roam context menu on mobile, you need to install Victor Tabori's Long-tap script: https://gist.github.com/thesved/48cab2307cf0598fcc5cd37643d36cb4
;; 1) copy this block as children block `clojure` code block under parent containing {{[[roam/cljs]]}} anywhere on [[roam/cljs]] page
;; 2) confirm "Yes, I know what I am doing"
;; 3) restart Roam
;; 4) right-click on any block context menu (on a bullet)
;; 5) choose "X Erase this block" and confirm (attention: erases block including it's children; but do not worry: Cmd/Ctrl-Z works well)
(ns my-custom-roam-97
@tombarys
tombarys / block-teleport.clj
Last active March 11, 2024 17:56
Roam Plugin – Teleport task to Tomorrow :) – V2.2
;; Warning: this plugin adds a "→ Move to tomorrow" item on both mobile and desktop Roam apps
;; to the context plugin menu and to command pallete (Mac: Cmd-P / Windows: Ctrl-P, then search for "Move" or "tomorrow" etc.).
;; To activate Roam context menu on mobile, you need to install Victor Tabori's Long-tap script first:
;; https://gist.github.com/thesved/48cab2307cf0598fcc5cd37643d36cb4
;; Installation:
;; 1) copy this block as children block `clojure` code block under parent containing {{[[roam/cljs]]}} anywhere
;; in [[roam/cljs]] page
;; 2) confirm "Yes, I know what I am doing"
;; 3) restart Roam
@tombarys
tombarys / send-to-readwise.clj
Last active May 20, 2023 09:21
Send block from Roam to Readwise using context menu
(ns my-custom-roam-01072022
(:require [roam.datascript :as rd]
[promesa.core :as p]
[clojure.string :as s]))
;; SETUP SECTION
;; 1) Open or create page [[roam/cljs]] in your Roam
;; 2) Create a parent block with {{[[roam/cljs]]}}
;; 3) Create a children block of the above block
@tombarys
tombarys / children-block-count.clj
Last active October 5, 2023 01:18
Show children block count
;; 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]
@tombarys
tombarys / looking-back.clj
Last active July 22, 2022 16:21
Looking to the past query generator for Roam
;; TWO OPTIONS of using the looking-back query generator:
;; 1) WITH PARAMETERS:
;; {{roam/render ((this–cljs-block-id)) time_window time_ago}} where
;; "time_window" is number of days that will be seen (default: 7)
;; "time_ago" is number of days you are looking
;; Example:
;; {{roam/render ((gsWdfssdf)) 10 720}}
;;
;; 2) WITHOUT PARAMETERS:
;; Sliders will be shown to adjust both parameter.
@tombarys
tombarys / move-to-next-monday.clj
Last active April 17, 2023 09:53
Move the block to the next monday (context menu plugin for Roam) V1.2
;; Warning: this plugin adds a "⇨ Move to next Monday" item on both mobile and desktop Roam apps
;; to the context plugin menu and to command pallete (Mac: Cmd-P / Windows: Ctrl-P, then search for "Move" or "monday" etc.).
;; To activate Roam context menu on mobile, you need to install Victor Tabori's Long-tap script first:
;; https://gist.github.com/thesved/48cab2307cf0598fcc5cd37643d36cb4
;; Installation:
;; 1) copy this block as children block `clojure` code block under parent containing {{[[roam/cljs]]}} anywhere
;; in [[roam/cljs]] page
;; 2) confirm "Yes, I know what I am doing"
;; 3) restart Roam
;; 4) desktop: right-click on any block context menu (on the bullet) / mobile: long-tap the bullet
@tombarys
tombarys / move-to-today.cljs
Created April 17, 2023 07:58
Move Roam block to today Daily Page (from any page)
;; Warning: this plugin adds a "→ Move to today" item on both mobile and desktop Roam apps
;; to the context plugin menu and to command pallete (Mac: Cmd-P / Windows: Ctrl-P, then search for "Move" or "today" etc.).
;; To activate Roam context menu on mobile, you need to install Victor Tabori's Long-tap script first:
;; https://gist.github.com/thesved/48cab2307cf0598fcc5cd37643d36cb4
;; Installation:
;; 1) copy this block as children block `clojure` code block under parent containing {{[[roam/cljs]]}} anywhere
;; in [[roam/cljs]] page
;; 2) confirm "Yes, I know what I am doing"
;; 3) restart Roam
@tombarys
tombarys / cleanPDF.clj
Last active April 30, 2023 17:38
Cleans the focused Roam block after copy/pasting/importing from PDF
;; For all those who paste text from PDF into Roam using Copy-Paste or import via Readwise from PDF in the Reader app.
;; The problem is that there are often hard-coded "newline" characters at the end of lines in PDFs,
;; and words tend to be split by hyphens, which will break up the text when pasted into Roam.
;; I've made the simple script that cleans up the text, merges it, and if there's even a line shorter
;; than the preset threshold, treats it as the end of a paragraph (so it keeps the newline).
;; You can assign a keyboard shortcut to this, so it then works instantly.
;; Installation:
;; 1) copy this code as a children codeblock (`clojure`) under parent containing {{[[roam/cljs]]}} anywhere