chantzekin / blog Goto Github PK
View Code? Open in Web Editor NEW💡✍ 思考和记录的地方
Home Page: https://chantzekin.github.io/blog/
💡✍ 思考和记录的地方
Home Page: https://chantzekin.github.io/blog/
首先安装 polipo
程序
$ brew install polipo
设置 polipo
程序开机自启动
$ vim /usr/local/opt/polipo/homebrew.mxcl.polipo.plist
需要给 polipo
程序走 ss 客户端的代理,配置如下
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>homebrew.mxcl.polipo</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/usr/local/opt/polipo/bin/polipo</string>
<string>socksParentProxy=localhost:1080</string>
</array>
</dict>
</plist>
接着执行命令
$ ln -sfv /usr/local/opt/polipo/*.plist ~/Library/LaunchAgents
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.polipo.plist
并且启动
$ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.polipo.plist
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.polipo.plist
给 shell
设置别名以简短命令执行
macOS 用户修改 ~/.bash_profile
,用 zsh
的话就编辑 ~/.zshrc
$ vim ~/.bash_profile # 或 vim ~/.zshrc
尾部追加
# Polipo proxy
alias proxy="export http_proxy=http://localhost:8123; export https_proxy=http://localhost:8123"
alias unproxy="unset http_proxy; unset https_proxy"
重新读取配置
$ source ~/.bash_profile # 或 source ~/.zshrc 或直接 zsh
此后,需要走代理的时候执行 proxy
即可,取消的话就 unproxy
咯
参考资料:
为终端设置Shadowsocks代理, 解决golang dep ensure依赖包安装被墙 - 作者:Quinton
使用 mobx 时,通过修饰符 observer
将组建变成响应式组建时,或定义需要关注的对象的其他情况时,会有报错的情况
@observer
class App extends Component { ... }
[js] Experimental support for decorators is a feature that is subject to change in a future release
vscode 会有波纹下划线的报错提醒,但是 webpack 能编译通过
这时候,可以在项目根目录创建 jsconfig.json
,内容为
{
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
}
ok,报错消除
由于预置的脚手架环境不支持 decorators
装饰模式,需要手动配置 babel plugin
先执行 create-react-app
的 eject
指令来解除 cli
环境
$ npm run eject
安装装饰器支持
$ npm i --save-dev babel-plugin-transform-decorators-legacy
然后修改根目录下的 package.json
(create-react-app 版本 1.3.3)
找到 babel
的配置对象增加插件
"babel": {
"presets": [
"react-app"
],
"plugins": [
"transform-decorators-legacy"
]
}
然后 $ npm run start
测试下就好
也有其他情况,譬如有自建的 .babelrc
或者不使用修饰符的情况
参照 如何(不)使用装饰器
补充:
更新 Homebrew
~ brew update
使用 Homebrew 安装 MongoDB 并等待安装完毕
~ brew install mongodb
安装结束有提示运行的方法 mongod --config /usr/local/etc/mongod.conf
,此为配置文件
systemLog:
destination: file
# 日志地址
path: /usr/local/var/log/mongodb/mongo.log
logAppend: true
storage:
# 数据库读写目录
dbPath: /usr/local/var/mongodb
net:
# 监听 host
bindIp: 127.0.0.1
测试一下,保持执行 mongod
的终端窗口,新建窗口执行命令 mongo
执行
> show dbs
admin 0.000GB
local 0.000GB
> use test
switched to db test
> db.test.insert({'name':'Josh'})
WriteResult({ "nInserted" : 1 })
> db.test.find()
{ "_id" : ObjectId("5985d0a015714f48c2655e57"), "name" : "Josh" }
图形操作管理软件可以选择 Studio 3T
以上
官网安装包 (5.7.19),链接
打开下载好的 dmg 镜像,按步骤安装
安装成功后,系统偏好设置 -> msql -> 开启服务
终端输入 mysql
命令提示 command not found: mysql
此时应该设置环境变量
查看是目录下否有 mysql
$ cd /use/local/mysql/bin
$ open .
# 或者 ls
设置环境变量
$ vim ~/.bash_profile
# 按 i,增加一行 PATH=$PATH:/usr/local/mysql/bin
# esc -> :wq
$ source ~/.bash_profile
终端执行 mysql -u root -p
,输入安装时提示的密码
执行命令修改密码
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('test123');
后续可以用 Navicat 图形程序进行操作管理
以上
在 vue 文件的 script 标签内,鼠标指向 this.data.someVar
或 this.someMethod()
无提示,并按 F12
或 ctrl / command + 点击
提示无法转向定义时,可通过下面方式解决
$ npm install @vue/cli-plugin-babel -D
# or
$ yarn add @vue/cli-plugin-babel -D
// .babelrc.js
{
presets: [
'@vue/app',
...
]
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.