Skip to content

Instantly share code, notes, and snippets.

# Block these pesky procrastinators
news.ycombinator.com
youtube.com
www.youtube.com
twitter.com
www.twitter.com
twimg.com
abs.twimg.com
@marekpiechut
marekpiechut / pihole-all-social-media.txt
Created November 11, 2022 11:14
PiHole blocklist for all social media
# This blocklist helps Pi-hole's admin restrict access to Facebook and its domains.
# Curated from sources online.
# Last updated: 9 december 2019
apps.facebook.com
connect.facebook.net
facebook.com
ru-ru.facebook.com
nl-nl.facebook.com
nl-be.facebook.com
const App = () => {
const loadData = id => ({ id, value: 'some' })
const [_, setDummy] = useState()
return (
<div className="App">
<button onClick={() => setDummy(Date.now())} />
<SlowComponent
onClick={React.useCallback(() => loadData('dummy'), [])}
/>
const App = () => {
const loadData = id => ({ id, value: 'some' })
const [_, setDummy] = useState()
return (
<div className="App">
<button onClick={() => setDummy(Date.now())}>Render</button>
<SlowComponent onClick={() => loadData('dummy')} />
</div>
)
const SlowComponent = React.memo(({ text, onClick }) => {
const arr = []
for (var i = 1000000 - 1; i >= 0; i--) {
arr.push(i)
}
return (
<div>
<div>I'm slow {text}</div>
<button onClick={onClick}/>
</div>
adb reverse tcp:8097 tcp:8097
<script src="http://localhost:8097"></script>
npm install -g react-devtools
react-devtools
import {
unstable_trace as trace,
unstable_wrap as wrap,
} from 'scheduler/tracing'
const useData = () => {
const [loading, setLoading] = useState(false)
const [data, setData] = useState(null)
const fetch = () => {
import {
unstable_trace as trace,
unstable_wrap as wrap,
} from 'scheduler/tracing'
<button
onClick={() =>
trace('Fetch data', performance.now(), () => {
setLoading(true)
fetchData()