This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import CryptoJS from 'crypto-js'; | |
import {v4 as uuidv4 } from "uuid" | |
// https://github.com/paypay/paypayopa-sdk-node/blob/646a420f6e61f65cfd4855f355d21de95af5fef8/src/lib/paypay-rest-sdk.ts#L31 | |
// ↑ここから引っ張ってきてとりあえず動くっぽい感じにしたやつ | |
export const createAuthHeader = (method: string, resourceUrl: string, payLoad: any, auth: any) => { | |
let AUTH_TYPE = "hmac OPA-Auth"; | |
const epoch = Math.ceil(Date.now() / 1000); // ミリ秒を削る必要アリ | |
let contentType = 'application/json'; | |
const nonce = uuidv4().slice(0,8); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
overwrite: true | |
schema: https://XXXXXXX.herokuapp.com/v1/graphql | |
documents: | |
- query.graphql | |
generates: | |
src/generated/types.d.ts: | |
plugins: | |
- "typescript" | |
# - "typescript-document-nodes" | |
# - "typescript-operations" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let pow: Vec<&i32> = v1 | |
.iter() | |
.enumerate() | |
.filter_map(|(i, v)| v2.get(i)) | |
.collect(); | |
let pow2: Vec<i32> = v1 | |
.iter() | |
.enumerate() | |
.filter_map(|(i, v)| v2.get(i)) | |
.map(|d| d.clone()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useState, useCallback, useReducer, useRef } from "react"; | |
import GoogleMapsApiLoader from "google-maps-api-loader"; | |
// @ts-ignore | |
import uuid from "uuid/v4"; | |
// Google Mapのオブジェクトを呼び出すだけのhooks | |
export const useGoogleMap = apiKey => { | |
const [googleMap, setGoogleMap] = useState(null); | |
useEffect(() => { | |
GoogleMapsApiLoader({ apiKey }).then(google => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useState, useCallback, useReducer, useRef } from "react"; | |
import GoogleMapsApiLoader from "google-maps-api-loader"; | |
// @ts-ignore | |
import uuid from "uuid/v4"; | |
// Google Mapのオブジェクトを呼び出すだけのhooks | |
export const useGoogleMap = apiKey => { | |
const [googleMap, setGoogleMap] = useState(null); | |
useEffect(() => { | |
GoogleMapsApiLoader({ apiKey }).then(google => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useState, useCallback, useRef } from "react"; | |
import GoogleMapsApiLoader from "google-maps-api-loader"; | |
// Google Mapのオブジェクトを呼び出すだけのhooks | |
export const useGoogleMap = apiKey => { | |
const [googleMap, setGoogleMap] = useState(null); | |
useEffect(() => { | |
GoogleMapsApiLoader({ apiKey }).then(google => { | |
setGoogleMap(google); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { createContext, Context, useContext } from "react" | |
interface SafetyContextValue extends Object { | |
isDefault: boolean | |
} | |
export const createSafetyContext = <T extends SafetyContextValue>( | |
defaultValue: T | |
) => { | |
return createContext({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/terrierscript/dartystrap/blob/2b5c0a2fc7bb0060b2290664384303bab802d94f/src/app/compiler/CompileModeCheckbox.tsx#L21-L37 | |
const useCompileModeCheckboxState = () => { | |
const [compilerMode, setCompilerMode] = useState(CompilerMode.WORKER) | |
const handleUseWorker = useCallback( | |
(e) => { | |
const mode = e.target.checked ? CompilerMode.WORKER : CompilerMode.ASYNC | |
setCompilerMode(mode) | |
}, | |
[setCompilerMode] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Button = ({ dispatch }) => ( | |
<button onClick={(e) => dispatch({ type: "PING" })}> | |
Ping | |
</button> | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const readline = require("readline") | |
const seeds = [ | |
// 使いたい漢字を列挙する | |
] | |
const firstName = "" // 名字 | |
const getRandomInt = (len) => { | |
return Math.ceil(Math.random() * len) | |
} | |
const pick = (arr) => { |
NewerOlder