Skip to content

Instantly share code, notes, and snippets.

# vim:fdm=manual:sw=2:ts=2:et:ft=gitconfig:
[alias]
b = branch
ba = branch -a
c = commit
cf = config
ci = commit
co = checkout
dc = svn dcommit
@kindy
kindy / es-globals.md
Last active April 20, 2021 23:24
ES Globals
-- es5 --

declare var NaN
declare var Infinity
declare function eval(x
declare function parseInt(s
declare function parseFloat(string
declare function isNaN(number
declare function isFinite(number
@kindy
kindy / README.md
Last active February 8, 2019 13:43

Memory Compare

# Lua
1.3KB/Thread

10000   mem:1.28125KB     total:13641.189453125KB

# Luajit
0.5KB/Thread
@kindy
kindy / polyfill.document.createTreeWalker.js
Created December 3, 2018 09:06 — forked from radum/polyfill.document.createTreeWalker.js
polyfill.document.createTreeWalker.js
/* eslint no-param-reassign: 0 */
/**
* JavaScript implementation of W3 DOM4 TreeWalker interface.
*
* See also:
* - https://dom.spec.whatwg.org/#interface-treewalker
*
* Attributes like "read-only" and "private" are ignored in this implementation
* due to ECMAScript 3 (as opposed to ES5) not supporting creation of such properties.
@kindy
kindy / gist:777f013083e101941d0684358529ca18
Created August 7, 2018 08:48 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@kindy
kindy / repl.js
Created July 17, 2018 10:12
文本正则替换 模式
// 此处所列函数只是框架,实际使用仍需要调整和修正
// 提供的是一个思路
// 替换函数是同步的
function replSync(txt) {
let pick = (s, e) => txt.substring(s, e);
const re = /\w/g;
const buf = [];
let lastIdx = 0;
@kindy
kindy / README.md
Created April 25, 2018 07:52
Simple File Server(upload) / 简易文件服务器(支持上传)

Simple File Server(upload) / 简易文件服务器(支持上传)

一般文件上传都会使用 Form 形式, 其实如果只是为了做一个简单的文件服务的话,那么可以简化许多。

Nginx 默认提供了文件访问服务,使用 autoindex 可以提供文件list 功能; 对于文件上传,使用 WebDAV模块可以极大简化上传的实现及用法。

Nginx 配置

@kindy
kindy / README.md
Created April 4, 2018 02:04 — forked from MoOx/README.md
How to keep in sync your Git repos on GitHub, GitLab & Bitbucket easily
title tags authors
How to keep in sync your Git repos on GitHub, GitLab & Bitbucket easily
git
github
gitlab
bitbucket
MoOx
@kindy
kindy / raytracer.ts
Created February 21, 2018 07:15
AST Play assets
class Vector {
constructor(public x: number, public y: number, public z: number) { }
static times(k: number, v: Vector) {
return new Vector(k * v.x, k * v.y, k * v.z);
}
static minus(v1: Vector, v2: Vector) {
return new Vector(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z);