Skip to content

Instantly share code, notes, and snippets.

🐍
Dance

elzup elzup

🐍
Dance
Block or report user

Report or block elzup

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
@elzup
elzup / gh-pages.yml
Created Oct 9, 2019
GithubActions gh-pages deploy
View gh-pages.yml
name: GitHub Pages
on:
push:
branches:
- master
jobs:
build-deploy:
@elzup
elzup / trump.js
Created Sep 25, 2019
trump flowtype
View trump.js
// @flow
type Color = 'red' | 'black';
const RED = 'red';
const BLACK = 'black';
type Mark = {|name: string, color: Color|};
const SPADE: Mark = {name: 'S', color: BLACK};
const HEART: Mark = {name: 'H', color: RED};
const CLUB: Mark = {name: 'C', color: BLACK};
@elzup
elzup / has31.js
Created Mar 31, 2019
Does month have 31days
View has31.js
const has31 = month => Boolean((month & 1) ^ ((month >> 3) & 1))
test('1-12', () => {
expect(has31(1)).toMatchInlineSnapshot(`true`)
expect(has31(2)).toMatchInlineSnapshot(`false`)
expect(has31(3)).toMatchInlineSnapshot(`true`)
expect(has31(4)).toMatchInlineSnapshot(`false`)
expect(has31(5)).toMatchInlineSnapshot(`true`)
expect(has31(6)).toMatchInlineSnapshot(`false`)
expect(has31(7)).toMatchInlineSnapshot(`true`)
View month has31
const has31 = month => Boolean((month & 1) ^ ((month >> 3) & 1))
test('1-12', () => {
expect(has31(1)).toMatchInlineSnapshot(`true`)
expect(has31(2)).toMatchInlineSnapshot(`false`)
expect(has31(3)).toMatchInlineSnapshot(`true`)
expect(has31(4)).toMatchInlineSnapshot(`false`)
expect(has31(5)).toMatchInlineSnapshot(`true`)
expect(has31(6)).toMatchInlineSnapshot(`false`)
expect(has31(7)).toMatchInlineSnapshot(`true`)
@elzup
elzup / wbgt.js
Last active Mar 4, 2019
Approximate wbgt: 近似暑さ指数(WBGT)計算式
View wbgt.js
function awbgt(tmp, hmd) {
return (
(hmd - 20) * (Math.pow(tmp - 40, 2) * -0.00025 + 0.185) +
(11 / 15) * (tmp - 25) +
17.8
)
}
@elzup
elzup / 付き合って
Created Dec 27, 2018
sudo ./付き合って
View 付き合って
#!/bin/sh
[ $USER = "root" ] && echo "オッケー" || echo "ごめん無理"
@elzup
elzup / s2s.config-redux.js
Last active Nov 29, 2018
s2s.config-redux.js
View s2s.config-redux.js
// @flow
import path from 'path'
const cwd = process.cwd()
const getRootDir = (...x) => path.resolve(cwd, 'src', ...x)
const getTyepDir = x => getRootDir('types', x)
const rootReducerPath = getRootDir('reducer.js')
const rootActionPath = getTyepDir('action.js')
@elzup
elzup / common-page.js
Created Oct 24, 2018
Page container component
View common-page.js
import { Grid, Paper } from '@material-ui/core'
export const Page = (props: Object) => (
<Grid container justify={'center'}>
<Grid item xs={12} sm={12} md={10}>
<Paper {...props} />
</Grid>
</Grid>
)
View lodash.test.js
// @flow
import _ from 'lodash'
test('works', () => {
const a = [{ id: 'foo', v: 100 }, { id: 'bar', v: 200 }]
expect(_.mapKeys(a, 'id')).toMatchInlineSnapshot(`
Object {
"bar": Object {
You can’t perform that action at this time.