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 axios from "axios"; | |
export type Country = { | |
name: Name; | |
tld?: string[]; | |
cca2: string; | |
ccn3?: string; | |
cca3: string; | |
cioc?: string; | |
independent?: boolean; |
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 fs from "fs"; | |
import ts from "typescript"; | |
const isType = (node: ts.Node) => | |
ts.isTypeAliasDeclaration(node) || | |
(ts.isInterfaceDeclaration(node) && node.name && node.name); | |
type DocEntry = { | |
name?: string; | |
fileName?: 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
import { formatISO,parse } from "date-fns"; | |
const getUtcDate = (date: Date) => { | |
const r = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}).(\d{3})/; | |
const [, ...s] = r.exec(date.toISOString())!; | |
return (Date.UTC as any)(...s); | |
}; | |
const parseFromFormat = (strDate: string, format: string) => { | |
const p = parse("2020.10.06 09:24:06", "yyyy.MM.dd HH:mm:ss", new Date()); | |
const utc = getUtcDate(p); |
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 { assocPath } from "ramda"; | |
import { useClassNames } from "hulks"; | |
import React, { | |
Fragment, | |
useCallback, | |
useEffect, | |
useMemo, | |
useState, | |
} from "react"; | |
import { Arrow } from "./arrow"; |
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 axios, { AxiosInstance, AxiosRequestConfig, AxiosStatic, CancelTokenSource } from "axios"; | |
import { useCallback, useEffect, useMemo, useRef } from "react"; | |
type Tokens = { [k: string]: CancelTokenSource | undefined }; | |
const createUid = () => Math.random().toString(36).substring(16); | |
type Http = "get" | "head" | "options" | "delete"; | |
type HttpBody = "post" | "put" | "patch"; |
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 axios, { AxiosInstance, AxiosRequestConfig, AxiosStatic, CancelTokenSource } from "axios"; | |
import { useCallback, useEffect, useMemo, useRef } from "react"; | |
type Tokens = { [k: string]: CancelTokenSource | undefined }; | |
const createUid = () => | |
Math.random() | |
.toString(36) | |
.substring(16); |
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 classNamesDedupe from "classnames/dedupe"; | |
import React, { useState, DependencyList, useMemo } from "react"; | |
type ClassArray = ClassValue[]; | |
type ClassDictionary = { [id: string]: any }; | |
export type ClassValue = string | number | ClassDictionary | ClassArray | undefined | null | boolean; | |
export const useClassNames = (dependency: DependencyList, ...classes: ClassValue[]) => |
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, { useLayoutEffect, useMemo, useState } from "react"; | |
import { useClassNames } from "styleguide"; | |
type Html = React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; | |
type StyledArgs<E, T> = ((args: E & T) => string | number) | string | number; | |
function Styled<ExtraProps = unknown, Element = Html>(tag: string) { | |
return ([first, ...placeholders]: TemplateStringsArray, ...a: StyledArgs<Element, ExtraProps>[]) => { | |
return ({ children, ...props }: Html & ExtraProps) => { |
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, { useLayoutEffect, useMemo } from "react"; | |
import { useClassNames } from "styleguide"; | |
const AD_REPLACER_R = /(a)(d)/gi; | |
const charsLength = 52; | |
const getAlphabeticChar = (code: number) => String.fromCharCode(code + (code > 25 ? 39 : 97)); | |
function generateAlphabeticName(code: number) { | |
let name = ""; | |
let x; |
NewerOlder