Skip to content

Instantly share code, notes, and snippets.

@myvyang
myvyang / __proto__.md
Last active April 22, 2023 13:06
ES6中 __proto__ 和 prototype 的关系

1. 只有函数有 prototype 属性。默认情况下,func.ptototype = {constructor: func} ,即 func.ptototype.constructor == func
2. 任何对象都有 __proto__ 属性,指向自己的 [[Prototype]] ,即原型链的上一层
3. 例如,var c = new func() ,则 c.__proto__ === func.ptototype 
4. 如果 var c = 1 ,约等于 var c = Number(1) ,因此 c.__proto__ === Number.prototype 
5. 可以看到 x.__proto__ 永远都不会是一个函数,但是永远都会是某个 func.prototype

@myvyang
myvyang / python证书错误.txt
Created April 14, 2020 06:45
python证书错误
certificate verify failed: unable to get local issuer certificate
sudo /Applications/Python\ 3.8/Install\ Certificates.command
echo "rdr pass proto tcp from any to any port {9111} -> 127.0.0.1 port 5555" | sudo pfctl -Ef -
sudo pfctl -s nat
编辑
sudo vim /etc/pf.anchors/custom
清理:
设置VPN服务器 https://jonsview.com/how-to-setup-os-x-10-9-as-a-l2tp-vpn-server-without-apples-server-app
设置自动开机 sudo pmset autorestart 1
adb shell pm list packages
adb shell pm clear com.package.app
adb uninstall com.package.app
adb install -t debug.apk
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host=pypi.tuna.tsinghua.edu.cn
disable-pip-version-check=true
timeout=30
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
npm config set registry http://registry.npm.taobao.org/
def json_structure(j):
"""
JSON有三种结构:字面值(int, bool, str), dict, list
为简化处理,将list通过转换视为dict结构,key为序号。
["a", 1] -> {"0": "a", "1": 1}
这个函数返回json的结构信息,"值"会被丢弃。
{"a": 1, "b": ["n", false]}
->
REQ: GET /api/v1/object/{number}/property
REQ: POST /api/v1/object/{number}/action
{"xx": "xx"}
RES: {
"code": 0/1/-1,
"msg": "",
"resp": {
}