;links in our db look like this: [143 "https://clojure.org"]
(defn make-link [t]
(let [text (get t 1)]
(list
[:a {:href
(cond
(clojure.string/starts-with? text "http") (truncate text 160)
:else (str "https://google.com/search?q=" text))} text] [:br])))Query time: 1.57E-4 msecs;really FAST! '
(d/pull-many @conn [:db/id :url-link :noted]
(reverse (range 10 (inc (:max-eid @conn)))));not slow ''
(d/q '[:find ?e ?l ?n
:in $ [?e ...]
:where
[?e :noted ?n]
[?e :url-link ?l]] @conn)links for ants (NEW!)(def my-list (get-links))
(map make-link (repeatedly 6 #(rand-nth my-list)))here is the function to generate pretty codeblocks:;ignore this apostrophe '
(defn make-codeblock [code-as-string]
(list [:pre [:code {:style {:font-family "Consolas, Monaco, monospace;" :font-size 13}} code-as-string ]]))below is the Clojure code that generates the codeblock above*:(make-codeblock ";ignore this apostrophe '
(defn make-codeblock [code-as-string]
(list [:pre [:code {:style {:font-family "Consolas, Monaco, monospace;" :font-size 13}} code-as-string ]]))")
; * Actually, that is a lie. Can you guess why?If you use rum you can embed functions directly because this is a structure and it will be compiled when you request the route. So that's interesting (search-again "sorry"). Right that doesn't work. Oh shit. Hmm, okay. WOW.
Any way, I need to move back to the city. What if BKB closes down? Let's check: Will BKB close down?
Can you define a function inside a rum component? Let's see: google
This fails: <a href="https://www.google.com/search?q=ycombinator target="_blank">ycombinator</a>
<a href="https://www.google.com/search?q=ycombinator target="_blank">ycombinator</a>search again: ycombinator
It works! So I have to type inside of a string obviously, which is a cumbersome but short of creating my own parser? compiler? This is one solution because Rum/hiccup *is* my parser. Oh dear. Formatting. <i>This will not work.</i> But this should:
Rum will convert key with vector into HTML tag it represents.
Wait a second. Hey, this is the same paragraph. Okay, that's useful. So, the point is is that Rum is truly my markdown: It gives me a way to write text and codeI bet you can define a function inside the rum component. Let's see ... Okay I defined something called That did not work. It broke it. inside. Can I call it here? ->
hey look a function for color: Send any color you want! This is pink! this is blue and I guess it works the same! that is not much more cumbersome than Markdown, but I get to write and embed functions! Come on, that's pretty cool!
I do not know how to emit or send parsed HTML. I am sending a string. Rum takes a clojure data structure and parses it.
Welcome to post 2. This is a new post. I suppose I can write in here. Hands sticky again. Shoulder in bad place. Let's stop for now and stretch a bit, please :)