Skip to content

Instantly share code, notes, and snippets.

@masahirompp
masahirompp / generated.css
Last active October 12, 2020 12:12
tailwind css next-sibling margin
...
.-ml-px {
margin-left: -1px;
}
.child-siblings\:m-0 > * + * {
margin: 0;
}
.child-siblings\:m-1 > * + * {
margin: 0.25rem;
}
@masahirompp
masahirompp / jstTime.js
Last active September 24, 2021 07:40
Pure JavaScript JST Time
// どの環境で実行しても、JST時刻を取得する
const timeZoneOffset = 9 // JST
const getJstDate = () => {
const time = Date.now() // UTC millisecond
const date = new Date(time) // local date
const utcHours = date.getUTCHours() // UTC Hour
date.setHours(utcHours + timeZoneOffset) // UTC Hour + TimeZone Offset
return {
import withStyles, { WithStyles } from '@material-ui/core/styles/withStyles'
import TableCell from '@material-ui/core/TableCell'
import TableRow from '@material-ui/core/TableRow'
import * as React from 'react'
interface Props {
term: string
}
type ClassKey = 'term' | 'description'
@masahirompp
masahirompp / mui-datatables.d.ts
Last active September 4, 2018 02:45
mui-datatables types
declare module 'mui-datatables' {
interface CulumnOption {
display: boolean
filter: boolean
sort: boolean
customHeadRender: Function
customBodyRender: Function
}
interface ColumnProps {
declare module 'aws-api-gateway-client' {
import { AxiosResponse } from 'axios'
interface AwsApiGatewayClientConfig {
accessKey?: string
secretKey?: string
sessionToken?: string
region?: string
apiKey?: string
invokeUrl: string
@masahirompp
masahirompp / react-dnd.d.ts
Created November 3, 2017 08:37
react-dnd.d.ts
// fork https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dnd
// Type definitions for React DnD
// Project: https://github.com/gaearon/react-dnd
// TypeScript Version: 2.3
///<reference types="react" />
declare namespace __ReactDnd {
// Decorated React Components
@masahirompp
masahirompp / ClientWidth.tsx
Created October 23, 2017 07:57
React Component, get clientWidth
import * as React from 'react'
import { debounce } from 'lodash'
interface Props {
childrenAsFunction: (width: number) => JSX.Element
}
interface State {
width: number
}
/// <reference types="react" />
declare module 'react-popover' {
type Falsey = false | null | undefined
type Place = 'above' | 'right' | 'below' | 'left' | 'row' | 'column' | 'start' | 'end'
export interface PopoverProps extends React.HTMLAttributes<any> {
body: React.ReactNode | React.ReactNode[]
enterExitTransitionDurationMs?: number
isOpen?: boolean
offset?: number
@masahirompp
masahirompp / immutability-helper.d.ts
Created July 27, 2017 02:18
[experiment] Type definitions for immutability-helper
declare module "immutability-helper" {
type UpdateSpec<T> = {
[P in keyof T]?: UpdateSpec<T[P]> | UpdateSpecCommand<T[P]>
}
interface UpdateSpecCommand<S> {
$set?: S
// FIX ME. $pushm, $unshift, $spliceはSが配列の場合のみ使用できるようにしたい
$push?: S
@masahirompp
masahirompp / combination.ts
Last active May 6, 2017 09:56
配列のすべての組み合わせについて、関数を実行する。
import flatten from 'lodash-es/flatten'
/**
* 配列のすべての組み合わせについて、関数を実行する。
* @param fun 関数
* @param cols 配列
* @return {Array}
* @example
* combination((x,y)=>x*y, [1,2,3], [4,5,6])
* => [4,5,6,8,10,12,12,15,18]