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 { useCallback, useState, useEffect } from "react"; | |
const X = () => { | |
const [count, setCount] = useState(0); | |
const handleClick = useCallback(() => { | |
setCount((prev) => prev + 1); | |
}, []); | |
return <button onClick={handleClick}>Button1 ({count})</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
<!DOCTYPE html> | |
<html> | |
<body> | |
<svg preserveAspectRatio="xMinYMin meet" viewBox="0 0 80 80" width="40" height="120"> | |
<circle cx="40" cy="40" r="40" /> | |
</svg> | |
<svg preserveAspectRatio="xMidYMid meet" viewBox="0 0 80 80" width="40" height="120"> | |
<circle cx="40" cy="40" r="40" /> | |
</svg> | |
<svg preserveAspectRatio="xMaxYMax meet" viewBox="0 0 80 80" width="40" height="120"> |
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
package sort | |
type Ordered interface { | |
type int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, uintptr, float32, float64, string | |
} | |
func BubbleSort[T Ordered](slice []T) { | |
for i := 0; i < len(slice)-1; i++ { | |
done := true | |
for j := 1; j < len(slice)-i; j++ { |
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, { useCallback, useState } from 'react'; | |
const useUploadImage = (url: string, file: File) => { | |
const [state, setState] = useState<{ | |
uploadPercent: number; | |
downloadPercent: number; | |
state: | |
| 'none' | |
| 'uploading' | |
| 'downloading' |
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, { useCallback } from 'react'; | |
import { useState } from 'react'; | |
interface ImageUploaderProps {} | |
const ImageUploader: React.FC<ImageUploaderProps> = () => { | |
const [imageUrl, setImageUrl] = useState(''); | |
const handleDrop = useCallback((event: React.DragEvent<HTMLDivElement>) => { | |
event.preventDefault(); |
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
local field = {} | |
for i = 1, 9 do | |
local buf = io.read() | |
field[i] = {} | |
for j = 1, 9 do | |
field[i][j] = tonumber(buf:sub(j, j)) | |
end | |
end |
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
# JR山手線 | |
- 西日暮里 | |
- 田端 | |
- 駒込 | |
- 巣鴨 | |
- 大塚 | |
- 池袋 | |
- 目白 | |
- 高田馬場 | |
- 新大久保 |
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
wget https://www.lua.org/ftp/lua-1.1.tar.gz | |
mkdir lua-1.1 | |
tar zxvf lua-1.1.tar.gz -C lua-1.1 --strip-components 1 | |
cd lua-1.1 | |
sed -i -e "21 s/\$/ -lc/" src/Makefile | |
sed -i -e "14 s/^/\/\//" clients/lib/iolib.c | |
sed -i -e "21 s/stdin/NULL/" clients/lib/iolib.c | |
sed -i -e "21 s/stdout/NULL/" clients/lib/iolib.c | |
sed -i -e "472i in=stdin; out=stdout;" clients/lib/iolib.c | |
sed -i -e "20 s/\$/ -lm -lc -L\$(LIB) -llua/" clients/lib/Makefile |
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
#include <cctype> | |
#include <iostream> | |
#include <fstream> | |
#include <string> | |
#include <regex> | |
#include <unordered_map> | |
auto main() -> int | |
{ | |
while (true) { |
NewerOlder