collection of things i learn "today", revised & expand sometime not today.
db/id in logseq use block/uuid instead
astro component const {default: Component} = await import(`../d/${name}.astro`)
---
<Component/> suspense with keys using <Suspend> causing trouble for old router of next.js
specifying key outside of suspense boundaries help reseting it and things magically work again
react suck
https://react.dev/reference/react/Suspense#resetting-suspense-boundaries-on-navigation
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


free as in free beer is different than free as in free speech popover is native to the web now onPointerDownOutSide={e=>e.preventDefault()} 1.1% for online transaction like steam, spotify, aliexpress 1% of the amount + 10% VAT of that 1%
abbreviate for “Most Advance. Yet Accessible”

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

pull useful to perform nested query to find children of parent in the search
process.cwd() to get current directory canvas properly use ctx.translate(0.5, 0.5) to avoid 0.5px line at border
before

after

(not template) to exclude template from queries 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
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.
font hinting is not needed when your screen have over 300dpi or ppi
that’s why kindle e-ink only need 300ppi
https://www.sven.de/dpi/ calculating dpi
empty string is not a valid JSON, hence JSON.parse("") will throw error
getStaticProps getStaticPaths can not be re-export like NextPage as it would break nextjs’s treeshaking 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,…
/api folder to serve api function in node form attribute to an id in <form> tag
useful for design parentless form
Place code as close to where it’s relevant as possible
:view (fn [result] (for [r result] [:pre (pprint r)])) export const validate = async (
data: PromoCreateCode,
): Promise<boolean | Error> => {
try {
await schema.validate(data, {
abortEarly: false,
});
return true;
} catch (errors) {
return {
errors: errors.inner.reduce(
(allErrors: Error, currentError: ValidationError) => ({
...allErrors,
[currentError.path as string]: {
type: currentError.type ?? 'validation',
message: currentError.message,
},
}),
{},
),
};
}
}; readmore:
this small snippet will aggregate error into its object path and emit message and type for the schema.
yup context and condition validation #yup
timedate-local https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local
work with system locale
AM/PM according to system clock
undefined JSON.stringify will not serialized undefined field
