Skip to content

Instantly share code, notes, and snippets.

View shhider's full-sized avatar

Shi Haohong shhider

  • DingTalk Docs / 钉钉文档
  • Hangzhou / 杭州
View GitHub Profile
@mmazzarolo
mmazzarolo / runtime-globals-checker.js
Last active June 8, 2023 14:27
Find what JavaScript variables are leaking into the global `window` object at runtime (see: https://mmazzarolo.com/blog/2022-02-14-find-what-javascript-variables-are-leaking-into-the-global-scope/)
/**
* RuntimeGlobalsChecker
*
* You can use this utility to quickly check what variables have been added (or
* leaked) to the global window object at runtime (by JavaScript code).
* By running this code, the globals checker itself is attached as a singleton
* to the window object as "__runtimeGlobalsChecker__".
* You can check the runtime globals programmatically at any time by invoking
* "window.__runtimeGlobalsChecker__.getRuntimeGlobals()".
*
@shhider
shhider / 00-git-litedoc.sh
Last active May 9, 2023 07:06
[Git Lite Docs] #git #litedoc #commands
# 只 clone 最新的代码,不要 commits/tags...
git clone https://xxx/xxx.git --depth 1
# 这称为 shallow clone
# 如果后面又需要完整的仓库
git pull --unshallow
# === 恢复数据 ===
# reflog 可以查看你每次 git 操作后的 hash
git reflog
@hackjutsu
hackjutsu / .leptonrc
Last active December 7, 2022 01:01
[Template for .leptonrc] This is a template for Lepton's configuration file. Please place it on your home directory. #lepton
{
"theme": "light",
"autoUpdate": false,
"snippet": {
"expanded": true,
"newSnippetPrivate": false,
"sorting": "updated_at",
"sortingReverse": true
},
"editor" : {
@shhider
shhider / toUnicode.js
Last active July 29, 2021 08:52 — forked from littlee/toUnicode.js
[JavaScript convert string to unicode format] #tounicode
const toUnicode = (str) => str.split('').map((char) => {
const temp = char.charCodeAt(0).toString(16).toUpperCase();
if (temp.length > 2) {
return '\\u' + temp;
}
return char;
}).join('');
console.log(toUnicode('转换成 Unicode'));
@jeffmo
jeffmo / gist:054df782c05639da2adb
Last active January 11, 2024 06:05
ES Class Property Declarations
@6174
6174 / Random-string
Created July 23, 2013 13:36
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@zaach
zaach / po2json.js
Created February 4, 2012 19:59
PO parser from http://jsgettext.berlios.de/lib/Gettext.js adapted for Node.js and modified to be more like po2json.pl
#!/usr/bin/env node
/*
PO parser from http://jsgettext.berlios.de/lib/Gettext.js
adapted for Node.js and modified to be more like po2json.pl
- Zach Carter <zcarter@cse.usf.edu>
*/
/*
Pure Javascript implementation of Uniforum message translation.