Skip to content

Instantly share code, notes, and snippets.

View EnzoPortela's full-sized avatar

Enzo Portela EnzoPortela

View GitHub Profile
@EnzoPortela
EnzoPortela / .gitconfig
Last active October 2, 2023 00:04
enzo-gitconfig
[user]
name = Enzo Portela
email = enzoportela2003@gmail.com
[commit]
gpgsign = false
[core]
editor = code --wait
# [push]
# followTags = true
[alias]
@EnzoPortela
EnzoPortela / DeferList.tsx
Created April 23, 2023 11:43
React component to render giants lists
export function Defer({ chunkSize, children }: DeferProps) {
const [renderedItemsCount, setRenderedItemsCount] = useState(chunkSize);
const childrenArray = useMemo(
() => Children.toArray(children),
[children]
);
useEffect(() => {
if (renderedItemsCount < childrenArray.length) {
@EnzoPortela
EnzoPortela / streams.js
Created March 5, 2023 01:32
Streams in Node.js - Simple demo
import { Readable, Writable, Transform } from "node:stream";
class OneToHundredStream extends Readable {
index = 1;
_read() {
const i = this.index++;
setTimeout(() => {
if (i > 100) {