Skip to content

Instantly share code, notes, and snippets.

View BasixKOR's full-sized avatar

Sung Jeon BasixKOR

View GitHub Profile
@JLarky
JLarky / IsolateCSS.tsx
Last active July 10, 2023 09:23
How to use shadow dom to isolate CSS of React component https://twitter.com/JLarky/status/1657989891526123520
export function IsolateCSS(props: { children: React.ReactNode }) {
const onceRef = useRef(false);
const [shadowRoot, setShadowRoot] = useState<ShadowRoot>();
const ref = useCallback((ref: HTMLDivElement | null) => {
if (ref && onceRef.current === false) {
onceRef.current = true;
setShadowRoot(ref.attachShadow({ mode: 'open' }));
}
}, []);
@hyperupcall
hyperupcall / settings.jsonc
Last active June 26, 2025 09:47
VSCode config to disable popular extensions' annoyances (telemetry, notifications, welcome pages, etc.)
// I'm tired of extensions that automatically:
// - show welcome pages / walkthroughs
// - show release notes
// - send telemetry
// - recommend things
//
// This disables all of that stuff.
// If you have more config, leave a comment so I can add it!!
{
@kconner
kconner / macOS Internals.md
Last active July 10, 2025 04:32
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@wojtekmaj
wojtekmaj / jest-to-vitest.sh
Last active March 27, 2025 15:05
Automatically migrate Jest project to Vitest
#!/bin/bash
# Ensure we're working on the latest version of the main branch
git switch main
git fetch
git pull
# Create a new branch
git switch -c vitest
// ==UserScript==
// @name ASTx2 Emulator
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author @BawAppie
// @match https://*/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=ahnlab.com
// @grant none
// ==/UserScript==
@fabiospampinato
fabiospampinato / fast-npm-run.sh
Last active March 12, 2025 07:24
20x faster replacement for "npm run"
# 20x faster replacement for "npm run"
# - It supports scripts executing a built-in shell function
# - It supports scripts executing a binary found in PATH
# - It supports scripts executing a binary found in node_modules
# - It supports passing arguments and options to scripts
# - It supports reading scripts either via ripgrep (fast) or via jq (slower, but safer)
# - It adds ./node_modules/.bin to the $PATH
# - It handles gracefully when a script has not been found
# - It handles gracefully when "&", "&&", "|", "||", or ENV variables are used, falling back to "npm run"
@RReverser
RReverser / gist:2dc92bdd7c67ec734dc68b462f976182
Created December 29, 2022 20:21
JS <-> Rust Wasm conversion benchmarks
=====
parse
=====
canada x serde_json x 14.41 ops/sec ±3.31% (40 runs sampled)
canada x serde_wasm_bindgen x 90.55 ops/sec ±0.53% (77 runs sampled)
canada x msgpack x 101 ops/sec ±1.90% (72 runs sampled)
citm_catalog x serde_json x 131 ops/sec ±0.64% (83 runs sampled)
citm_catalog x serde_wasm_bindgen x 192 ops/sec ±1.02% (85 runs sampled)
citm_catalog x msgpack x 161 ops/sec ±1.09% (82 runs sampled)
twitter x serde_json x 203 ops/sec ±0.89% (85 runs sampled)
@jacob-ebey
jacob-ebey / deferred-overview.md
Last active February 28, 2025 05:42
Deferred Overview

Remix Deferred

Remix Deferred is currently implemented on top of React's Suspense model but is not limited to React. This will be a quick dive into how "promise over the wire" is accomplished.

SSR + Hydration

It isn't rocket science, but a quick recap of how frameworks such as react do SSR:

  1. Load data
  2. Render the app
// ==UserScript==
// @name jQuery ajax force async
// @version 1
// @grant none
// @run-at document-end
// @match https://stdict.korean.go.kr/search/*
// ==/UserScript==
const a = () => {
const ajax = window.$.ajax.bind(window.$)