Skip to content

Instantly share code, notes, and snippets.

@tiensonqin
tiensonqin / playground.clj
Created April 10, 2024 13:41
Property key-value pairs as entities
(def conn (d/create-conn {:db/ident {:db/unique :db.unique/identity}
:block/uuid {:db/unique :db.unique/identity}
:block/content {}
:block/properties {:db/valueType :db.type/ref
:db/cardinality :db.cardinality/many
:db/isComponent true}
:property-value/property {:db/valueType :db.type/ref}}))
;; Add internal properties
(d/transact! conn [{:db/ident :logseq.property/created-by
@tiensonqin
tiensonqin / logseq-queries.md
Created December 5, 2022 04:44
Initial input for chatgpt
  • What are "Queries" in Logseq?
    • Queries are for asking questions from your knowledge base and the outside world.
      • How to write simple queries?
        • By using {{query }}, the format is something like this:
        {{query Something you're looking for}}
        
  • **Query Operators ** These three operators can be applied around any query filters.
    • and
@tiensonqin
tiensonqin / sort_page_blocks.clj
Created August 8, 2022 00:09
Sort page blocks for Logseq
;; Logseq's block order is determined by both :block/parent and :block/left.
;;
;; Let's say we have a list like this:
;; - 1
;; - 1.1
;; - 1.2
;; - 2
;;
;; Block `2`'s left is block 1, block `1.2`'s left is block `1.1`,
;; Block `1.2`'s left and parent is block `1`.
@tiensonqin
tiensonqin / HelveticaRegular.fnt
Created July 5, 2021 03:02 — forked from zakjan/HelveticaRegular.fnt
HelveticaRegular.fnt
<?xml version='1.0'?>
<font>
<info aa='1' size='50' smooth='1' stretchH='100' bold='0' padding='0,0,0,0' spacing='0,0' charset='' italic='0' unicode='0' face='HelveticaRegular'/>
<common scaleW='384' packed='0' pages='1' lineHeight='50' scaleH='320' base='39'/>
<pages>
<page id='0' file='HelveticaRegular.png'/>
</pages>
<chars count='95'>
<char xadvance='14' x='46' chnl='0' yoffset='39' y='42' xoffset='0' id='32' page='0' height='0' width='0'/>
<char xadvance='14' x='226' chnl='0' yoffset='3' y='200' xoffset='6' id='33' page='0' height='38' width='8'/>
  • [[Logseq School]] #.v-kanban #.v-kanban
    • [[Plugins 101]]
      • [[Plugins 01]]
      • [[Plugins 02 - Build a mind map plugin]]
    • [[Outliner 101]]
      • [[Outliner 01]]
      • [[Outliner 02]]
  • [[Document syntax]] #.v-numlist #.v-numlist
    • [[Markdown]]
    • [[Org Mode]]
@tiensonqin
tiensonqin / config.edn
Created April 7, 2021 16:12
Logseq default config.edn
{;; Currently, we support either "Markdown" or "Org".
;; This can overwrite your global preference so that
;; maybe your personal preferred format is Org but you'd
;; need to use Markdown for some projects.
;; :preferred-format ""
;; Preferred workflow style.
;; Value is either ":now" for NOW/LATER style,
;; or ":todo" for TODO/DOING style.
:preferred-workflow :now
;; Because in formal logic, ∀x.P(x) = ¬∃x.¬P(x)
(d/q '[:find ?id
:in $ [?interest ...]
:where
[?a :account/id ?id]
(not-join [?a ?interest]
[?a :account/interest ?i]
(not [(= ?i ?interest)]))])
;; It is harder to understand when you bind interest as above if you
[[{{{url}}}][{{{title}}}]] #Article
*** *Summary*
{{#Notes}}
**** {{{NoteText}}}
{{/Notes}}
*** *Highlights*
{{#Notes}}
**** {{{NoteHighlight}}}
{{/Notes}}
@tiensonqin
tiensonqin / query
Created September 24, 2020 02:19
Logseq queries example (using properties) and custom view
#+BEGIN_QUERY
{:title [:h2 "Programming languages list"]
:query [:find (pull ?b [*])
:where
[?b :block/properties ?p]
[(get ?p "type") ?t]
[(= "programming_lang" ?t)]]
:view (fn [result]
(when (seq result)
(let [blocks (flatten result)]
@tiensonqin
tiensonqin / logseq_schema.clj
Last active October 16, 2023 09:38
Logseq datascript schema
(def schema
{:db/ident {:db/unique :db.unique/identity}
;; user
:me/name {}
:me/email {}
:me/avatar {}
;; local, github, dropbox, etc.
:db/type {}