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
{ | |
"$schema": "http://json-schema.org/draft-07/schema#", | |
"type": "object", | |
"properties": | |
{ | |
"global": | |
{ | |
"$ref": "#/definitions/global" | |
}, | |
"profiles": |
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 { JSONSchema7 as JSONSchema } from "json-schema"; | |
export type MapLike<K extends string, T> = { | |
[key in K]: T; | |
}; | |
/** | |
* @see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#serverVariableObject | |
*/ | |
export interface ServerVariable { |
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
const updateQueryStringParameter = (key: string, value: string): void => { | |
const searchParams = new URLSearchParams(window.location.search); | |
const params = {}; | |
searchParams.forEach((v, k) => { | |
params[k] = v; | |
}); | |
if (value === "") { | |
delete params[key]; | |
} else { | |
params[key] = value; |
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
/** | |
* すでに生成されたインスタンスから、新しいインスタンスを生成する | |
* https://stackoverflow.com/questions/41474986/how-to-clone-a-javascript-es6-class-instance | |
* @param instance | |
*/ | |
const cloneInstance = <T>(instance: T): T => Object.assign(Object.create(Object.getPrototypeOf(instance)), instance); |
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
declare module namespace { | |
export interface Comments { | |
href: string; | |
} | |
export interface Commits { | |
href: string; | |
} |
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
{ | |
"schemaVersion": 2, | |
"mediaType": "application/vnd.docker.distribution.manifest.v2+json", | |
"config": { | |
"mediaType": "application/vnd.docker.container.image.v1+json", | |
"size": 7753, | |
"digest": "sha256:451b716593e5f4b35826c8f869950135b925e74d0ed0a40b7c794b8a54ce9b39" | |
}, | |
"layers": [ | |
{ |
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
// https://github.com/sindresorhus/type-fest/blob/master/source/omit.d.ts | |
type Omit<ObjectType, KeysType extends keyof ObjectType> = Pick<ObjectType, Exclude<keyof ObjectType, KeysType>>; | |
interface A1 { | |
type: "a1"; | |
a1: string; | |
} | |
interface A2 extends Omit<A1, "type"> { | |
type: "a2"; |
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
const a = Array(100000).fill(Math.random()); | |
const b = Array(100000).fill(Math.random()); | |
const benchmark = (func, repeat) => { | |
const result = []; | |
Array(repeat) | |
.fill(1) | |
.map(() => { | |
const start = window.performance.now(); | |
func(); |
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 OnResizeFunction = (size: { width: number; height: number }) => void; | |
export const useOnResize = <T extends React.MutableRefObject<any | null>>(ref: T, onResize: OnResizeFunction) => { | |
React.useEffect(() => { | |
const callback = () => { | |
if (ref.current) { | |
onResize({ | |
width: ref.current.clientWidth, | |
height: ref.current.clientHeight, | |
}); |
NewerOlder