Skip to content

Instantly share code, notes, and snippets.

View martinsione's full-sized avatar

Martin Sione martinsione

View GitHub Profile
// 1st attempt
type Arr<
T extends number,
Carry extends number[] = []
> = Carry['length'] extends T ? Carry : Arr<T, [0, ...Carry]>
type Add<A extends number, B extends number> = [...Arr<A>, ...Arr<B>]['length']
type Subtract<A extends number, B extends number> =
Arr<A> extends [...Arr<B>, ...infer R] ? R['length'] : 0
type Compute<
@martinsione
martinsione / building-sync-systems.md
Created October 26, 2023 01:55 — forked from pesterhazy/building-sync-systems.md
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

@martinsione
martinsione / component.tsx
Created September 25, 2023 23:36 — forked from ixahmedxi/component.tsx
React resizable panel
import { AnimatePresence, motion } from "framer-motion";
import { PropsWithChildren } from "react";
import useResizeObserver from "use-resize-observer";
const ignoreCircularReferences = () => {
const seen = new WeakSet();
return (key: string, value: Record<string, unknown>) => {
if (key.startsWith("_")) return;
if (typeof value === "object" && value !== null) {
if (seen.has(value)) return;
@martinsione
martinsione / benchmark-package-managers.md
Created March 20, 2023 22:58 — forked from belgattitude/benchmark-package-managers.md
Package managers comparison from the CI time perspective
@martinsione
martinsione / entradasV2.py
Created March 15, 2023 19:05 — forked from jmalvarez97/entradasV2.py
Script falopa para ver las entradas
import requests
from lxml import html
import time
from datetime import datetime
from tkinter import messagebox
from playsound import playsound
'''
Ya esta publicado en la pagina, pero no tiene ningun hipervinculo, sonara la alarma cuando se agrege alguno.
'''
type Props<TagName extends keyof JSX.IntrinsicElements | void = void> = {
as?: TagName;
children?: React.ReactNode;
attributes?: Attributes<TagName>;
};
export type Attributes<TagName = void, O = void> = Omit<
(TagName extends keyof JSX.IntrinsicElements
? JSX.IntrinsicElements[TagName]
function walkDOMTree(
root,
whatToShow = NodeFilter.SHOW_ALL,
{ inspect, collect, callback } = {}
) {
const walker = document.createTreeWalker(root, whatToShow, {
acceptNode(node) {
if (inspect && !inspect(node)) {
return NodeFilter.FILTER_REJECT;
}
@martinsione
martinsione / NFTixBooth.sol
Created March 30, 2022 22:06 — forked from ryancharris/NFTixBooth.sol
Final smart contract from my Egghead NFT course
pragma solidity >=0.8.0 <0.9.0;
//SPDX-License-Identifier: MIT
import "hardhat/console.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./Base64.sol";
import "@openzeppelin/contracts/access/Ownable.sol";