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 / User.ts
Last active Feb 15, 2019
mongoose + typescript
View User.ts
/// <reference path="../tsd/tsd.d.ts" />
import mongoose = require('mongoose');
import passport = require('passport');
interface IUser extends mongoose.Document {
provider: string;
id: string;
authorId: string;
displayName: string;
@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 / Author.ts
Last active Oct 18, 2018
typescript + mongoose
View Author.ts
/// <reference path="../typings/tsd.d.ts" />
import db = require('../db/db');
import IAuthorDocument = require('../db/IAuthorDocument');
class Author {
private _author:IAuthorDocument;
constructor(author:IAuthorDocument) {
this._author = author;
@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
View react-svg-pan-zoom.d.ts
declare module 'react-svg-pan-zoom' {
import * as React from 'react'
type Tool = 'auto' | 'none' | 'pan' | 'zoom-in' | 'zoom-out'
type ToolBarPosition = 'none' | 'top' | 'right' | 'bottom' | 'left'
export const ReactSVGPanZoom: ReactSVGPanZoom
interface ReactSVGPanZoom extends React.ComponentClass<ReactSVGPanZoomProps> {}
You can’t perform that action at this time.