Skip to content

Instantly share code, notes, and snippets.

View yue4u's full-sized avatar
💤
feeling drowsy

yue yue4u

💤
feeling drowsy
View GitHub Profile
import React, { memo, useMemo, useState, useCallback } from 'react';
const Child = ({
index,
decrease,
}: {
index: number;
decrease: () => void;
}) => {
const [state, setState] = useState(0);
@yue4u
yue4u / reactDOM
Last active January 1, 2020 14:04
ReactDOM.render
|> legacyRenderSubtreeIntoContainer => updateContainer
|> legacyCreateRootFromDOMContainer
|> createLegacyRoot
|> new ReactDOMBlockingRoot
|> createRoot
|> new ReactDOMRoot
|> createRootImpl
|> createContainer
|> createFiberRoot => updateContainer
import { BehaviorSubject, Subject, combineLatest } from 'rxjs'
import { useState, useEffect } from 'react'
import { skip, filter } from 'rxjs/operators'
export const useSharedState = <T>(
defaultState: T,
subject: Subject<T>
): [T, typeof useState] => {
const [value, setState] = useState(defaultState)
useEffect(() => {
@yue4u
yue4u / faq.py
Last active December 9, 2019 03:51
"""
問7.リストないしはディクショナリーを用いた処理:
添付として共有したファイル(univ.txt)には東京都内の大学一覧が記載されている。
その中から「亜細亜大学」のような大学名に同じ文字が複数用いられているものを判定して、
すべて表示するプログラムを実装せよ
"""
with open("univ.txt", "r") as f:
lines = f.readlines()
See 'git help <command>' to read about a specific subcommand
Main Porcelain Commands
add Add file contents to the index
am Apply a series of patches from a mailbox
archive Create an archive of files from a named tree
bisect Use binary search to find the commit that introduced a bug
branch List, create, or delete branches
bundle Move objects and refs by archive
checkout Switch branches or restore working tree files
@yue4u
yue4u / replace_svg_link_for_vue.py
Last active November 24, 2019 23:23
link svg for vue
@yue4u
yue4u / defaq.py
Last active November 23, 2019 14:38
"""
問1.共有ファイル(int_list.txt)からデータを一行ごとに数として読み込み、
数値が3の倍数なら"Fizz"、5の倍数なら"Buzz"、3および5の倍数なら"Fizz Buzz"、
それ以外であれば読み込んだ数値をそのまま出力するプログラムを実装せよ
"""
with open('int_list.txt', 'r') as file:
for line in file.readlines():
number = int(line)
t = (number % 3, number % 5)
"""
問9.
とある店舗は一日あたりの経費として、
家賃や商品原価および光熱費に50万円、
平日の人件費が30万円で週末は手当で35%上乗せされるものとする。
また、売上は休日明けの一日あたりのものが100万円で、
それ以降は連勤するごとに3%ずつ効率が下がっていくものとする
前月の最終週が月曜から稼働が始まり、
今月11月が金曜日からはじまって末日が30日、
@yue4u
yue4u / emoji.py
Last active November 9, 2019 09:47
emoji = {
"を": "̀",
"絵": "(",
"換": "•",
"変": "ㅂ",
"字": "•",
"る": ")",
"モ": "✧",
"文": "๑",
"デ": "و",