Inspired from this blog post. If you want to change return type from void to unknown, be my guest.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function sum(a) { | |
| if(a == null) return 0 | |
| return b => b == null ? a : sum(a + b) | |
| } | |
| /* | |
| sum() // 0 | |
| sum(1) // 1 | |
| sum(1)(2)() // 3 |
Download and install using https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL/releases
Uninstall using wsl --unregister fedoraremix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print("Clap along if you feel like that's what you wanna do") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| call plug#begin() | |
| Plug 'theHamsta/nvim-treesitter', {'branch': 'ecma-auto-comment', 'do': ':TSUpdate'} | |
| call plug#end() | |
| set fillchars=eob:\ , | |
| set shm+=Ic | |
| set noswapfile | |
| set lazyredraw | |
| set modelines=0 | |
| set number relativenumber |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | |
| export function debounce<F extends (...arguments_: any) => any>( | |
| function_: F, | |
| wait = 200 | |
| ): F { | |
| let timeoutID: number; | |
| return function (this: unknown, ...arguments_: Parameters<F>) { | |
| clearTimeout(timeoutID); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import type { ReactNode } from 'react'; | |
| import { useEffect, useRef } from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| interface Props { | |
| rootId: string; | |
| children: ReactNode; | |
| } | |
| export const Portal = ({ rootId, children }: Immutable<Props>) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useCallback, useState } from 'react' | |
| import { useForm } from 'react-hook-form' | |
| import useSignal from 'utils/hooks/useSignal' | |
| import useAsync, { AsyncState } from 'utils/hooks/useAsync' | |
| const UpdateUserForm = () => { | |
| const signal = useSignal() | |
| const { getValues, /* ... */ reset: resetForm } = useForm<FormData>({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface Props { | |
| value?: string; | |
| onChange?: (value: string) => void; | |
| } | |
| export function OutboundSelect<T>({ | |
| value: externalValue, | |
| onChange: externalOnChange = noop, | |
| }: Props) { | |
| const [value, onChange, isInternalValueUsed] = useAutoControlled( |