Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

KenjiMorita kenmori

🏠
Working from home
View GitHub Profile
@kenmori
kenmori / Least Common Multiple.md
Last active Aug 22, 2022
Least Common Multiple
View Least Common Multiple.md
  • 最小公倍数(lcm)は二つの数を掛けて最大公約数(gcd)で割る
// 最小公倍数
let lcm = function () {
  let args = [...arguments]
  if(args.length === 0) return 1
  if(args.filter(e => e !== 0).length === 0) return 0
  return args.reduce((a, c, i) => {
 return (a * c) / gcd(a, c)
@kenmori
kenmori / react-router-domv5tov6.md
Last active Nov 19, 2021
[解決] react-router-dom v5 to v6 移行に伴いやること
View react-router-domv5tov6.md

[解決] react-router-dom v5 to v6 移行に伴いやること

※こちらはメモ書き程度の殴り書き記事です

author

upgrade-to-react-router-v6

index

  • connected-react-routerを使っている場合修正(error TypeError: Cannot read properties of undefined (reading 'pathname') at Router (index.js:194))
View jest-example.md

jest

import { add, addString, toNumber, filterOrange } from "./index";

it('adds 1 + 2 to equal 3', () => {
  expect(add(1, 2)).toBe(3);
});
View gist:7b96d6336e3069a19141db0c415a29e5
"use strict";

const modal = document.getElementById("js-modal");
const modalWrapper = document.getElementById("js-modalWrapper");
const checkbox = document.getElementById("js-checkbox");
const closeButton = document.getElementById("js-close");

const form = document.getElementById("js-form");
const term = document.getElementById("js-term");
View Win-nvm.md

ref

Windows 10 Fall Creators Update - Installing Node.js on Windows Subsystem for Linux (WSL)

Windows just released the windows subsystem for linux feature to the public with its latest windows fall creator update, if you are not familiar with this feature it allows you to run linux binaries natively on windows - F.A.Q.

Enabling WSL

The feature is not enabled by default and you need to activate it, you can do it via powershell (with admin rights):

View Win-nvm-md
[ref](https://gist.github.com/noygal/6b7b1796a92d70e24e35f94b53722219)
# Windows 10 Fall Creators Update - Installing Node.js on Windows Subsystem for Linux (WSL)
Windows just released the [windows subsystem for linux](https://msdn.microsoft.com/en-us/commandline/wsl/about) feature to the public with its latest windows fall creator update, if you are not familiar with this feature it allows you to run linux binaries natively on windows - [F.A.Q](https://msdn.microsoft.com/en-us/commandline/wsl/faq).
## Enabling WSL
The feature is not enabled by default and you need to activate it, you can do it via powershell (with admin rights):
View typescript108.md
View example.js
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 Sep 24, 2022
【WIP】Rust練習問題集(Rust practice questions)
View rust_practice.md

【WIP】Rust練習問題集(Rust practice questions)

Author

読み進めるにあたって

- 問題文はfn main{}の中のコンテキストとする
@kenmori
kenmori / React Hooks-modules-for-reload-and-tab close which react-router prompt cannot support.md
Last active Apr 18, 2020
【React Hooks】modules for reload and tab close which react-router prompt cannot support
View React Hooks-modules-for-reload-and-tab close which react-router prompt cannot support.md

【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