Skip to content

Instantly share code, notes, and snippets.

:root {
--color-bw: light-dark(black, white);
--color-background: light-dark(hsl(48 48% 93%), hsl(48 48% 3%));
--color-background-tone: color-mix(
in hsl,
var(--color-background),
var(--color-bw) 6%
);
--color-on-background: color-mix(
in hsl,
@hail2u
hail2u / megaupload-dd.user.js
Created October 11, 2009 14:57
MEGAUPLOAD downloader
// ==UserScript==
// @name MEGAUPLOAD direct downloader
// @namespace http://hail2u.net/
// @include http://www.megaupload.com/?d=*
// ==/UserScript==
window.location.href = window.location.href.replace(/\/\?d=/, "/mgr_dl.php?d=");
@hail2u
hail2u / cycle-metasyntactic-variables.vim
Created September 14, 2013 11:55
'foo', 'bar', 'baz', 'qux', 'quux', 'corge', 'grault', 'garply', 'waldo', 'fred', 'plugh', 'xyzzy', 'thud'の上で<C-a>/<C-x>すると順にサイクルしてくれるやつ。レジスター使ってる。
" Cycle metasyntactic variables
function! s:CycleMetasyntacticVariables(num)
if type(a:num) != type(0)
return
endif
let vars = ['foo', 'bar', 'baz', 'qux', 'quux', 'corge', 'grault', 'garply', 'waldo', 'fred', 'plugh', 'xyzzy', 'thud']
let cvar = expand('<cword>')
let i = index(vars, cvar)
@hail2u
hail2u / apca.js
Last active September 11, 2023 05:18
Get contrast of colors using APCA (Advanced Perceptual Contrast Algorithm)
// https://github.com/Myndex/SAPC-APCA#the-plain-english-steps-are
// Example:
// const contrast = getAPCAContrast("rgb(255, 255, 255)", "rgb(136, 136, 136)");
// This returns `66.89346308821438` (66.893%)
// SAPC-APCA README says:
// > #888 vs #fff • 66.89346308821438
// 80% means 7:1 in WCAG 2.0
// 60% means 4.5:1 in WCAG 2.0
@hail2u
hail2u / csslint-rules.md
Last active April 29, 2023 14:59
CSSLintのRulesの超訳

訳注

これは超訳です。

CSSLintは「なんでこんなルールなんだ…」とイラっとすることが多いですけど、それぞれにそれなりに理由があります。まぁ勿論無視するべきなルールとかもあります。例えば見出し要素の再定義禁止とかはHTML5に対するCSSなら無理な話です。そんなわけでどんな理由なのかを簡単に訳しました。無視するかどうかは自分で決めましょう!

この訳はCSSLintと同じライセンスで提供されます。

Possible Errors

@hail2u
hail2u / png-vs-lossless-avif.md
Last active March 18, 2023 00:45
PNGから可逆AVIFに変換した時に、どれくらいファイルサイズが変化するか

463ファイルでファイルサイズが増え(AVIFの方が大きい)、154ファイルで減った。7割以上の確率で増えてしまう。

filename width height PNG size AVIF size ratio
11px_sized_text.png 192px 172px 3.572KB 5.873KB 1.644
404-sign.png 440px 440px 6.092KB 13.303KB 2.184
480-gridder.png 480px 191px 0.268KB 1.183KB 4.414
6-lines-of-p-and-9-lines-of-pre.png 784px 240px 22.043KB 58.122KB 2.637
700_subscribers.png 480px 250px 17.204KB 24.702KB 1.436
a-massive-influx-of-flat-sites.png 480px 270px 2.203KB 8.943KB 4.059
{
"env": {
"es6": true,
"node": true
},
"globals": {
"AbortController": true,
"fetch": true,
"FormData": true
},
@hail2u
hail2u / bar.partial.mustache
Last active June 13, 2021 21:54
Load mustache partials from file.
Hey {{name}}! This is bar.
@hail2u
hail2u / markdown-cheat-sheet.jax
Created December 19, 2010 19:35
Markdown カンニングペーパー
*markdown-cheat-sheet.jax* Markdown カンニングペーパー
作者: Kyo Nagashima <kyo@hail2u.net>
バージョン: 0.04
説明: Markdown 記法のカンニングペーパーです。
1. 記法の例 |markdown-cheat-sheet-examples|
1.1 段落 |markdown-cheat-sheet-paragraph|
1.2 改行 |markdown-cheat-sheet-linebreak|
1.3 テキストの強調 |markdown-cheat-sheet-emphasis|