today i learned

collection of things i learn "today", revised & expand sometime not today.
2023/12/14
it is not possible to query by db/id in logseq
2023/12/11
dynamic import astro component
  • const {default: Component} = await import(`../d/${name}.astro`)
    ---
    <Component/>
2023/11/28
2023/11/23
resetting suspense with keys
2023/11/22
narrowing with includes and is
  • TODO should try and document this

    • expands and something

    • satisfies, is, T extends Interface, etc..

    • step by step to create pseudo translation utils

    • support autocompletion with typescript

  • image.png

  • image.png

2023/11/20
2023/11/19
popover is native to the web now
2023/11/16
disable modal clicking outside using onPointerDownOutSide={e=>e.preventDefault()}
2023/11/15
there’s a processing fee at least 1.1% for online transaction like steam, spotify, aliexpress
  • 1% of the amount + 10% VAT of that 1%

2023/11/11
MAYA rule
  • abbreviate for “Most Advance. Yet Accessible”

  • image.png

2023/11/09
vite eval the whole file when import, so import things using vite before init vite is not recommend
  • such as bundle both astro:integration and astro components into single index.ts file

2023/11/07
deploying by webhook using cloudflare and apple shortcut
  • image.png

2023/11/04
reverse lookup attribute in pull
2023/04/10
use process.cwd() to get current directory
2023/04/08
how to rotate a vector
2023/04/06
scaling canvas properly
2023/04/03
show scrollbar options
  • before

    • image.png

  • after

    • image.png

2023/04/02
2023/03/30
use (not template) to exclude template from queries
2022/09/13
tab vs space
  • use tab always

    • can always use tabstop, tabsize to change the content

    • ways easier to read

    • example

      • a codebase with 2 space as 1 tab can not convert to 4 space or 8 space

      • but with tab, things can change easily, plus accessibility

2022/06/30
2022/06/29
2022/06/03
punctuation of parenthesis
  • When writing in English (not a programming language or math), the rule is: put a space before the opening parenthesis, and either a space or a punctuation mark after the closing parenthesis.

2022/05/09
monitor events with chrome dev tools
everything is pretty if it have enough pixel
2022/05/03
border radius can do something like this
2022/05/01
json stringify and parse
2022/04/23
getStaticProps getStaticPaths can not be re-export like NextPage as it would break nextjs’s treeshaking
rewrite vs redirect
  • rewrite only happen on server, the client or the browser don’t know about this

  • redirect happen in both server and client

    • reflected on the url bar in the browser

    • issue some http/status code like 301, 302, 307, etc,…

2022/04/09
only need /api folder to serve api function in node
2022/04/06
form attribute
2022/03/30
colocation in react
2022/03/03
inspect block data in logseq
  • :view (fn [result] (for [r result] [:pre (pprint r)]))
2022/02/23
yup validation for simple object, simple form
2022/02/22
timedate-local
safely remove a key, set it to undefined