some my solutions for type-challenges
π£
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
| type Theme = 'system' | 'dark' | 'light' | |
| export default function useTheme() { | |
| const [theme, setTheme] = useState<Theme>(() => { | |
| if (typeof localStorage === 'undefined') return 'system' | |
| return (localStorage.getItem('theme') as Theme) || 'system' | |
| }) | |
| useEffect(() => { | |
| const root = document.documentElement |
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
| # enable run remote script | |
| Set-ExecutionPolicy RemoteSigned -Scope CurrentUser | |
| # Scoop configruation | |
| $env:SCOOP = 'E:\scoop' # custom scoop install dir | |
| $env:SCOOP_GLOBAL = 'E:\scoop\apps' # custom scoop app install dir | |
| [environment]::setEnvironmentVariable('SCOOP_GLOBAL', $env:SCOOP_GLOBAL, 'Machine') | |
| [environment]::setEnvironmentVariable('SCOOP', $env:SCOOP, 'User') | |
| Invoke-WebRequest -useb get.scoop.sh | Invoke-Expression |
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
| const arr = [new Date(), new RegExp(''), new String('test'), 'test', /test/, new Number(1), 1, BigInt(1), 1n] | |
| type InferConstructorType<C> = C extends DateConstructor ? Date : C extends ((...args: any[]) => infer T) | (new (...args: any[]) => infer T) ? | |
| T : unknown | |
| function filterInstance<Constructor extends ((...args: any[]) => any) | (new (...args: any[]) => any)>( | |
| t: Constructor | |
| ) { | |
| return (item: any, _index: number, _arr: any[]): item is InferConstructorType<Constructor> => { | |
| if (typeof item === 'object') { |
I hereby claim:
- I am enpitsuLin on github.
- I am enpitsulin (https://keybase.io/enpitsulin) on keybase.
- I have a public key whose fingerprint is 0672 CB81 76D0 9B46 A823 B81C 85C8 36DC 516B 372C
To claim this, I am signing this object:
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
| π₯ ηηδΈδΈη± - ε΄ι¨ι Β· 0 plays | |
| π₯ Cage - Tielle/SawanoHiroyuki[nZk] Β· 0 plays | |
| π₯ βStrangerβε―ζ»δ»₯θ§£θ±οΌγδ» δΈδΊΊγζζOSTοΌοΌηΏ»θͺ AliοΌ - STRANGER_BTS/ε€§ζ‘ε/δ½ηδΈΆ Β· 0 plays | |
| ε εΉ΄δΉε€ - G.E.M.ιη΄«ζ£ Β· 0 plays | |
| γ«γΏγͺγ’γ€ - Aimer Β· 0 plays |
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
| exports.onCreateWebpackConfig = ({ actions }) => { | |
| actions.setWebpackConfig({ | |
| resolve: { | |
| alias: { | |
| // alias like webpack configuration | |
| '@': path.join(__dirname, './src') | |
| } | |
| } | |
| }); | |
| }; |
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
| TypeScript 14 hrs 49 mins βββββββββββββββββββββ 71.3% | |
| JavaScript 2 hrs 56 mins βββββββββββββββββββββ 14.2% | |
| Other 1 hr 3 mins βββββββββββββββββββββ 5.1% | |
| JSON 59 mins βββββββββββββββββββββ 4.8% | |
| Diff 36 mins βββββββββββββββββββββ 2.9% |
NewerOlder