Skip to content

Instantly share code, notes, and snippets.

<body onLoad="img()">
<div class="pc">
<canvas width="900" height="600" id="sample1"></canvas>
</div>
<div class="pad">
<canvas width="400" height="600" id="sample2"></canvas>
</div>
<div class="mobile">
<canvas width="150" height="900" id="sample3"></canvas>
</div>
@okumurakengo
okumurakengo / index.css
Last active November 13, 2019 04:58
webpack4でsideEffectsでcssのツリーシェイキングの動きを試してみた
/* src/index.css */
body {
background: yellow;
}
@okumurakengo
okumurakengo / index.ts
Created November 24, 2019 06:07
typescriptでfizzbuzz
function fizzbuzz(n: number): number|"Fizz"|"Buzz"|"FizzBuzz" {
if (n % 15 === 0) {
return "FizzBuzz";
}
if (n % 3 === 0) {
return "Fizz";
}
if (n % 5 === 0) {
return "Buzz";
}
@okumurakengo
okumurakengo / index.ts
Created December 18, 2019 04:58
ts unknown test
let value1: any;
value1 = true; // OK
value1 = 42; // OK
value1 = "Hello World"; // OK
value1 = []; // OK
value1 = {}; // OK
value1 = Math.random; // OK
value1 = null; // OK
value1 = undefined; // OK
value1 = new TypeError(); // OK
@okumurakengo
okumurakengo / index.html
Created March 16, 2020 04:34
fullscreen style
<!DOCTYPE html>
<meta charset="UTF-8">
<title>Document</title>
<style>
#my-text {
color: #faa;
}
#my-text:fullscreen {
color: #afa;
}
@okumurakengo
okumurakengo / test.js
Created May 6, 2020 07:31
ユークリッドの互除法
let a = 273
,b = 1001
function* foo() {
while (true) {
yield (a < b) ? [a, b - a] : [a - b, a]
}
}
for ([a, b] of foo(a, b)) {
@okumurakengo
okumurakengo / files.js
Created May 8, 2020 09:06
フォルダ階層たどってJSONにしてくれるの
module.exports = `
foo.html
bar/hoge/fuga.php
bar/hoge/piyo.php
bar/hogera.php
baz/fugara.php
`
@okumurakengo
okumurakengo / bar.txt
Created May 17, 2020 07:26
c言語で排他的論理和を使って超簡単に暗号化、複合化
SLHFNLM
@okumurakengo
okumurakengo / marrige.c
Last active May 18, 2020 17:56
安定結婚問題練習
#include <stdio.h>
#include <stdlib.h>
#define N 3 /* 各性の人数 */
int
/* 添字(女性1..3) => 値(男性1..3) */
boy[4] = {0, 0, 0, 0}
/* 各女性の好み */
// rank[女性1..3][男性1..3] = ランク
@okumurakengo
okumurakengo / ishi.c
Created May 27, 2020 19:11
石取りゲーム
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int x, r, my_turn;
int one_times_max = 5;
int total = 22;
printf("最後に石を取った側が負けです. パスはできません.\n");