Skip to content

Instantly share code, notes, and snippets.

View kenmori's full-sized avatar

KenjiMorita kenmori

View GitHub Profile
@kenmori
kenmori / example.js
Created July 3, 2020 10:57
example timer
class Store {
status = ""
cycleCount = 0;
count = 0;
constructor(status){
this.status = status
this.cycleCount = 3;
this.count = 1;
}
@kenmori
kenmori / rust_practice.md
Last active February 15, 2025 11:01
【WIP】Rust練習問題集(Rust practice questions)
@kenmori
kenmori / React Hooks-modules-for-reload-and-tab close which react-router prompt cannot support.md
Last active April 18, 2020 06:37
【React Hooks】modules for reload and tab close which react-router prompt cannot support

【React Hooks】 modules for reload and tab close which react-router prompt cannot support

react-routerのPromptではreloadとtabクローズに対応できなさそうなので作った

isDuty ・・・A flag that determines if the user has edited the value of the form. got from formik etc.

// in /modules/useUnloadEffect
@kenmori
kenmori / 【簡単!!】swaggerモックサーバーをローカルに立ち上げて、データ作って叩きたい.md
Created April 4, 2020 01:39
【簡単!!】swaggerモックサーバーをローカルに立ち上げて、データ作って叩きたい
global.fetch = require("node-fetch")

async function getApi(id){
  try {
  const response = await fetch(`https://petstore.swagger.io/v2/pet/${id}`, {
    method: "GET",
    mode: "cors",
    credentials: "include",
    headers: {
@kenmori
kenmori / exif.md
Last active March 27, 2020 22:04
【解決】[Solution] Support for tilting 90 degrees when uploading an iPhone image file(iPhoneの画像ファイル(File)をアップロードすると横向きに(90度回転)傾く対応)

【解決】iPhoneの画像ファイル(File)をアップロードすると横向きに(90度回転)傾く対応)

Upload the iPhone image file (File) to tilt horizontally (rotate 90 degrees) ~ iPhoneの画像ファイル(File)をアップロードした際に90度傾く対応) ~

フロントエンドでEXIFという画像のメタデータ内のOrientationの値を考慮して処理しないとそうなる。

よくある記事はimageのnodeに突っ込んでプレビューに出すみたいなのは多いのだけれど、 そうではなく、File型としてセットしたい時の方法。 callback関数を渡して、そこに処理させる

@kenmori
kenmori / 初めてvimを触る方へのハンズオン資料.md
Last active March 6, 2020 22:29
初めてvimを触る方へのハンズオン資料

vim

移動してみる

  • jjj

  • kkk

@kenmori
kenmori / 書き殴り.md
Created March 6, 2020 11:12
書き殴り
type N<T> = { name: T }

type E<T,> = T extends { [key in string]: infer I } ? { name: I } : never

type F<T> = T extends { [key in string]: infer I } ? I : never

const b: F<E<N<number>>> = 5
@kenmori
kenmori / もりたけんじのルーティン整理.md
Last active March 4, 2020 11:34
もりたけんじのルーティン整理

ルーティン整理

毎日

  • プロダクト制作 -> commit
  • ブログ更新・運用(1記事30分)
  • タイピング練習 (PC立ち上げ毎)
  • 英語記事読書 (1記事)
  • プログラミング学習
@kenmori
kenmori / 【google consoleからインデックスできなくなった方へ】indexAPIを使って送信する方法.md
Last active February 29, 2020 22:58
【あれ?急にできなくなった?!google consoleからインデックスできなくなった方へ】indexAPIを使って送信する方法