Skip to content

Instantly share code, notes, and snippets.

View romgrk's full-sized avatar
♥️
hey

Rom Grk romgrk

♥️
hey
View GitHub Profile
/*
* BorrowMap: (possibly) zero-copy mutable data structure in a react context
* =========================================================================
*
* The idea behind this concept is that we can have a mutable container in a
* React-linked store but ONLY IF we never share a reference to the mutable
* container itself. All the reads must be contained inside selectors. As long
* as no one has a second reference to the mutable container, then we are sure
* that no one is able to read/write it without us knowing.
*
@romgrk
romgrk / gist:e22d00073999daaa403fb0979ecec964
Created January 2, 2025 23:52
dig +trace lolawho.com
$ dig +trace lolawho.com   refactor-agnostic-button-props
; <<>> DiG 9.20.4 <<>> +trace lolawho.com
;; global options: +cmd
. 241826 IN NS a.root-servers.net.
. 241826 IN NS b.root-servers.net.
. 241826 IN NS c.root-servers.net.
. 241826 IN NS d.root-servers.net.
. 241826 IN NS e.root-servers.net.
. 241826 IN NS f.root-servers.net.
const focusedVirtualCellSelector = createSelectorMemoizedV8(
gridRenderContextSelector,
gridFocusCellSelector,
currentRowsSelector,
visibleColumnsSelector,
(currentRenderContext, focusedCell, currentRows, visibleColumns) => {
if (!focusedCell) {
function wrapSx(Component) {
const newComponent = (props) => {
const { sx, ...rest } = props
rest.className = useSx(sx)
return Component(rest)
}
newComponent.displayName = Component.displayName ?? Component.name
return newComponent
import {
Box,
Paper,
Container,
} from '@mui/material'
import sx from '@mui/system/styleFunctionSx'
function Row() {
return (
<div>
@romgrk
romgrk / Slow.jsx
Created October 30, 2024 05:36
Simulated slow react component
const WAIT_DURATION = 2
function Slow() {
const start = Date.now()
while ((Date.now() - start) < WAIT_DURATION) {}
return (
<span>slow</span>
)
}
4375 Noah Lemen (2%) [META]
7122 Jack Pope (3%) [META]
14077 Jan Kassens (6%) [META]
15291 Sebastian Silbermann (7%) [VERCEL]
24125 Rick Hanlon (10%) [META]
25050 Ruslan Lesiutin (11%) [META]
25240 Andrew Clark (11%) [VERCEL]
41302 Josh Story (18%) [VERCEL]
58361 Sebastian Markbåge (25%) [VERCEL]
@romgrk
romgrk / gist:2c7f97363b1f5d580857bd560c7c1dfc
Created September 19, 2024 22:42
rg 'theme\.' $(fd . packages/x-data-grid*)
packages/x-data-grid-pro/src/hooks/features/columnReorder/useGridColumnReorder.tsx: (theme.direction === 'rtl'
packages/x-data-grid-pro/src/hooks/features/columnReorder/useGridColumnReorder.tsx: (theme.direction === 'rtl'
packages/x-data-grid-pro/src/hooks/features/columnReorder/useGridColumnReorder.tsx: [apiRef, logger, theme.direction],
packages/x-data-grid-pro/src/components/GridColumnMenuPinningItem.tsx: if (theme.direction === 'rtl') {
packages/x-data-grid-premium/src/components/GridGroupingColumnFooterCell.tsx: `calc(var(--DataGrid-cellOffsetMultiplier) * ${theme.spacing(props.rowNode.depth)})`;
packages/x-data-grid-pro/src/components/GridDetailPanel.tsx: backgroundColor: (theme.vars || theme).palette.background.default,
packages/x-data-grid-premium/src/components/GridAggregationHeader.tsx: fontSize: theme.typography.caption.fontSize,
packages/x-data-grid-premium/src/components/GridAggregationHeader.tsx: lineHeight: theme.typography.caption.fontSize,
packages/x-data-gri
@romgrk
romgrk / potato
Created September 12, 2024 23:37
f0VMRgIBAQAAAAAAAAAAAAIA8wABAAAAABAQAAAAAABAAAAAAAAAAJgxAAAAAAAAAAAAAEAAOAAE
AEAACAAGAAEAAAAEAAAAABAAAAAAAAAAABAAAAAAAAAAEAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQ
AAAAAAAAAQAAAAcAAAAAIAAAAAAAAAAQEAAAAAAAABAQAAAAAAB0AAAAAAAAAHQAAAAAAAAAABAA
AAAAAABR5XRkBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAMAAHAEAAAAByEAAAAAAAAAAAAAAAAAAAAAAAAAAAAALwAAAAAAAAAvAAAAAAAAAAEAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
const encoder = new TextEncoder()
// bufferLength must be a multiple of 4 to satisfy Int32Array constraints
let bufferLength = 2 * 1024
let buffer = new ArrayBuffer(bufferLength)
let uint8View = new Uint8Array(buffer)
let int32View = new Int32Array(buffer)
export function murmur2(str) {
if (str.length > bufferLength) {