- https://lukeberrypi.vercel.app
- @lukeberrypi
- https://youtube.com/lukeberrypi
This file contains 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
// go to https://www.youtube.com/feed/channels | |
// paste the code and hit enter | |
(async () => { | |
const UNSUBSCRIBE_DELAY_TIME = 2000; | |
const runAfterDelay = (fn, delay) => | |
new Promise((resolve) => setTimeout(() => resolve(fn()), delay)); |
This file contains 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, {Dispatch, SetStateAction, useCallback, useRef, useState} from 'react'; | |
import {Input, TamaguiElement, XStack} from 'tamagui'; | |
import * as Clipboard from 'expo-clipboard'; | |
import {Keyboard} from 'react-native'; | |
type Props = { | |
setState: Dispatch<SetStateAction<string>>; | |
}; | |
type Code = { |
This file contains 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
defmodule LongestCommonPrefix do | |
@spec run([String.t()]) :: String.t() | |
def run(strings) do | |
strings | |
|> Stream.map(&String.graphemes/1) | |
|> Stream.zip_with(&Function.identity/1) | |
|> Stream.take_while(&all_same?/1) | |
|> Stream.map(&hd/1) | |
|> Enum.join() | |
end |
This file contains 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
type Reverse<A> = | |
`${A}` extends `${infer AH}${infer AT}` | |
? `${Reverse<AT>}${AH}` : A | |
type Digs = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
type DigsNext<I = Digs, R = {}> = | |
I extends [infer Head, infer Next, ...infer Tail] | |
? DigsNext<[Next, ...Tail], R & Record<Head, Next>> | |
: { [K in keyof R]: R[K] } |