Skip to content

Instantly share code, notes, and snippets.

View Luke-SNAW's full-sized avatar

Luke SNAW Luke-SNAW

View GitHub Profile
@Luke-SNAW
Luke-SNAW / blinkist-test.md
Created November 19, 2021 00:26
[test book summary test] #test
  • Booknotes ($89.99/year with over 700 titles – inferior to Blinkist in my view)
  • Snapreads ($14.99/month – 3 times as expensive as Blinkist, and again not worth it IMO)
  • ReadingIQ (for kids 2 to 12)
  • getAbstract (contains over 20,000 books, and has similar pricing to Blinkist – worth checking out)
  • Instaread (similar or identical pricing to Blinkist, though with under 1,000 total books)
  • BookRags (focused specifically on educational resources like essays and lesson plans)
  • Quiddity (a free service, but with only ~150 titles – worth checking out)
@Luke-SNAW
Luke-SNAW / after-install.sh
Last active January 26, 2022 07:17
[lightsail-bitnami-node, code deploy, auto run prisma project] #aws #prisma #bitnami #apache
#!/bin/bash
cd /home/bitnami/htdocs
export PATH=/opt/bitnami/node/bin:$PATH
export AS_JAVASCRIPT=true
# run on server at the first time only
## yarn install --frozen-lockfile
## npx prisma generate
## forever start -l forever.log -o out.log -e error.log dist/src/server.js # maybe needs -a, to append log
forever restart dist/src/server.js
@Luke-SNAW
Luke-SNAW / code-deploy--agent.md
Last active November 18, 2021 03:43
[config code deploy agent] #aws
@Luke-SNAW
Luke-SNAW / interview.md
Created November 18, 2021 01:31
[interview] #articles #interview
@Luke-SNAW
Luke-SNAW / devops-tools.md
Last active February 3, 2022 01:08
[devops] #collections #devops
  • Doppler: Sync environment variables at scale
@Luke-SNAW
Luke-SNAW / webpack.base.conf.js
Last active November 11, 2021 23:44
[node package transpile through babel - object rest spread] #babel
module.exports = {
module: {
rules: [
{
test: /\.mjs$/,
loader: 'babel-loader',
include: [resolve('node_modules/graphql')],
},
]
}
@Luke-SNAW
Luke-SNAW / javascript-tools__security.md
Last active November 8, 2021 23:30
[Javascript tools about security] #articles #security
  • RetireJS
  • Cookies: is a node.js module for getting and setting HTTP(S) cookies. Cookies can be signed to prevent tampering, using Keygrip. It can be used with the built-in node.js HTTP library, or as Connect/Express middleware.
  • DOMPurify: is a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG.

State updates using this.setState or useState do not immediately mutate the state but create a pending state transition.

Why is State Update Async?

State updates alter the virtual DOM and cause re-rendering which may be an expensive operation. Making state updates synchronous could make the browser unresponsive due to huge number of updates.

To avoid these issues a careful choice was made to make state updates async, as well as to batch those updates.

So, why do we have distinct behaviour in the above scenarios?

<label for="content">Type something</label>
<div class="autogrow">
	<textarea id="content" onInput="this.parentNode.setAttribute('data-replicated-value', this.value)" onload="this.parentNode.setAttribute('data-replicated-value', this.value)"></textarea>
</div>
.autogrow {
	display: grid;