🤷♂️
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
// --- fetch | |
const count = await fetch("https://heirroom.coffee/api/coffee/count", { | |
headers: { | |
accept: "*/*", | |
"accept-language": "ja,en;q=0.9,en-US;q=0.8,pt;q=0.7,el;q=0.6", | |
"content-type": "text/plain;charset=UTF-8", | |
"sec-ch-ua": | |
'"Not A(Brand";v="99", "Google Chrome";v="121", "Chromium";v="121"', | |
"sec-ch-ua-mobile": "?0", | |
"sec-ch-ua-platform": '"macOS"', |
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 { renderHook, act } from '@testing-library/react-hooks' | |
import { AppState, AppStateStatus } from 'react-native' | |
let appStateAddEventListenerHandlerMock: ( | |
nextAppStateStatus: AppStateStatus, | |
) => void | |
// NOTE: fetchをモックしておくためにglobalに型を生やす | |
type FetchMock = NodeJS.Global & { | |
fetch: unknown |
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
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
Ctrl::!` ; controlキーで日本語/英語切り替え(Alt+`) | |
LCtrl & Tab:: AltTab | |
!Tab:: Send ^{Tab} | |
!+Tab:: Send ^+{Tab} |
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
/* | |
* PlayGroundはこれ | |
* https://www.typescriptlang.org/play/index.html#code/PTAEAUCcHsFsEsDOBTAPAOwK6wEbMqAD6iboAmyAZvOsmQHygC8jUcSaWu+jg1gyDqDIH0GQCIMAWABQEkKEBSDIFUGQJEMY8QBcAngAdkoAHKZSzUFzwFipCtVpkJ6rbujo9AGyc6AjIZ0PnTgIY4nND1SegkpMDYEFEBo9UA7BkAi1MAHU0AkhkATBkB5BkBohgkAYwdEFVBKaGhDX0Q1dBzQAAp0AC4jbBMASmZGdFBGNwAGUAB+I1BG8yoaOjDxaQAlZBVMSHQAFU1kQHMGQBX4wCiGQBIFWOjkwCaGQGGGQAmGG1XQWZUAMRLDa4Xl1dRbZGhKIpLQySmwL0cmBcgA0GQDBDIArBmEgDICC52AE+a53UpMeyAlz+QKoRHfSYzOZPFZafiAMwZhJlANIMCkA+P9vD4ksmUqntUCAAl9ACzmvEAIQyAYwZiYB-Bmyqku4GCnRRkQ4GGa+CIJHIYysP2kgEhNQDxDLzITChXZwJ5vEC-AE0CL9OgfuFQAALFQqDSIeogADm8BUlswOAAdHlYMBEDQyJBkIhoJA3YhgG8ALSUIMqWHaCUoABqvicmGNMCiyEJyAANKAAPKu-AAdw4hkT2dWjHFmY4OdAyAAHipkOREBA6yhUDQYwQU2nkIxBgP08NC8XIGWUABueOgACCFSqN1IORU8AchhqHt3vkgjvtoF86DUAG0ALptFid9jd0gAa3Q0BLZrn2u0S8qOUeixzqCWfdHTmRsWzbMgOy-Fc1w3Bwa1vLNRzQX9ni0ACgLmeh6HfC1K1ibZohOU41kAWQZiUAAHNAA2s+cAGVfHgB9oEwCsu2QJDUBNEILRQnNYkrQAJJ2ZPCCKI0iKOoj9QDohimIAJkMKCf3xP8XlpT5imgJUIlY-CtgOeEDV4MSqNo+jGMwABmPU0UNTFpPM2TzT+UBhEACQZAB+GZQ3g |
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
{ | |
"name": "npm-scripts-fun", | |
"version": "1.0.0", | |
"main": "index.js", | |
"license": "MIT", | |
"scripts": { | |
"postinstall": "npx typesync && git diff --exit-code --quiet HEAD package.json || yarn --ignore-scripts" | |
}, | |
"dependencies": { | |
"react": "^16.8.6" |
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
/* eslint-disable @typescript-eslint/no-explicit-any */ | |
export type HTMLElementEventHandlers<U extends keyof HTMLElementEventMap> = { | |
[K in U]: (event: HTMLElementEventMap[K]) => any | |
} |
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 { useRef, useCallback, useEffect, useLayoutEffect } from 'react' | |
/* eslint-disable @typescript-eslint/no-explicit-any */ | |
/** | |
* | |
* @description For reference state value on event handler. | |
* @see https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback | |
* @see https://github.com/facebook/react/issues/14099 | |
* @todo `unknown` type loos better than `any`. But can't use unknown……Error message "Type 'unknown' is not assignable to type ~" why?? |
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
{ | |
"parser": "@typescript-eslint/parser", | |
"parserOptions": { | |
"project": "./tsconfig.json", | |
"tsconfigRootDir": "." | |
}, | |
"env": { | |
"browser": true, | |
"jest/globals": true | |
}, |
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
export const getElementRects = (element: HTMLElement) => { | |
const heightWithPadding = element.getBoundingClientRect().height | |
const heightWithoutPadding = () => { | |
if (!getComputedStyle) return 0 | |
const { paddingTop, paddingBottom } = getComputedStyle(element) | |
const padding = | |
parseFloat(paddingTop ? paddingTop : '0') + |
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
$ yarn add -D @types/react-collapsible @types/react-dom @types/react-image-gallery @types/react-modal @types/react-router-dom @types/react-swipeable-views @types/react-virtualized |
NewerOlder