Skip to content

Instantly share code, notes, and snippets.

Avatar
😫
[AFK] 503 Service Unavailable

Daofeng Wu idiotWu

😫
[AFK] 503 Service Unavailable
View GitHub Profile
View zh-calculator.js
const magnitude = {
'十': 1e1,
'百': 1e2,
'千': 1e3,
'万': 1e4,
'亿': 1e8,
};
const num = {};
@idiotWu
idiotWu / u-jap.tex
Created Jun 9, 2020
biblatex で日本語文献をサポート
View u-jap.tex
% 日本語文献サポート
\AtEveryBibitem{
% langid={Japanese} で識別
\iffieldequalstr{langid}{Japanese} {
% コンマで区切り
\DeclareDelimFormat{finalnamedelim}{%
\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
\addspace\multinamedelim
}
% 名前を「姓 名」の順に
@idiotWu
idiotWu / gist:db9a1c629200c04999283df90fab88cf
Created May 1, 2020 — forked from kyontan/gist:7678042
游書体を加えたCSS font-family
View gist:db9a1c629200c04999283df90fab88cf
/* ヒラギノ角ゴ */
font-family: "ヒラギノ角ゴ Pro", "Hiragino Kaku Gothic Pro", "メイリオ", Meiryo, "MS Pゴシック", "MS PGothic", sans-serif;
/* ヒラギノ明朝 */
font-family: "ヒラギノ明朝 Pro", "Hiragino Mincho Pro", "MS P明朝", "MS PMincho", serif;
/* From: 游明朝体・游ゴシック体のCSSでの利用 - Qiita [キータ]
* http://qiita.com/shinnn/items/5be7e8106189311559c1
*/
@idiotWu
idiotWu / engine.c
Last active Jun 4, 2019
Simple timeline-based animation engine
View engine.c
/**
* Timeline based animation engine
*
* t
* ------+------------------------------------------> timeline
* +-----|-+
* | A | | <- animation{}
* +-----|-+
* +--|------+
* | | A |
View otsuka.js
const src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW52rlKO58sEQjFu9+cj/seFf/2OKdHiNLFcLBWK8ViJuFAiTcd5uVKRRCHJleIS6X8y8R+W/QmTdw0ArIZPwE62B7XLbMB+7gECiw5Y0nYAQH7zLYwaC5EAEGc0Mnn3AACTv/mPQCsBAM2XpOMAALzoGFyolBdMxggAAESggSqwQQcMwRSswA6cwR28wBcCYQZEQAwkwDwQQgbkgBwKoRiWQRlUwDrYBLWwAxqgEZrhELTBMTgN5+ASXIHrcBcGYBiew
View nyan.js
class Nyan {
constructor(speed = 3) {
this.x = 0;
this.y = 0;
this.max_x = 0;
this.max_y = 0;
this.vx = this.vy = speed;
const img = this.img = new Image();
img.src = 'http://www.nyan.cat/images/thumbs/balloon.gif';
@idiotWu
idiotWu / Nyanaba.user.js
Last active Nov 28, 2018
nyan your reports
View Nyanaba.user.js
// ==UserScript==
// @name Nyanaba
// @namespace https://manaba.kic.kagoshima-u.ac.jp
// @version 0.1
// @description nyan your reports
// @author Dolphin Wood
// @match https://manaba.kic.kagoshima-u.ac.jp/ct/home
// @noframes
// ==/UserScript==
@idiotWu
idiotWu / unlock.js
Last active Nov 19, 2017
Unlock netease music
View unlock.js
const http = require('http');
const net = require('net');
const url = require('url');
const IP = '211.161.244.70';
const hosts = {
'p[1-4].music.126.net': 'cloudedge.chinanetcenter.com',
'm10.music.126.net': 'ws.acgvideo.com',
};
View fake-observable.js
let currentCaller = null;
class FakeObservable {
constructor() {
this._value = null;
this._callers = new Set();
}
set(val) {
this._value = val;
@idiotWu
idiotWu / extensify.js
Last active Feb 8, 2017
Make built-in classes extendable
View extensify.js
// copied from <https://github.com/service-mocker/service-mocker>
function extensify(Native) {
class Extendable {
constructor(...args) {
this._native = initNative(...args);
checkLack(this._native);
}
}