Skip to content

Instantly share code, notes, and snippets.

View airtoxin's full-sized avatar
๐ŸŒด
On vacation

Ryoji Miyazato airtoxin

๐ŸŒด
On vacation
View GitHub Profile

ใ“ใฎ่จ˜ไบ‹ใฏใƒ€ใƒ ใ‚ขใƒ‰ใƒ™ใƒณใƒˆใ‚ซใƒฌใƒณใƒ€ใƒผ4ๆ—ฅ็›ฎใฎ่จ˜ไบ‹ใงใ™ใ€‚

ไธธๆฒผใƒ€ใƒ 

็พค้ฆฌ็œŒใฎๅ›ฝ้“120ๅท็ทšๆฒฟใ„ใซใ‚ใ‚‹ไธธๆฒผใ€ๅคงๅฐปๆฒผใฎ้–“ใซๅญ˜ๅœจใ—ใฆใ„ใ‚‹ใƒ€ใƒ ใงใ™ใ€‚
ใƒใƒƒใƒˆใƒฌใ‚นใƒ€ใƒ ใจๅ‘ผใฐใ‚Œใ‚‹ไธธๆฒผใƒ€ใƒ ใŒไฝ•ใ‚ˆใ‚Šใ‚‚็‰นๅพด็š„ใชใฎใŒใใฎใƒใƒƒใƒˆใƒฌใ‚นๆง‹้€ ใงใ™ใ€‚
็พๅญ˜ใ™ใ‚‹ๅ›ฝๅ†…ใฎใƒ€ใƒ ใงใฏใ‚‚ใ†ๆ•ฐๅŸบใ—ใ‹็„กใ„ใƒใƒƒใƒˆใƒฌใ‚นใƒ€ใƒ ใงใ€ๅ†™็œŸใฎ้€šใ‚Šๆฐดๅœงใ‚’ๆ”ฏใˆใ‚‹้ฎๆฐดๅฃใ‚’ใ‚ณใƒณใ‚ฏใƒชใƒผใƒˆ้€ ใ‚ŠใฎๆŸฑใจๆขใง่ฃœๅผทใ™ใ‚‹ใจใ„ใ†็‹ฌ็‰นใฎๆง‹้€ ใ‚’ๆŒใฃใฆใ„ใพใ™ใ€‚ ใ‚ใฃใกใ‚ƒใ‹ใฃใ“ใ„ใ„ใงใ™ใ€‚

javascript:xp=window.prompt("Input XPath");document.getElementsByXPath=function(t,e){for(var n=[],u=document.evaluate(t,e||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),a=0,l=u.snapshotLength;a<l;a++)n.push(u.snapshotItem(a));return n};alert(document.evaluate(xp, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null ).snapshotLength);console.log(xp);console.log(document.getElementsByXPath(xp))
@airtoxin
airtoxin / insyu.md
Last active December 11, 2019 21:55
้ฃฒ้…’ใƒ—ใƒญใ‚ฐใƒฉใƒŸใƒณใ‚ฐใ‚ขใƒ‰ใƒ™ใƒณใƒˆใ‚ซใƒฌใƒณใƒ€ใƒผ2019

้ฃฒ้…’ใƒ—ใƒญใ‚ฐใƒฉใƒŸใƒณใ‚ฐ2019-12-11

ใ“ใฎ่จ˜ไบ‹ใฏ ้ฃฒ้…’ใƒ—ใƒญใ‚ฐใƒฉใƒŸใƒณใ‚ฐ Advent Calendar 2019 11ๆ—ฅ็›ฎใฎ่จ˜ไบ‹ใงใ™ใ€‚

ๆœฌๆ—ฅใฎ้ฃฒ้…’ใƒ—ใƒญใ‚ฐใƒฉใƒ 

ๅ‹ไบบใ‹ใ‚‰ๅฐๆนพๆ—…่กŒๅœŸ็”ฃใฎใƒ“ใƒผใƒซใ‚’้ ‚ใ„ใŸใฎใงใใ‚Œใ‚’ใคใพใฟใซใƒ—ใƒญใ‚ฐใƒฉใƒŸใƒณใ‚ฐใงใ™ใ€‚

@airtoxin
airtoxin / setup.sh
Last active May 30, 2020 00:47
curl https:/GISTURL | bash -s NAME_OF_APP
npx create-react-app $1 --template typescript
cd $1
yarn add -DE prettier typescript
SCRIPTS=$(cat package.json | jq -c $'.scripts + {"fmt":"prettier --write \'**/*.{js,jsx,ts,tsx,json,md}\' --ignore-path .gitignore"}')
cat package.json | jq ". + {"scripts": $SCRIPTS}" > package.json.tmp
mv package.json{.tmp,}
COMPILER_OPTIONS=$(cat tsconfig.json | jq -c $'.compilerOptions + {"noImplicitAny": true}')
cat tsconfig.json | jq ". + {"compilerOptions": $COMPILER_OPTIONS}" > tsconfig.json.tmp
mv tsconfig.json{.tmp,}
git add .
@airtoxin
airtoxin / post-checkout
Last active March 29, 2019 08:35
cache-node_modules git hook
#!/usr/bin/env bash
echo "[cache-node_modules] START"
CURRENT_DIR_NAME=`basename $(pwd)`
BRANCH_FROM=`git reflog show -q | head -n1 | awk '$3 == "checkout:" && $4 == "moving" {print $6}'`
BRANCH_TO=`git reflog show -q | head -n1 | awk '$3 == "checkout:" && $4 == "moving" {print $8}'`
BRANCH_FROM_CACHE_NAME="/Library/Caches/${CURRENT_DIR_NAME}_${BRANCH_FROM}_node_modules"
BRANCH_TO_CACHE_NAME="/Library/Caches/${CURRENT_DIR_NAME}_${BRANCH_TO}_node_modules"
export type Option<A> = Some<A> | None<A>;
interface IOption<A> {
isDefined(): this is IOption<A>;
isEmpty(): this is IOption<A>;
nonEmpty(): this is IOption<A>;
map<B>(f: (val: A) => B): IOption<B>;
flatMap<B>(f: (val: A) => Option<B>): Option<B>;
forEach(f: (val: A) => void): void;
getOrElse(fallback: A): A;
@airtoxin
airtoxin / what-do-i-depend-on
Created October 1, 2018 03:01
what-do-i-depend-on
$ npx what-do-i-depend-on
npx: 18ๅ€‹ใฎใƒ‘ใƒƒใ‚ฑใƒผใ‚ธใ‚’6.648็ง’ใงใ‚คใƒณใ‚นใƒˆใƒผใƒซใ—ใพใ—ใŸใ€‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ PACKAGE โ”‚ COUNT โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ mocha โ”‚ 825 โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ ava โ”‚ 359 โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ eslint โ”‚ 320 โ”‚
@airtoxin
airtoxin / cirquit.ts
Last active March 17, 2018 01:15
deredux
import * as React from "react";
import createReactContext from "create-react-context";
export interface CirquitContext<State> {
state: State;
dispatch: Dispatch<State>;
}
export interface Dispatch<State> {
(nextState: State): void;
@airtoxin
airtoxin / SRE_4.md
Created October 4, 2017 04:00
SREๆœฌ4็ซ ใพใจใ‚

4็ซ  ใ‚ตใƒผใƒ“ใ‚นใƒฌใƒ™ใƒซ็›ฎๆจ™

4.1 ใ‚ตใƒผใƒ“ใ‚นใƒฌใƒ™ใƒซใซ้–ขใ™ใ‚‹็”จ่ชž

SLI

SLI ใฏใ‚ตใƒผใƒ“ใ‚นใƒฌใƒ™ใƒซๆŒ‡ๆจ™ใฎ็•ฅใงใ€ใ‚ตใƒผใƒ“ใ‚นใƒฌใƒ™ใƒซใฎๆ€ง่ณชใฎ่จˆๆธฌ้‡ใ€‚

  • ใƒชใ‚ฏใ‚จใ‚นใƒˆใฎใƒฌใ‚คใƒ†ใƒณใ‚ท(ใƒฌใ‚นใƒใƒณใ‚นใ‚’่ฟ”ใ—ใŸๆ™‚ๅˆป-ใƒชใ‚ฏใ‚จใ‚นใƒˆใ‚’ๅ—ไฟกใ—ใŸๆ™‚ๅˆป)
  • ใ‚จใƒฉใƒผ็އ(ใ‚จใƒฉใƒผใซใชใฃใŸใƒชใ‚ฏใ‚จใ‚นใƒˆๆ•ฐ/ๅ—ไฟกใ—ใŸใƒชใ‚ฏใ‚จใ‚นใƒˆๆ•ฐ)