Skip to content

Instantly share code, notes, and snippets.

masahirompp masahirompp

Block or report user

Report or block masahirompp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@masahirompp
masahirompp / jstTime.js
Last active Dec 7, 2018
Pure JavaScript JST Time
View jstTime.js
// どの環境で実行しても、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 {
View DefinitionItem.tsx
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 Sep 4, 2018
mui-datatables types
View mui-datatables.d.ts
declare module 'mui-datatables' {
interface CulumnOption {
display: boolean
filter: boolean
sort: boolean
customHeadRender: Function
customBodyRender: Function
}
interface ColumnProps {
View aws-api-gateway-client.d.ts
declare module 'aws-api-gateway-client' {
import { AxiosResponse } from 'axios'
interface AwsApiGatewayClientConfig {
accessKey?: string
secretKey?: string
sessionToken?: string
region?: string
apiKey?: string
invokeUrl: string
View 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 Oct 23, 2017
React Component, get clientWidth
View ClientWidth.tsx
import * as React from 'react'
import { debounce } from 'lodash'
interface Props {
childrenAsFunction: (width: number) => JSX.Element
}
interface State {
width: number
}
View react-popover.d.ts
/// <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 Jul 27, 2017
[experiment] Type definitions for immutability-helper
View immutability-helper.d.ts
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
配列のすべての組み合わせについて、関数を実行する。
View combination.ts
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]
View EventHelper.js
export function preventDefault (func, ...args) {
return e => {
e.preventDefault()
func(...args)
}
}
export function targetValue (func, ...args) {
return e => {
func(e.target.value, ...args)
You can’t perform that action at this time.