mirror of
https://github.com/jaywcjlove/reference.git
synced 2025-06-20 14:07:32 +08:00
Compare commits
23 Commits
Author | SHA1 | Date | |
---|---|---|---|
bf962194da | |||
f5e2ad2c31 | |||
ff0cc58c1d | |||
b42883e3de | |||
931850d916 | |||
f4d2c99007 | |||
112a53c101 | |||
9e525009c9 | |||
f78562b95e | |||
63d846b35d | |||
afd924a928 | |||
fb19cda5bb | |||
c9834110cd | |||
98edffbca0 | |||
b3d206d981 | |||
9ec7595b83 | |||
ef823de9a5 | |||
da22b78d8f | |||
06978b1601 | |||
b768bd4e9b | |||
a143e30d93 | |||
7ac675e34c | |||
8e3307272c |
@ -175,6 +175,9 @@ REF_LABEL=网站首页
|
||||
<a href="https://github.com/1834423612" title="kjch">
|
||||
<img src="https://avatars.githubusercontent.com/u/49981661?v=4" width="42;" alt="kjch"/>
|
||||
</a>
|
||||
<a href="https://github.com/pangxiaoli" title="pangxiaoli">
|
||||
<img src="https://avatars.githubusercontent.com/u/54620953?v=4" width="42;" alt="pangxiaoli"/>
|
||||
</a>
|
||||
<a href="https://github.com/partoneplay" title="partoneplay">
|
||||
<img src="https://avatars.githubusercontent.com/u/5189132?v=4" width="42;" alt="partoneplay"/>
|
||||
</a>
|
||||
@ -226,6 +229,9 @@ REF_LABEL=网站首页
|
||||
<a href="https://github.com/likeshop-github" title="LikeShop技术社区">
|
||||
<img src="https://avatars.githubusercontent.com/u/77180968?v=4" width="42;" alt="LikeShop技术社区"/>
|
||||
</a>
|
||||
<a href="https://github.com/LiuYuan-SHU" title="Liuyuan">
|
||||
<img src="https://avatars.githubusercontent.com/u/96400967?v=4" width="42;" alt="Liuyuan"/>
|
||||
</a>
|
||||
<a href="https://github.com/mariuszmichalowski" title="Mariusz Michalowski">
|
||||
<img src="https://avatars.githubusercontent.com/u/92091891?v=4" width="42;" alt="Mariusz Michalowski"/>
|
||||
</a>
|
||||
@ -238,6 +244,9 @@ REF_LABEL=网站首页
|
||||
<a href="https://github.com/QDelta" title="QDelta">
|
||||
<img src="https://avatars.githubusercontent.com/u/60222316?v=4" width="42;" alt="QDelta"/>
|
||||
</a>
|
||||
<a href="https://github.com/qinxiongzhou" title="Ryan Zhou">
|
||||
<img src="https://avatars.githubusercontent.com/u/33239096?v=4" width="42;" alt="Ryan Zhou"/>
|
||||
</a>
|
||||
<a href="https://github.com/whb1998a" title="WHB">
|
||||
<img src="https://avatars.githubusercontent.com/u/44045064?v=4" width="42;" alt="WHB"/>
|
||||
</a>
|
||||
|
13
README.md
13
README.md
@ -161,6 +161,7 @@ Quick Reference
|
||||
## 数据库
|
||||
|
||||
[MySQL](./docs/mysql.md)<!--rehype:style=background: rgb(1 117 143);&class=tag&data-lang=SQL-->
|
||||
[MongoDB](./docs/mongodb.md)<!--rehype:style=background: rgb(0 237 100);-->
|
||||
[Oracle](./docs/oracle.md)<!--rehype:style=background: rgb(255 0 0);&class=tag&data-lang=SQL-->
|
||||
[PostgreSQL](./docs/postgres.md)<!--rehype:style=background: rgb(43 109 163);&class=tag&data-lang=SQL-->
|
||||
[Redis](./docs/redis.md)<!--rehype:style=background: rgb(198 47 44);-->
|
||||
@ -177,6 +178,7 @@ Quick Reference
|
||||
[Gitlab](./docs/gitlab.md)<!--rehype:style=background: rgb(226 67 41);-->
|
||||
[Google Chrome](./docs/google-chrome.md)<!--rehype:style=background: rgb(29 116 232);-->
|
||||
[IntelliJ IDEA](./docs/intelli-j-idea.md)<!--rehype:style=background: rgb(223 148 0);&class=tag&data-lang=Java-->
|
||||
[PyCharm](./docs/pycharm.md)<!--rehype:style=background: rgb(36 215 137);&class=tag&data-lang=Python-->
|
||||
[Sketch](./docs/sketch.md)<!--rehype:style=background: rgb(223 148 0);&class=tag&data-lang=macOS-->
|
||||
[Sublime Text](./docs/sublime-text.md)<!--rehype:style=background: rgb(223 148 0);-->
|
||||
[VSCode](./docs/vscode.md)<!--rehype:style=background: rgb(91 163 230);-->
|
||||
@ -244,6 +246,9 @@ Quick Reference
|
||||
<a href="https://github.com/1834423612" title="kjch">
|
||||
<img src="https://avatars.githubusercontent.com/u/49981661?v=4" width="42;" alt="kjch"/>
|
||||
</a>
|
||||
<a href="https://github.com/pangxiaoli" title="pangxiaoli">
|
||||
<img src="https://avatars.githubusercontent.com/u/54620953?v=4" width="42;" alt="pangxiaoli"/>
|
||||
</a>
|
||||
<a href="https://github.com/partoneplay" title="partoneplay">
|
||||
<img src="https://avatars.githubusercontent.com/u/5189132?v=4" width="42;" alt="partoneplay"/>
|
||||
</a>
|
||||
@ -295,6 +300,9 @@ Quick Reference
|
||||
<a href="https://github.com/likeshop-github" title="LikeShop技术社区">
|
||||
<img src="https://avatars.githubusercontent.com/u/77180968?v=4" width="42;" alt="LikeShop技术社区"/>
|
||||
</a>
|
||||
<a href="https://github.com/LiuYuan-SHU" title="Liuyuan">
|
||||
<img src="https://avatars.githubusercontent.com/u/96400967?v=4" width="42;" alt="Liuyuan"/>
|
||||
</a>
|
||||
<a href="https://github.com/mariuszmichalowski" title="Mariusz Michalowski">
|
||||
<img src="https://avatars.githubusercontent.com/u/92091891?v=4" width="42;" alt="Mariusz Michalowski"/>
|
||||
</a>
|
||||
@ -307,6 +315,9 @@ Quick Reference
|
||||
<a href="https://github.com/QDelta" title="QDelta">
|
||||
<img src="https://avatars.githubusercontent.com/u/60222316?v=4" width="42;" alt="QDelta"/>
|
||||
</a>
|
||||
<a href="https://github.com/qinxiongzhou" title="Ryan Zhou">
|
||||
<img src="https://avatars.githubusercontent.com/u/33239096?v=4" width="42;" alt="Ryan Zhou"/>
|
||||
</a>
|
||||
<a href="https://github.com/whb1998a" title="WHB">
|
||||
<img src="https://avatars.githubusercontent.com/u/44045064?v=4" width="42;" alt="WHB"/>
|
||||
</a>
|
||||
@ -420,6 +431,8 @@ Quick Reference
|
||||
[eryajf.net](https://ref.eryajf.net/)<!--rehype:target=_blank&class=contributing&data-info=👆每天自动同步-->
|
||||
[kjchmc.cn](https://ref.kjchmc.cn/)<!--rehype:target=_blank&class=contributing&data-info=👆实时同步,多线路-->
|
||||
[likeadmin.cn](https://www.likeadmin.cn/quickref/)<!--rehype:target=_blank&class=contributing&data-info=👆每天自动同步-->
|
||||
[ref.qiubit.cc](http://ref.qiubit.cc)<!--rehype:target=_blank&class=contributing&data-info=👆每天自动同步-->
|
||||
[aoh.cc](https://aoh.cc/)<!--rehype:target=_blank-->
|
||||
<!--rehype:class=home-card home-links-->
|
||||
|
||||
如果你有资源,可以很方便部署 web 版,这非常简单,只需要克隆 [gh-pages](https://github.com/jaywcjlove/reference/tree/gh-pages) 分支代码到你的静态服务就可以了,还可以使用 [docker](https://hub.docker.com/r/wcjiang/reference) 快捷部署 web 版。
|
||||
|
3
assets/mongodb.svg
Normal file
3
assets/mongodb.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg viewBox="0 0 120 257" fill="none" xmlns="http://www.w3.org/2000/svg" height="1em" width="1em">
|
||||
<path d="M82.323 28.644C71.537 15.847 62.249 2.85 60.35.15c-.2-.2-.5-.2-.7 0-1.897 2.7-11.185 15.697-21.971 28.494C-54.902 146.721 52.26 226.406 52.26 226.406l.9.6C53.958 239.303 55.955 257 55.955 257h7.99s1.998-17.597 2.797-29.994l.899-.7c.1.1 107.263-79.585 14.68-197.662ZM59.95 224.606s-4.793-4.099-6.092-6.198v-.201l5.793-128.574c0-.4.6-.4.6 0l5.792 128.574v.201c-1.299 2.099-6.093 6.198-6.093 6.198Z" fill="currentColor"/>
|
||||
</svg>
|
After Width: | Height: | Size: 537 B |
3
assets/pycharm.svg
Normal file
3
assets/pycharm.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor" height="1em" width="1em">
|
||||
<path d="M7.833 6.666v-.055c0-1-.667-1.5-1.778-1.5H4.389v3.055h1.723c1.111 0 1.721-.666 1.721-1.5zM0 0v24h24V0H0zm2.223 3.167h4c2.389 0 3.833 1.389 3.833 3.445v.055c0 2.278-1.778 3.5-4.001 3.5H4.389v2.945H2.223V3.167zM11.277 21h-9v-1.5h9V21zm4.779-7.777c-2.944.055-5.111-2.223-5.111-5.057C10.944 5.333 13.056 3 16.111 3c1.889 0 3 .611 3.944 1.556l-1.389 1.61c-.778-.722-1.556-1.111-2.556-1.111-1.658 0-2.873 1.375-2.887 3.084.014 1.709 1.174 3.083 2.887 3.083 1.111 0 1.833-.445 2.61-1.167l1.39 1.389c-.999 1.112-2.166 1.779-4.054 1.779z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 656 B |
81
docs/cpp.md
81
docs/cpp.md
@ -545,6 +545,87 @@ int main() {
|
||||
}
|
||||
```
|
||||
|
||||
### Lambda 表达式
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
|
||||
Lambda 表达式可以在函数内定义,可以理解为在函数内定义的临时函数。格式:
|
||||
|
||||
```cpp
|
||||
auto func = []() -> return_type { };
|
||||
```
|
||||
|
||||
- `[]`为捕获列表,能够捕获其所在函数的局部变量
|
||||
- 一个空的捕获列表代表Lambda表达式不捕获任何的变量
|
||||
- 对于值捕获,直接在中括号中填写要捕获的变量即可:
|
||||
|
||||
```cpp
|
||||
int val = 5;
|
||||
auto func = [val]() -> return_type { };
|
||||
```
|
||||
|
||||
- 对于引用捕获,需要在捕获的变量前添加`&`:
|
||||
|
||||
```cpp
|
||||
string str("hello world!");
|
||||
auto func = [&str]() -> return_type { };
|
||||
```
|
||||
|
||||
- 如果变量太多,需要编译器根据我们编写的代码自动捕获,可以采用隐式捕获的方式。
|
||||
|
||||
- 全部值捕获:
|
||||
|
||||
```cpp
|
||||
int val1, val2;
|
||||
auto func = [=]() -> int
|
||||
{
|
||||
return val1 + val2;
|
||||
};
|
||||
```
|
||||
|
||||
- 全部引用捕获:
|
||||
|
||||
```cpp
|
||||
string str1("hello"), str2("word!");
|
||||
auto func = [&]() -> string
|
||||
{
|
||||
return str1 + str2;
|
||||
};
|
||||
```
|
||||
|
||||
- 混合隐式捕获:
|
||||
|
||||
如果希望对一部分变量采用值捕获,对其他变量采用引用捕获,可以混合使用:
|
||||
|
||||
```cpp
|
||||
int val1 = 123, val2 = 456;
|
||||
string str1("123"), str2(456);
|
||||
|
||||
auto func1 = [=, &str1]() -> int
|
||||
{
|
||||
return val1 == std::stoi(str1) ? val1 : val2;
|
||||
};
|
||||
|
||||
auto func2 = [&, val1]() -> int
|
||||
{
|
||||
return str1 == std::to_string(val1) ? str1 : str2;
|
||||
};
|
||||
```
|
||||
|
||||
- `()` 是参数列表,我们只需要按照普通函数的使用方法来使用即可
|
||||
- `return_type` 是函数的返回类型,`-> return_type` 可以不写,编译器会自动推导
|
||||
- `{}` 中的内容就是函数体,依照普通函数的使用方法使用即可
|
||||
<!--rehype:className=style-timeline-->
|
||||
|
||||
此处给出一个 Lambda 表达式的实际使用例子(当然可以使用 `str::copy`):
|
||||
|
||||
```cpp
|
||||
std::vector<int> vec({1, 2, 3, 4, 5}); // vec中包含1, 2, 3, 4, 5
|
||||
std::for_each(vec.begin(), vec.end(), [](int& ele) -> void
|
||||
{
|
||||
std::cout << ele << " ";
|
||||
});
|
||||
```
|
||||
|
||||
C++ 预处理器
|
||||
------------
|
||||
|
||||
|
@ -118,9 +118,8 @@ CSS 工具
|
||||
在线代码编辑器工具
|
||||
---
|
||||
|
||||
[CodePen](http://codepen.io/)<!--rehype:target=_blank-->
|
||||
[CodeSandbox](https://codesandbox.io/)<!--rehype:target=_blank-->
|
||||
[CodePen](https://codepen.io/)<!--rehype:target=_blank-->
|
||||
[CodeSandbox](https://codesandbox.io/)<!--rehype:target=_blank-->
|
||||
[StackBlitz](https://stackblitz.com/)<!--rehype:target=_blank-->
|
||||
[esbuild](https://esbuild.github.io/)<!--rehype:target=_blank-->
|
||||
[JSFiddle](https://jsfiddle.net/)<!--rehype:target=_blank-->
|
||||
|
@ -1,7 +1,7 @@
|
||||
iptables 备忘清单
|
||||
====
|
||||
|
||||
iptables 是一个配置 Linux 内核 防火墙(opens new window)的命令行工具,是 [netfilter](https://en.wikipedia.org/wiki/Netfilter)(opens new window)项目的一部分。这个快速参考备忘单显示了它的常用命令使用清单
|
||||
iptables 是一个配置 Linux 内核防火墙的命令行工具,是 [netfilter](https://en.wikipedia.org/wiki/Netfilter) 项目的一部分。这个快速参考备忘单显示了它的常用命令使用清单
|
||||
|
||||
入门
|
||||
---
|
||||
|
33
docs/java.md
33
docs/java.md
@ -89,7 +89,7 @@ boolean[] answers = {true, false};
|
||||
|
||||
查看: [Arrays](#java-数组)
|
||||
|
||||
### Swap
|
||||
### 交换变量 Swap
|
||||
|
||||
```java
|
||||
int a = 1;
|
||||
@ -101,7 +101,7 @@ b = temp;
|
||||
System.out.println(a + " " + b); // 2 1
|
||||
```
|
||||
|
||||
### Type Casting
|
||||
### 类型转换 Type Casting
|
||||
|
||||
```java
|
||||
// Widening
|
||||
@ -344,7 +344,7 @@ for (int a: arr) {
|
||||
// 输出: a b c
|
||||
```
|
||||
|
||||
### Multidimensional Arrays
|
||||
### 二维数组 Multidimensional Arrays
|
||||
|
||||
```java
|
||||
int[][] matrix = { {1, 2, 3}, {4, 5} };
|
||||
@ -359,7 +359,7 @@ for (int i = 0; i < a.length; ++i) {
|
||||
// 输出: 1 2 3 4 5 6 7
|
||||
```
|
||||
|
||||
### Sort
|
||||
### 排序 Sort
|
||||
|
||||
```java
|
||||
char[] chars = {'b', 'a', 'c'};
|
||||
@ -547,10 +547,10 @@ for (int i = 0; i < 5; i++) {
|
||||
Java 框架搜集
|
||||
--------------------
|
||||
|
||||
### Java 搜集
|
||||
### Java 集合
|
||||
<!--rehype:wrap-class=col-span-2 row-span-2-->
|
||||
|
||||
搜集 | Interface | 有序 | 已排序 | 线程安全 | 复制 | Nullable
|
||||
集合 | Interface | 有序 | 已排序 | 线程安全 | 复制 | Nullable
|
||||
:-|:-|:-|:-|:-|:-|:-
|
||||
[ArrayList](https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html) | List | Y | _N_ | _N_ | Y | Y
|
||||
[Vector](https://docs.oracle.com/javase/8/docs/api/java/util/Vector.html) | List | Y | _N_ | Y | Y | Y
|
||||
@ -615,6 +615,25 @@ m.forEach((key, value) -> {
|
||||
});
|
||||
```
|
||||
|
||||
### ConcurrentHashMap
|
||||
|
||||
```java
|
||||
ConcurrentHashMap<Integer, String> m
|
||||
= new ConcurrentHashMap<>();
|
||||
m.put(100, "Hello");
|
||||
m.put(101, "Geeks");
|
||||
m.put(102, "Geeks");
|
||||
// 移除
|
||||
m.remove(101, "Geeks");
|
||||
|
||||
// 如果不存在,就添加,存在就不变更
|
||||
m.putIfAbsent(103, "Hello");
|
||||
|
||||
// 替换
|
||||
m.replace(101, "Hello", "For");
|
||||
System.out.println(m);
|
||||
```
|
||||
|
||||
### HashSet
|
||||
|
||||
```java
|
||||
@ -771,7 +790,7 @@ text.split(Pattern.quote("|"));
|
||||
`Math.toDegrees(rad)` | 以度为单位的角度弧度
|
||||
`Math.toRadians(deg)` | 以弧度为单位的角度度
|
||||
|
||||
### Try/Catch/Finally
|
||||
### 异常 Try/Catch/Finally
|
||||
|
||||
```java
|
||||
try {
|
||||
|
@ -1190,6 +1190,99 @@ console.log(myCat.name);
|
||||
myCat.name = 'Yankee';
|
||||
```
|
||||
|
||||
### Proxy
|
||||
|
||||
Proxy 对象用于创建一个对象的代理,从而实现基本操作的拦截和自定义(如属性查找、赋值、枚举、函数调用等)。
|
||||
|
||||
```javascript
|
||||
// 用于拦截对象的读取属性操作。
|
||||
const handler = {
|
||||
get: function(obj, prop) {
|
||||
return prop in obj ? obj[prop] : 37;
|
||||
}
|
||||
};
|
||||
|
||||
const p = new Proxy({}, handler);
|
||||
p.a = 1;
|
||||
p.b = undefined;
|
||||
|
||||
console.log(p.a, p.b); // 1, undefined
|
||||
console.log('c' in p, p.c); // false, 37
|
||||
```
|
||||
|
||||
#### 语法
|
||||
|
||||
```javascript
|
||||
const p = new Proxy(target, handler)
|
||||
```
|
||||
|
||||
- target 要使用 Proxy 包装的目标对象(可以是任何类型的对象,包括原生数组,函数,甚至另一个代理)。
|
||||
- handler 一个通常以函数作为属性的对象,各属性中的函数分别定义了在执行各种操作时代理 p 的行为。
|
||||
|
||||
#### 方法
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`Proxy.revocable()` | 创建一个可撤销的Proxy对象 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/revocable)
|
||||
|
||||
#### handler 对象的方法
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`handler.getPrototypeOf()` | Object.getPrototypeOf 方法的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/getPrototypeOf)
|
||||
`handler.setPrototypeOf()` | Object.setPrototypeOf 方法的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/setPrototypeOf)
|
||||
`handler.isExtensible()` | Object.isExtensible 方法的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/isExtensible)
|
||||
`handler.preventExtensions()` | Object.preventExtensions 方法的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/preventExtensions)
|
||||
`handler.getOwnPropertyDescriptor()` | Object.getOwnPropertyDescriptor 方法的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/getOwnPropertyDescriptor)
|
||||
`handler.defineProperty()` | Object.defineProperty 方法的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/defineProperty)
|
||||
`handler.has()` | in 操作符的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/has)
|
||||
`handler.get()` | 属性读取操作的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/get)
|
||||
`handler.set()` | 属性设置操作的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/set)
|
||||
`handler.deleteProperty()` | delete 操作符的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/deleteProperty)
|
||||
`handler.ownKeys()` | Object.getOwnPropertyNames 方法和 Object.getOwnPropertySymbols 方法的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/ownKeys)
|
||||
`handler.apply()` | 函数调用操作的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/apply)
|
||||
`handler.construct()` | new 操作符的捕捉器 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/construct)
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
### Reflect
|
||||
|
||||
Reflect 是一个内置的对象,它提供拦截 JavaScript 操作的方法。这些方法与proxy handlers (en-US)的方法相同。Reflect不是一个函数对象,因此它是不可构造的。
|
||||
|
||||
```javascript
|
||||
// 检测一个对象是否存在特定属性
|
||||
const duck = {
|
||||
name: 'Maurice',
|
||||
color: 'white',
|
||||
greeting: function() {
|
||||
console.log(`Quaaaack! My name is ${this.name}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reflect.has(duck, 'color');
|
||||
// true
|
||||
Reflect.has(duck, 'haircut');
|
||||
// false
|
||||
```
|
||||
|
||||
#### 静态方法
|
||||
|
||||
:- | :-
|
||||
:- | :-
|
||||
`Reflect.apply(target, thisArgument, argumentsList)` | 对一个函数进行调用操作,同时可以传入一个数组作为调用参数。和 Function.prototype.apply() 功能类似 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/apply)
|
||||
`Reflect.construct(target, argumentsList[, newTarget])` | 对构造函数进行 new 操作,相当于执行 new target(...args) [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/construct)
|
||||
`Reflect.defineProperty(target, propertyKey, attributes)` | 和 Object.defineProperty() 类似。如果设置成功就会返回 true [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/defineProperty)
|
||||
`Reflect.deleteProperty(target, propertyKey)` | 作为函数的delete操作符,相当于执行 delete target[name] [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/deleteProperty)
|
||||
`Reflect.get(target, propertyKey[, receiver])` | 获取对象身上某个属性的值,类似于 target[name] [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/get)
|
||||
`Reflect.getOwnPropertyDescriptor(target, propertyKey)` | 类似于 Object.getOwnPropertyDescriptor()。如果对象中存在该属性,则返回对应的属性描述符,否则返回 undefined [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/getOwnPropertyDescriptor)
|
||||
`Reflect.getPrototypeOf(target)` | 类似于 Object.getPrototypeOf() [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/getPrototypeOf)
|
||||
`Reflect.has(target, propertyKey)` | 判断一个对象是否存在某个属性,和 in 运算符 的功能完全相同 [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/has)
|
||||
`Reflect.isExtensible(target)` | 类似于 Object.isExtensible() [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/isExtensible)
|
||||
`Reflect.ownKeys(target)` | 返回一个包含所有自身属性(不包含继承属性)的数组。(类似于 Object.keys(), 但不会受enumerable 影响) [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/ownKeys)
|
||||
`Reflect.preventExtensions(target)` | 类似于 Object.preventExtensions()。返回一个Boolean [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/preventExtensions)
|
||||
`Reflect.set(target, propertyKey, value[, receiver])` | 将值分配给属性的函数。返回一个Boolean,如果更新成功,则返回true [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/set)
|
||||
`Reflect.setPrototypeOf(target, prototype)` | 设置对象原型的函数。返回一个 Boolean,如果更新成功,则返回 true [#](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/setPrototypeOf)
|
||||
<!--rehype:className=style-list-arrow-->
|
||||
|
||||
JavaScript this 绑定
|
||||
----
|
||||
|
||||
|
434
docs/mongodb.md
Normal file
434
docs/mongodb.md
Normal file
@ -0,0 +1,434 @@
|
||||
MongoDB 备忘清单
|
||||
===
|
||||
|
||||
[MongoDB](https://www.mongodb.com/developer/products/mongodb/cheat-sheet/#connect-mongodb-shell) 此备忘单包含一些方便的提示、命令和快速参考,可让您立即连接并进行 CRUD
|
||||
|
||||
入门
|
||||
---
|
||||
|
||||
### 连接 MongoDB Shell
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
|
||||
```bash
|
||||
mongo # 默认连接到 mongodb://127.0.0.1:27017
|
||||
mongo --host <host> --port <port> -u <user> -p <pwd> # 如果需要提示,请省略密码
|
||||
mongo "mongodb://192.168.1.1:27017"
|
||||
# MongoDB 地图集
|
||||
mongo "mongodb+srv://cluster-name.abcde.mongodb.net/<dbname>" --username <username>
|
||||
```
|
||||
|
||||
### 显示数据库
|
||||
|
||||
```mongodb
|
||||
show dbs
|
||||
db // 打印当前数据库
|
||||
```
|
||||
|
||||
### 切换数据库
|
||||
|
||||
```mongodb
|
||||
use <database_name>
|
||||
```
|
||||
|
||||
### 显示收藏
|
||||
|
||||
```mongodb
|
||||
show collections
|
||||
```
|
||||
|
||||
### 运行 JavaScript 文件
|
||||
|
||||
```mongodb
|
||||
load("myScript.js")
|
||||
```
|
||||
|
||||
CRUD
|
||||
---
|
||||
|
||||
### 创建
|
||||
<!--rehype:wrap-class=col-span-3-->
|
||||
|
||||
```mongodb
|
||||
db.coll.insertOne({ name: "Max" })
|
||||
db.coll.insert([{ name: "Max"}, {name:"Alex"}]) // 订购批量插入
|
||||
db.coll.insert([{ name: "Max"}, {name:"Alex"}], {ordered: false}) // 无序批量插入
|
||||
db.coll.insert({ date: ISODate()})
|
||||
db.coll.insert({ name: "Max"}, {"writeConcern": {"w": "majority", "wtimeout": 5000}})
|
||||
```
|
||||
|
||||
### 寻找文件
|
||||
|
||||
Commands | Description
|
||||
:-- | ---
|
||||
`db.docx.findOne()` | 查找一个随机文档
|
||||
`db.docx.find().prettyPrint()` | 查找所有文档
|
||||
`db.docx.find({}, {name:true, _id:false})` | 仅显示文档 Docx 的名称
|
||||
`db.docx.find({}, {name:true, _id:false})` | 可以在多个文件中按属性查找一个文件
|
||||
|
||||
### 使用运算符查找文档
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
|
||||
Operator | Description | Commands
|
||||
:-- | --- | ---
|
||||
`$gt` | 比...更棒 | `db.docx.find({class:{$gt:'T'}`
|
||||
`$gte` | 大于等于 | `db.docx.find({class:{$gt:'T'}`
|
||||
`$lt` | 小于 | `db.docx.find({class:{$lt:'T'}`
|
||||
`$lte` | 小于等于 | `db.docx.find({class:{$lte:'T'}`
|
||||
`$exists` | 属性是否存在 | `db.docx.find({class:{$gt:'T'}`
|
||||
`$regex` | 正则表达式匹配 | `db.docx.find({name:{$regex:'^USS\\sE'}})`
|
||||
`$type` | 按元素类型搜索 | `db.docx.find({name : {$type:4}})`
|
||||
|
||||
### 读取
|
||||
<!--rehype:wrap-class=col-span-3-->
|
||||
|
||||
```mongodb
|
||||
db.coll.findOne() // 返回单个文档
|
||||
db.coll.find() // 返回一个游标 - 显示 20 个结果 - "it" 显示更多
|
||||
db.coll.find().pretty()
|
||||
db.coll.find({name: "Max", age: 32}) // 隐式逻辑“与”。
|
||||
db.coll.find({date: ISODate("2020-09-25T13:57:17.180Z")})
|
||||
|
||||
// 或“queryPlanner”或“allPlansExecution”
|
||||
db.coll.find({name: "Max", age: 32}).explain("executionStats")
|
||||
db.coll.distinct("name")
|
||||
|
||||
// 数数
|
||||
db.coll.count({age: 32}) // 基于馆藏元数据的估计
|
||||
db.coll.estimatedDocumentCount() // 基于馆藏元数据的估计
|
||||
db.coll.countDocuments({age: 32}) // 聚合管道的别名 - 准确计数
|
||||
|
||||
// Comparison 比较
|
||||
db.coll.find({"year": {$gt: 1970}})
|
||||
db.coll.find({"year": {$gte: 1970}})
|
||||
db.coll.find({"year": {$lt: 1970}})
|
||||
db.coll.find({"year": {$lte: 1970}})
|
||||
db.coll.find({"year": {$ne: 1970}})
|
||||
db.coll.find({"year": {$in: [1958, 1959]}})
|
||||
db.coll.find({"year": {$nin: [1958, 1959]}})
|
||||
|
||||
|
||||
// Logical 逻辑
|
||||
db.coll.find({name:{$not: {$eq: "Max"}}})
|
||||
db.coll.find({$or: [{"year" : 1958}, {"year" : 1959}]})
|
||||
db.coll.find({$nor: [{price: 1.99}, {sale: true}]})
|
||||
db.coll.find({
|
||||
$and: [
|
||||
{$or: [{qty: {$lt :10}}, {qty :{$gt: 50}}]},
|
||||
{$or: [{sale: true}, {price: {$lt: 5 }}]}
|
||||
]
|
||||
})
|
||||
|
||||
// Element 元素
|
||||
db.coll.find({name: {$exists: true}})
|
||||
db.coll.find({"zipCode": {$type: 2 }})
|
||||
db.coll.find({"zipCode": {$type: "string"}})
|
||||
|
||||
// Aggregation Pipeline 聚合管道
|
||||
db.coll.aggregate([
|
||||
{$match: {status: "A"}},
|
||||
{$group: {_id: "$cust_id", total: {$sum: "$amount"}}},
|
||||
{$sort: {total: -1}}
|
||||
])
|
||||
|
||||
// 使用“文本”索引进行文本搜索
|
||||
db.coll.find({$text: {$search: "cake"}}, {score: {$meta: "textScore"}})
|
||||
.sort({score: {$meta: "textScore"}})
|
||||
|
||||
// Regex 正则表达式
|
||||
db.coll.find({name: /^Max/}) // 正则表达式:以字母“M”开头
|
||||
db.coll.find({name: /^Max$/i}) // 正则表达式不区分大小写
|
||||
|
||||
// Array
|
||||
db.coll.find({tags: {$all: ["Realm", "Charts"]}})
|
||||
db.coll.find({field: {$size: 2}}) // 无法索引 - 更喜欢存储数组的大小并更新它
|
||||
db.coll.find({results: {$elemMatch: {product: "xyz", score: {$gte: 8}}}})
|
||||
|
||||
// Projections 预测
|
||||
db.coll.find({"x": 1}, {"actors": 1}) // actors + _id
|
||||
db.coll.find({"x": 1}, {"actors": 1, "_id": 0}) // actors
|
||||
db.coll.find({"x": 1}, {"actors": 0, "summary": 0}) // 除了“actors”和“summary”之外的所有内容
|
||||
|
||||
// Sort 排序, skip 跳过, limit 限制
|
||||
db.coll.find({}).sort({"year": 1, "rating": -1}).skip(10).limit(3)
|
||||
|
||||
// Read Concern 阅读关注
|
||||
db.coll.find().readConcern("majority")
|
||||
```
|
||||
|
||||
### 更新
|
||||
<!--rehype:wrap-class=col-span-3-->
|
||||
|
||||
```mongodb
|
||||
db.coll.update({"_id": 1}, {"year": 2016}) // 警告! 替换整个文档
|
||||
db.coll.update({"_id": 1}, {$set: {"year": 2016, name: "Max"}})
|
||||
db.coll.update({"_id": 1}, {$unset: {"year": 1}})
|
||||
db.coll.update({"_id": 1}, {$rename: {"year": "date"} })
|
||||
db.coll.update({"_id": 1}, {$inc: {"year": 5}})
|
||||
db.coll.update({"_id": 1}, {$mul: {price: NumberDecimal("1.25"), qty: 2}})
|
||||
db.coll.update({"_id": 1}, {$min: {"imdb": 5}})
|
||||
db.coll.update({"_id": 1}, {$max: {"imdb": 8}})
|
||||
db.coll.update({"_id": 1}, {$currentDate: {"lastModified": true}})
|
||||
db.coll.update({"_id": 1}, {$currentDate: {"lastModified": {$type: "timestamp"}}})
|
||||
|
||||
// Array
|
||||
db.coll.update({"_id": 1}, {$push :{"array": 1}})
|
||||
db.coll.update({"_id": 1}, {$pull :{"array": 1}})
|
||||
db.coll.update({"_id": 1}, {$addToSet :{"array": 2}})
|
||||
db.coll.update({"_id": 1}, {$pop: {"array": 1}}) // 最后一个元素
|
||||
db.coll.update({"_id": 1}, {$pop: {"array": -1}}) // 第一个元素
|
||||
db.coll.update({"_id": 1}, {$pullAll: {"array" :[3, 4, 5]}})
|
||||
db.coll.update({"_id": 1}, {$push: {scores: {$each: [90, 92, 85]}}})
|
||||
db.coll.updateOne({"_id": 1, "grades": 80}, {$set: {"grades.$": 82}})
|
||||
db.coll.updateMany({}, {$inc: {"grades.$[]": 10}})
|
||||
db.coll.update({}, {$set: {"grades.$[element]": 100}}, {multi: true, arrayFilters: [{"element": {$gte: 100}}]})
|
||||
|
||||
// 更新很多
|
||||
db.coll.update({"year": 1999}, {$set: {"decade": "90's"}}, {"multi":true})
|
||||
db.coll.updateMany({"year": 1999}, {$set: {"decade": "90's"}})
|
||||
|
||||
// FindOneAndUpdate 查找并更新
|
||||
db.coll.findOneAndUpdate({"name": "Max"}, {$inc: {"points": 5}}, {returnNewDocument: true})
|
||||
|
||||
// Upsert 更新插入
|
||||
db.coll.update({"_id": 1}, {$set: {item: "apple"}, $setOnInsert: {defaultQty: 100}}, {upsert: true})
|
||||
|
||||
// Replace 代替
|
||||
db.coll.replaceOne({"name": "Max"}, {"firstname": "Maxime", "surname": "Beugnet"})
|
||||
|
||||
// Save 保存
|
||||
db.coll.save({"item": "book", "qty": 40})
|
||||
|
||||
// Write concern 写关注
|
||||
db.coll.update({}, {$set: {"x": 1}}, {"writeConcern": {"w": "majority", "wtimeout": 5000}})
|
||||
```
|
||||
|
||||
### 删除
|
||||
<!--rehype:wrap-class=col-span-3-->
|
||||
|
||||
```mongodb
|
||||
db.coll.remove({name: "Max"})
|
||||
db.coll.remove({name: "Max"}, {justOne: true})
|
||||
db.coll.remove({}) // 警告!删除所有文档但不删除集合本身及其索引定义
|
||||
db.coll.remove({name: "Max"}, {"writeConcern": {"w": "majority", "wtimeout": 5000}})
|
||||
db.coll.findOneAndDelete({"name": "Max"})
|
||||
```
|
||||
|
||||
数据库和集合
|
||||
---
|
||||
|
||||
### Drop
|
||||
|
||||
```mongodb
|
||||
// 删除集合及其索引定义
|
||||
db.coll.drop()
|
||||
// 仔细检查你*不*在 PROD 集群上......:-)
|
||||
db.dropDatabase()
|
||||
```
|
||||
|
||||
### 创建集合
|
||||
<!--rehype:wrap-class=col-span-2 row-span-2-->
|
||||
|
||||
```mongodb
|
||||
// 使用 $jsonschema 创建集合
|
||||
db.createCollection("contacts", {
|
||||
validator: {$jsonSchema: {
|
||||
bsonType: "object",
|
||||
required: ["phone"],
|
||||
properties: {
|
||||
phone: {
|
||||
bsonType: "string",
|
||||
description: "必须是一个字符串并且是必需的"
|
||||
},
|
||||
email: {
|
||||
bsonType: "string",
|
||||
pattern: "@mongodb\.com$",
|
||||
description: "必须是字符串并匹配正则表达式模式"
|
||||
},
|
||||
status: {
|
||||
enum: [ "Unknown", "Incomplete" ],
|
||||
description: "只能是枚举值之一"
|
||||
}
|
||||
}
|
||||
}}
|
||||
})
|
||||
```
|
||||
|
||||
### 其他采集功能
|
||||
|
||||
```mongodb
|
||||
db.coll.stats()
|
||||
db.coll.storageSize()
|
||||
db.coll.totalIndexSize()
|
||||
db.coll.totalSize()
|
||||
db.coll.validate({full: true})
|
||||
// 第二个参数用于删除目标集合(如果存在)
|
||||
db.coll.renameCollection("new_coll", true)
|
||||
```
|
||||
|
||||
索引
|
||||
---
|
||||
|
||||
### 列表索引
|
||||
|
||||
```mongodb
|
||||
db.coll.getIndexes()
|
||||
db.coll.getIndexKeys()
|
||||
```
|
||||
|
||||
### 创建索引
|
||||
<!--rehype:wrap-class=col-span-2 row-span-3-->
|
||||
|
||||
```mongodb
|
||||
// 索引类型
|
||||
db.coll.createIndex({"name": 1}) // 单字段索引
|
||||
db.coll.createIndex({"name": 1, "date": 1}) // 复合索引
|
||||
db.coll.createIndex({foo: "text", bar: "text"}) // 文本索引
|
||||
db.coll.createIndex({"$**": "text"}) // 通配符文本索引
|
||||
db.coll.createIndex({"userMetadata.$**": 1}) // 通配符索引
|
||||
db.coll.createIndex({"loc": "2d"}) // 二维索引
|
||||
db.coll.createIndex({"loc": "2dsphere"}) // 2dsphere 索引
|
||||
db.coll.createIndex({"_id": "hashed"}) // 哈希索引
|
||||
|
||||
// Index Options
|
||||
db.coll.createIndex({"lastModifiedDate": 1}, {expireAfterSeconds: 3600}) // TTL指数
|
||||
db.coll.createIndex({"name": 1}, {unique: true})
|
||||
db.coll.createIndex({"name": 1}, {partialFilterExpression: {age: {$gt: 18}}}) // 部分索引
|
||||
// 强度为 1 或 2 的不区分大小写的索引
|
||||
db.coll.createIndex({"name": 1}, {collation: {locale: 'en', strength: 1}})
|
||||
db.coll.createIndex({"name": 1 }, {sparse: true})
|
||||
```
|
||||
|
||||
### 删除索引
|
||||
|
||||
```mongodb
|
||||
db.coll.dropIndex("name_1")
|
||||
```
|
||||
|
||||
### 隐藏/取消隐藏索引
|
||||
|
||||
```mongodb
|
||||
db.coll.hideIndex("name_1")
|
||||
db.coll.unhideIndex("name_1")
|
||||
```
|
||||
|
||||
方便的命令
|
||||
---
|
||||
|
||||
###
|
||||
<!--rehype:wrap-class=col-span-3&style=display:none;&wrap-style=padding-top: 0;-->
|
||||
|
||||
```mongodb
|
||||
use admin
|
||||
db.createUser({"user": "root", "pwd": passwordPrompt(), "roles": ["root"]})
|
||||
db.dropUser("root")
|
||||
db.auth( "user", passwordPrompt() )
|
||||
|
||||
use test
|
||||
db.getSiblingDB("dbname")
|
||||
db.currentOp()
|
||||
db.killOp(123) // opid
|
||||
|
||||
db.fsyncLock()
|
||||
db.fsyncUnlock()
|
||||
|
||||
db.getCollectionNames()
|
||||
db.getCollectionInfos()
|
||||
db.printCollectionStats()
|
||||
db.stats()
|
||||
|
||||
db.getReplicationInfo()
|
||||
db.printReplicationInfo()
|
||||
db.isMaster()
|
||||
db.hostInfo()
|
||||
db.printShardingStatus()
|
||||
db.shutdownServer()
|
||||
db.serverStatus()
|
||||
|
||||
db.setSlaveOk()
|
||||
db.getSlaveOk()
|
||||
|
||||
db.getProfilingLevel()
|
||||
db.getProfilingStatus()
|
||||
db.setProfilingLevel(1, 200) // 0 == OFF, 1 == ON with slowms, 2 == ON
|
||||
|
||||
db.enableFreeMonitoring()
|
||||
db.disableFreeMonitoring()
|
||||
db.getFreeMonitoringStatus()
|
||||
|
||||
db.createView("viewName", "sourceColl", [{$project:{department: 1}}])
|
||||
```
|
||||
|
||||
各种各样的
|
||||
---
|
||||
|
||||
### 改变流
|
||||
|
||||
```mongodb
|
||||
watchCursor = db.coll.watch([
|
||||
{
|
||||
$match : {"operationType": "insert" }
|
||||
}
|
||||
])
|
||||
|
||||
while (!watchCursor.isExhausted()){
|
||||
if (watchCursor.hasNext()){
|
||||
print(tojson(watchCursor.next()));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 分片集群
|
||||
<!--rehype:wrap-class=col-span-2 row-span-3-->
|
||||
|
||||
```mongodb
|
||||
sh.status()
|
||||
sh.addShard("rs1/mongodbd1.example.net:27017")
|
||||
sh.shardCollection("mydb.coll", {zipcode: 1})
|
||||
|
||||
sh.moveChunk("mydb.coll", { zipcode: "53187" }, "shard0019")
|
||||
sh.splitAt("mydb.coll", {x: 70})
|
||||
sh.splitFind("mydb.coll", {x: 70})
|
||||
sh.disableAutoSplit()
|
||||
sh.enableAutoSplit()
|
||||
|
||||
sh.startBalancer()
|
||||
sh.stopBalancer()
|
||||
sh.disableBalancing("mydb.coll")
|
||||
sh.enableBalancing("mydb.coll")
|
||||
sh.getBalancerState()
|
||||
sh.setBalancerState(true/false)
|
||||
sh.isBalancerRunning()
|
||||
|
||||
sh.addTagRange("mydb.coll", {state: "NY",zip: MinKey}, {state: "NY",zip: MaxKey}, "NY")
|
||||
sh.removeTagRange("mydb.coll", {state: "NY",zip: MinKey}, {state: "NY",zip: MaxKey}, "NY")
|
||||
sh.addShardTag("shard0000", "NYC")
|
||||
sh.removeShardTag("shard0000", "NYC")
|
||||
|
||||
sh.addShardToZone("shard0000", "JFK")
|
||||
sh.removeShardFromZone("shard0000", "NYC")
|
||||
sh.removeRangeFromZone("mydb.coll", {a: 1, b: 1}, {a: 10, b: 10})
|
||||
```
|
||||
|
||||
### 副本集
|
||||
|
||||
```mongodb
|
||||
rs.status()
|
||||
rs.initiate({"_id": "replicaTest",
|
||||
members: [
|
||||
{ _id: 0, host: "127.0.0.1:27017" },
|
||||
{ _id: 1, host: "127.0.0.1:27018" },
|
||||
{ _id: 2, host: "127.0.0.1:27019",
|
||||
arbiterOnly:true }]
|
||||
})
|
||||
rs.add("mongodbd1.example.net:27017")
|
||||
rs.addArb("mongodbd2.example.net:27017")
|
||||
rs.remove("mongodbd1.example.net:27017")
|
||||
rs.conf()
|
||||
rs.isMaster()
|
||||
rs.printReplicationInfo()
|
||||
rs.printSlaveReplicationInfo()
|
||||
rs.reconfig(<valid_conf>)
|
||||
rs.slaveOk()
|
||||
rs.stepDown(20, 5)
|
||||
// (stepDownSecs, secondaryCatchUpPeriodSecs)
|
||||
```
|
163
docs/pycharm.md
Normal file
163
docs/pycharm.md
Normal file
@ -0,0 +1,163 @@
|
||||
PyCharm 键盘快捷键备忘清单
|
||||
===
|
||||
|
||||
这个 [PyCharm](https://resources.jetbrains.com/storage/products/pycharm/docs/PyCharm_ReferenceCard.pdf) 快速参考备忘单显示了它的键盘快捷键和命令
|
||||
|
||||
快捷键
|
||||
---
|
||||
|
||||
### 创建和编辑
|
||||
<!--rehype:wrap-class=col-span-2 row-span-2-->
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`Alt` + `Enter` | 显示意图动作
|
||||
`Ctrl` + `Space` | 基本代码完成
|
||||
`Ctrl` + `Shift` + `Space` | 智能代码完成
|
||||
`Ctrl` + `Alt` + `Space` | 类型名称完成
|
||||
`Ctrl` + `Shift` + `Enter` | 完整声明
|
||||
`Ctrl` + `P` / `Alt` + `Q` | 参数信息/上下文信息
|
||||
`Ctrl` + `Shift` + `I` | 快速定义
|
||||
`Ctrl` + `Q` / `Shift` + `F1` | 快速/外部文档
|
||||
`Alt` + `Insert` | 生成代码
|
||||
`Ctrl` + `O` / `Ctrl` + `I` | 覆盖/实施成员
|
||||
`Ctrl` + `Alt` + `T` | 围绕着……
|
||||
`Ctrl` + `/` | 注释行注释
|
||||
`Ctrl` + `W` / `Ctrl` + `Shift` + `W` | 扩展/收缩选择
|
||||
`Ctrl` + `Alt` + `O` | 优化导入
|
||||
`Ctrl` + `Alt` + `I` | 自动缩进行
|
||||
`Ctrl` + `X` / `Ctrl` + `C` / `Ctrl` + `V` | 剪切/复制/粘贴
|
||||
`Ctrl` + `Shift` + `C` | 复制文档路径
|
||||
`Ctrl` + `Shift` + `V` | 从剪贴板历史粘贴
|
||||
`Ctrl` + `D` | 复制当前行或选择
|
||||
`Ctrl` + `Shift` + `Up` / `Down` | 向上/向下移动线
|
||||
`Ctrl` + `Y` | 删除插入符处的行
|
||||
`Ctrl` + `Shift` + `J` / `Ctrl` + `Enter` | 加入/分割线
|
||||
`Shift` + `Enter` | 开始新行
|
||||
`Ctrl` + `Shift` + `U` | 切换大小写
|
||||
`Ctrl` + `NumPad` `+` / `-` | 展开/折叠代码块
|
||||
`Ctrl` + `Shift` + `NumPad` `+` / `-` | 全部展开/折叠
|
||||
`Ctrl` + `S` | 保存全部
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 版本控制
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`Alt` + <code>`</code> | VCS 操作弹出...
|
||||
`Ctrl` + `K` | 提交
|
||||
`Ctrl` + `T` | 更新项目
|
||||
`Alt` + `Shift` + `C` | 近期变动
|
||||
`Ctrl` + `Alt` + `Z` | 恢复
|
||||
`Ctrl` + `Shift` + `K` | 推…
|
||||
`Ctrl` + `Alt` + `Shift` + `Down` / `Up` | 下一个/上一个更改
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 掌握您的 IDE
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`Ctrl`+`Shift`+`A` | 寻找行动...
|
||||
`Alt`+`[0-9]` | 打开一个工具窗口
|
||||
`Ctrl`+`Alt`+`Y` | 同步
|
||||
`Ctrl`+<code>`</code> | 快速切换方案...
|
||||
`Ctrl`+`Alt`+`S` | 设置...
|
||||
`F4` / `Alt`+`Home` | 跳转到源/导航栏
|
||||
`F12` | 跳转到最后一个工具窗口
|
||||
`Shift`+`Esc` / `Ctrl`+`Shift`+`F12` | 隐藏活动/所有工具窗口
|
||||
`Alt`+`Right` / `Alt`+`Left` | 转到下一个/上一个编辑器选项卡
|
||||
`Esc` | 转到编辑器(从工具窗口)
|
||||
`Ctrl`+`Shift`+`F4` / `Ctrl`+`F4` | 关闭活动标签/窗口
|
||||
<!--rehype:className=shortcuts left-align-->
|
||||
|
||||
### 找到一切
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`Shift` + `Shift` | 到处搜索
|
||||
`Ctrl` + `F` / `R` | 查找/替换
|
||||
`Ctrl` + `Shift` + `F` / `R` | 在路径中查找/在路径中替换
|
||||
`F3` / `Shift` + `F3` | 下/上一个事件
|
||||
`Ctrl` + `F3` | 在插入符处查找单词
|
||||
`Ctrl` + `N` / `Ctrl` + `Shift` + `N` | 去班级/档案
|
||||
`Ctrl` + `F12` | 转到文件成员
|
||||
`Ctrl` + `Alt` + `Shift` + `N` | 转到符号
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 从符号导航
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`Ctrl` + `B` | 声明
|
||||
`Ctrl` + `Shift` + `B` | 类型声明 _(仅限 JavaScript)_
|
||||
`Ctrl` + `U` | 超级方法
|
||||
`Ctrl` + `Alt` + `B` | 实施
|
||||
`Alt` + `F7` / `Ctrl` + `F7` | 查找用法/在文件中查找用法
|
||||
`Ctrl` + `Shift` + `F7` | 突出显示文件中的用法
|
||||
`Ctrl` + `Alt` + `F7` | 显示用法
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 重构和清理
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`Ctrl` + `Alt` + `Shift` + `T` | 重构这个……
|
||||
`F5` /`F6` | 复制…/移动…
|
||||
`Alt` + `Delete` | 安全删除…
|
||||
`Shift` + `F6` | 改名…
|
||||
`Ctrl` + `F6` | 更改签名…
|
||||
`Ctrl` + `Alt` + `N` | 排队…
|
||||
`Ctrl` + `Alt` + `M` | 提取方法
|
||||
`Ctrl` + `Alt` + `V` / `P` | 引入变量/参数
|
||||
`Ctrl` + `Alt` + `F` / `C` | 引入字段/常量
|
||||
`Ctrl` + `Alt` + `L` | 重新格式化代码
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 分析和探索
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`Ctrl` + `F1` | 显示错误描述
|
||||
`F2` / `Shift` + `F2` | 下一个/上一个突出显示的错误
|
||||
`Ctrl` + `Alt` + `Shift` + `I` | 按名称运行检查...
|
||||
`Ctrl` + `H` / `Ctrl` + `Alt` + `H` | 类型/调用层次结构
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 在上下文中导航
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`Alt`+`F1` | 选择...
|
||||
`Ctrl`+`E` / `Ctrl`+`Shift`+`E` | 最近查看/最近位置
|
||||
`Ctrl`+`Shift`+`Back` | 最后编辑位置
|
||||
`Ctrl`+`Alt`+`Left` / `Right` | 向后/向前导航
|
||||
`Alt`+`Up` / `Down` | 转到上一个/下一个方法
|
||||
`Ctrl`+`G` | 转到行/列...
|
||||
`Ctrl`+`]` / `[` | 转到代码块结束/开始
|
||||
`Alt`+`Shift`+`F` | 添加到收藏夹
|
||||
`F11` | 切换书签
|
||||
`Ctrl`+`F11` | 使用助记符切换书签
|
||||
`Ctrl`+`[0-9]` | 转到编号书签
|
||||
`Shift`+`F11` | 显示书签
|
||||
<!--rehype:className=shortcuts-->
|
||||
|
||||
### 构建、运行和调试
|
||||
|
||||
:-- | --
|
||||
:-- | --
|
||||
`Ctrl` + `Shift` + `F10` | 运行上下文配置
|
||||
`Alt` + `Shift` + `F10`/`F9` | 运行/调试所选配置
|
||||
`Shift` + `F10`/`F9` | 运行/调试当前配置
|
||||
`F8` / `F7` | 跨过/进入
|
||||
`Shift` + `F7` | 智能步入
|
||||
`Shift` + `F8` | 走出去
|
||||
`Alt` + `F9` / `Ctrl` + `Alt` + `F9` | 运行到光标/强制运行到光标
|
||||
`Alt` + `F10` | 显示执行点
|
||||
`Alt` + `F8` | 评估表达...
|
||||
`Ctrl` + `F2` | 停止
|
||||
`Ctrl` + `Shift` + `F2` | 停止后台进程...
|
||||
`F9` | 恢复程序
|
||||
`Ctrl` + `F8` | 切换行断点
|
||||
`Ctrl` + `Alt` + `Shift` + `F8` | 切换临时行断点
|
||||
`Ctrl` + `Shift` + `F8` | 编辑/查看断点
|
||||
<!--rehype:className=shortcuts-->
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@wcj/reference",
|
||||
"version": "1.33.0",
|
||||
"version": "1.34.0",
|
||||
"description": "为开发人员分享快速参考备忘单(主要是方便自己)。",
|
||||
"author": "jaywcjlove",
|
||||
"license": "MIT",
|
||||
|
Reference in New Issue
Block a user