Skip to content

Instantly share code, notes, and snippets.

View Tatejimaru's full-sized avatar

Tatejimaru

View GitHub Profile
@Tatejimaru
Tatejimaru / vector-2022.css
Last active March 11, 2023 13:07
WikipediaのCSS設定。自作のダークモード。
:root {
--color: #bdc1c6;
--background-color: #202124;
--a-color: #8ab4f8;
--a-new-color: #f7aea3;
--border-color: #aaa;
--img-background-color: #fff;
}
@Tatejimaru
Tatejimaru / detectMoveDirection.js
Created August 4, 2022 12:50
動きの向きを検出する関数。
function detectMoveDirection(prevX, prevY, nextX, nextY)
{
const dx = nextX - prevX;
const dy = nextY - prevY;
return {
horizontal: (dx === 0) ? 'neutral' : (dx > 0) ? 'right' : 'left',
vertical: (dy === 0) ? 'neutral' : (dy > 0) ? 'top' : 'bottom'
};
}
@Tatejimaru
Tatejimaru / toric_3D.py
Last active April 2, 2021 15:18
球面からトーリック面へのアニメーション。
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
def init_axis(ax):
ax.set_xlim(-4, 4)
ax.set_ylim(-4, 4)
ax.set_zlim(-4, 4)
ax.set_box_aspect((1, 1, 1))
@Tatejimaru
Tatejimaru / x_ceiling.py
Created February 17, 2021 14:42
ExcelのCEILING関数(倍数に切り上げ)をPythonで書く
def x_ceiling(value, step):
return -(-value // step) * step
@Tatejimaru
Tatejimaru / edge_extensions_path.txt
Last active January 27, 2021 15:11
Edgeの拡張機能のパス。USERNAME→自分のユーザ名に置換する。
/Users/USERNAME/Library/Application\ Support/Microsoft\ Edge/Default/Extensions
@Tatejimaru
Tatejimaru / resize_icons.sh
Created January 23, 2021 04:49
Chrome拡張機能のアイコン用。
sips -Z 144 source.png -o source.png
sips -Z 16 source.png -o 16.png
sips -Z 48 source.png -o 48.png
sips -Z 128 source.png -o 128.png
@Tatejimaru
Tatejimaru / README.md
Last active October 12, 2020 10:12
電子レンズのシミュレーション

電子レンズのシミュレーション。 円電流の磁場下でローレンツ力を受けて集光していく電子の動きを再現したい。 簡単のため、磁場やスケールを簡略化して計算。

matplotlib 3.3以降。

<html>
<head>
<title>YYMMDD</title>
</head>
<body>
<input id="day" value="170101" autofocus>
<script>
var date = new Date();
var yy = ("" + date.getFullYear()).slice(-2);
var mm = ("0" + (date.getMonth() + 1)).slice(-2);
@Tatejimaru
Tatejimaru / alfred2privateBrowsing.sh
Created December 8, 2016 15:58
Search Google for query w/ secret mode (Alfred Workflow)
open -a Google\ Chrome --new --args -incognito "http://www.google.co.jp/search?q="$1