Skip to content

Instantly share code, notes, and snippets.

View nariakiiwatani's full-sized avatar

nariakiiwatani nariakiiwatani

View GitHub Profile
(defn fix-distance
[base desire distance]
(let [angle (vec2/angle (vec2/- desire base))]
(vec2/rotate base angle (vec2/+ base [distance 0]))))
(def limb
^(assoc (meta line) :handles {
:draw (get (get (meta line) :handles) :draw)
:drag (fn [{:id id :pos p :delta-pos dp :params [from to]}]
(let [length 100]
(defn line-polar
{:params [{:label "length" :type "number"}
{:label "rot" :type "angle"}]
:handles {:draw (fn [{:params [l r]}]
[{:id "edge" :type "point" :pos (vec2/* [(cos r) (sin r)] [l l])}])
:drag (fn [{:id id :pos p :prev-pos pp :params [l r]}] [(vec2/dist [0 0] p) (+ r (calc-dragged-rotation :pos p :prev-pos pp))])
}
}
[l r]
(transform (rotate r)
(defn hand
{:params [{:label "length" :type "number"}
{:label "rot" :type "angle"}]
:handles {:draw (fn [{:params [l r]}]
[{:id "edge" :type "point" :pos (vec2/* [(cos r) (sin r)] [l l])}])
:drag (fn [{:id id :pos p :params [l r]}] [(vec2/dist [0 0] p) (vec2/angle p)])
}
}
[l r]
(transform (rotate r)
(defn on-same-line? [A B C]
(< .99 (abs(vec2/dot (vec2/normalize (vec2/- B A))
(vec2/normalize (vec2/- C A))))))
(defn circumcenter [A B C]
(let [a (vec2/dist B C)
b (vec2/dist C A)
c (vec2/dist A B)
a2 (* a a) b2 (* b b) c2 (* c c)
a-len (* a2 (+ (- a2) b2 c2))
@nariakiiwatani
nariakiiwatani / splatoon-voice-log-20200625.txt
Created June 25, 2020 16:08
スプラトゥーンリーグマッチをやりながら自分の声だけ音声認識した結果
最近
-
最近 エクスが楽しくて
-
チームっぽい
-
やったやった
@nariakiiwatani
nariakiiwatani / log.txt
Created June 11, 2020 13:15
うっかり音声認識したままでスプラトゥーンのリーグマッチをボイスチャットありで1時間くらいやったログ
お疲れです
-
急遽 急遽ですが集まりましたね
-
太子堂出張所 アイリス 花
-
#pragma once
#include <functional>
class Once
{
public:
using Work = std::function<void()>;
Once(){}
Once(Work work) {
@nariakiiwatani
nariakiiwatani / SimpleReversi.html
Last active January 22, 2020 08:21
Simple Reversi
<html lang="ja">
<head>
<title>othello</title>
<style type="text/css">
.cell {
margin: 0 -1px -1px 0;
position: relative;
display: inline-block;
width:30px;
height:30px;
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>limit.maxfiles</string>
<key>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>limit</string>
@nariakiiwatani
nariakiiwatani / BuildPG.sh
Last active December 10, 2019 14:06
build PG using existing(already used) oF
#!/bin/bash
set -e
echoDots(){
sleep 0.1 # Waiting for a brief period first, allowing jobs returning immediatly to finish
while isRunning $1; do
for i in $(seq 1 10); do
echo -ne .