diff --git a/docs/awk.html b/docs/awk.html index 972d518d..2fb0040c 100644 --- a/docs/awk.html +++ b/docs/awk.html @@ -40,7 +40,7 @@
这是 GNU awk 的单页快速参考备忘单,其中涵盖了常用的 awk
表达式和命令。
该程序可用于选择文件中的特定记录并对其执行操作
$ awk -F: '{print $1, $NF}' /etc/passwd
@@ -94,14 +94,14 @@
...
END {< 最后的动作 >}
-awk '
BEGIN { print "\n>>>Start" }
!/(login|shutdown)/ { print NR, $0 }
END { print "<<<END\n" }
' /etc/passwd
- $1 $2/$(NF-1) $3/$NF
▼ ▼ ▼
@@ -124,7 +124,7 @@
awk -F: '{print $1 "=" $6}' /etc/passwd
查看: Awk 变量
-awk 'BEGIN {print "hello world"}' # 打印 "hello world"
awk -F: '{print $1}' /etc/passwd # -F: 指定字段分隔符
@@ -214,7 +214,8 @@
:- :- $0
全线 $1, $2...$NF
第一个,第二个……最后一个字段 NR
记录总数(N
umber of R
ecords) NF
N个字段(N
number of F
ields) OFS
O
utput F
ield S
eparator
输出字段分隔符 (default " ")FS
input F
ield S
eparator
输入字段分隔符 (default " ") ORS
O
utput R
ecord S
eparator
输出记录分隔符 (default "\n")RS
input R
ecord S
eparator
输入记录分隔符 (default "\n") FILENAME
文件名
-
:- | :- |
---|---|
$1 == "root" | 第一个字段等于根 |
{print $(NF-1)} | 倒数第二个字段 |
NR!=1{print $0} | 从第 2 条记录开始 |
NR > 3 | 从第 4 条记录开始 |
NR == 1 | 第一次记录 |
END{print NR} | 总记录 |
BEGIN{print OFMT} | 输出格式 |
{print NR, $0} | 行号 |
{print NR " " $0} | 行号(选项卡) |
{$1 = NR; print} | 用行号替换第一个字段 |
$NF > 4 | 最后一个字段 > 4 |
NR % 2 == 0 | 甚至记录 |
NR==10, NR==20 | 记录 10 到 20 |
BEGIN{print ARGC} | 总 arguments |
ORS=NR%5?",":"\n" | 连接记录 |
打印总和和平均值
awk -F: '{sum += $3}
END { print sum, sum/NR }
@@ -310,6 +312,37 @@
if (match("One Two Three", "re"))
print RLENGTH }'
+:- | :- |
---|---|
ENVIRON | 环境变量 |
IGNORECASE | 忽略大小写 |
CONVFMT | 转换格式 |
ERRNO | 系统错误 |
FIELDWIDTHS | 固定宽度字段 |
:- | :- |
---|---|
ARGC | 数字或参数 |
ARGV | 参数数组 |
FNR | 文件记录数(F ile N umber of R ecords) |
OFMT | 数字格式 (default "%.6g") |
RSTART | 字符串中的位置 |
RLENGTH | 比赛时长 |
SUBSEP | 多维数组分隔符 (default "\034") |
ARGIND | 参数索引 |
:- | :- |
---|---|
ENVIRON | 环境变量 |
IGNORECASE | 忽略大小写 |
CONVFMT | 转换格式 |
ERRNO | 系统错误 |
FIELDWIDTHS | 固定宽度字段 |
awk -v var1="Hello" -v var2="Wold" '
END {print var1, var2}
' </dev/null
-awk -v varName="$PWD" '
END {print varName}' </dev/null
-:- | :- |
---|---|
{print $1} | 第一个字段 |
$2 == "foo" | 等于 |
$2 != "foo" | 不等于 |
"foo" in array | 在数组中 |
:- | :- |
---|---|
/regex/ | 行匹配 |
!/regex/ | 行不匹配 |
$1 ~ /regex/ | 字段匹配 |
$1 !~ /regex/ | 字段不匹配 |
:- | :- |
---|---|
($2 <= 4 || $3 < 20) | 或者 |
($1 == 4 && $3 < 20) | 和 |
+
-
--
+=
-=
%=
==
!=
>=
awk 'BEGIN {
if ("foo" ~ "^fo+$")
print "Fooey!";
}'
-awk 'BEGIN {
if ("boo" !~ "^fo+$")
print "Boo!";
}'
-awk 'BEGIN {
assoc["foo"] = "bar";
assoc["bar"] = "baz";
@@ -518,7 +520,7 @@
print "Fooey!";
}'
-awk -v count=2 'BEGIN {
print (count==1) ? "Yes" : "Huh?";
}'
-awk 'BEGIN {
assoc["foo"] = "bar";
assoc["bar"] = "baz";
@@ -691,7 +693,7 @@
print "Fooey!";
}'
-awk 'BEGIN {
assoc["foo"] = "bar";
assoc["bar"] = "baz";
@@ -699,7 +701,7 @@
print "Huh!";
}'
-awk -F: '{
switch (NR * 2 + 1) {
case 3:
@@ -722,13 +724,13 @@
print "i=" i;
}'
-awk 'BEGIN {
for (i = 1; i <= 100; i *= 2)
print i
}'
-awk 'BEGIN {
assoc["key1"] = "val1"
assoc["key2"] = "val2"
@@ -736,15 +738,15 @@
print assoc[key];
}'
-awk 'BEGIN {
for (argnum in ARGV)
print ARGV[argnum];
}' a b c
-awk -F: '{ x[NR] = $0 }
END {
for (i = NR; i > 0; i--)
@@ -752,14 +754,14 @@
}
' /etc/passwd
-awk -F: '{
for (i = NF; i > 0; i--)
printf("%s ",$i);
print ""
}' /etc/passwd
-awk -F: '{
s=0;
for (i = 1; i <= NF; i++)
@@ -767,7 +769,7 @@
print s
}' /etc/passwd
-awk -F: '
{for (i = 1; i <= NF; i++)
s += $i;
@@ -775,7 +777,7 @@
END{print s}
' /etc/passwd
-awk 'BEGIN {
while (a < 10) {
@@ -784,7 +786,7 @@
}
}'
-awk '{
i = 1
do {
@@ -793,7 +795,7 @@
} while (i <= 5)
}' /etc/passwd
-awk 'BEGIN {
break_num = 5
for (i = 0; i < 10; i++) {
@@ -815,15 +817,15 @@
awk 'BEGIN{printf "|%10s|\n", "hello"}'
# | hello|
-awk 'BEGIN{printf "|%-10s|\n", "hello"}'
# |hello |
-代码 | 描述 |
---|---|
${FOO%suffix} | 删除后缀 |
${FOO#prefix} | 删除前缀 |
${FOO%%suffix} | 去掉长后缀 |
${FOO##prefix} | 删除长前缀 |
${FOO/from/to} | 替换第一个匹配项 |
${FOO//from/to} | 全部替换 |
${FOO/%from/to} | 替换后缀 |
${FOO/#from/to} | 替换前缀 |
表示 | 描述 |
---|---|
${FOO:0:3} | 子串 (位置,长度) |
${FOO:(-3):3} | 从右边开始的子串 |
表示 | 描述 |
---|---|
${#FOO} | $FOO 的长度 |
表示 | 描述 |
---|---|
${FOO:-val} | $FOO ,如果未设置,则为 val |
${FOO:=val} | 如果未设置,则将 $FOO 设置为 val |
${FOO:+val} | val 如果设置了$FOO |
${FOO:?message} | 如果 $FOO 未设置,则显示消息并退出 |
echo ${food:-Cake} #=> $food or "Cake"
STR="/path/to/foo.cpp"
@@ -397,12 +397,12 @@
echo $e
done
-for i in "${!Fruits[@]}"; do
printf "%s\t%s\n" "$i" "${Fruits[$i]}"
done
-Fruits=("${Fruits[@]}" "Watermelon") # 推
Fruits+=('Watermelon') # 也推
@@ -545,7 +545,7 @@
条件 描述 [[ -z STR ]]
空字符串 [[ -n STR ]]
非 空字符串[[ STR == STR ]]
平等的 [[ STR = STR ]]
相等(同上) [[ STR < STR ]]
小于 (ASCII) [[ STR > STR ]]
大于 (ASCII) [[ STR != STR ]]
不相等 [[ STR =~ STR ]]
正则表达式
if [[ -z "$string" ]]; then
echo "String is empty"
elif [[ -n "$string" ]]; then
@@ -554,32 +554,32 @@
echo "This never happens"
fi
-if [[ X && Y ]]; then
...
fi
-if [[ "$A" == "$B" ]]; then
...
fi
-if [[ '1. abc' =~ ([a-z]+) ]]; then
echo ${BASH_REMATCH[1]}
fi
-if (( $a < $b )); then
echo "$a is smaller than $b"
fi
-if [[ -e "file.txt" ]]; then
echo "file exists"
fi
-for i in {5..50..5}; do
echo "Welcome $i"
done
-i=1
while [[ $i -lt 4 ]]; do
echo "Number: $i"
diff --git a/docs/c.html b/docs/c.html
index cde324e9..040da292 100644
--- a/docs/c.html
+++ b/docs/c.html
@@ -978,7 +978,7 @@
宏 描述 __DATE__
当前日期,一个以 "MMM DD YYYY" 格式表示的字符常量 __TIME__
当前时间,一个以 "HH:MM:SS" 格式表示的字符常量 __FILE__
这会包含当前文件名,一个字符串常量 __LINE__
这会包含当前行号,一个十进制常量 __STDC__
当编译器以 ANSI
标准编译时,则定义为 1
ANSI C
定义了许多宏,您可以使用这些宏,但是不能直接修改这些预定义的宏
-
#include <stdio.h>
int main() {
@@ -989,7 +989,7 @@
printf("ANSI :%d\n", __STDC__);
}
-一个宏通常写在一个单行上。
#define message_for(a, b) \
printf(#a " 和 " #b ": 我们爱你!\n")
diff --git a/docs/chmod.html b/docs/chmod.html
index c05a0757..6e432584 100644
--- a/docs/chmod.html
+++ b/docs/chmod.html
@@ -42,17 +42,17 @@
$ chmod [options] <permissions> <file>
-$ chmod 755 foo.txt
$ chmod +x quickref.py
$ chmod u-x quickref.py
$ chmod u=rwx,g=rx,o= quickref.sh
-$ chmod -R 755 my_directory
chmod
命令代表“更改模式”
-权限:@@ -152,7 +152,7 @@ -rw-r--r-- 1 root root 3 Jun 29 15:35 a.log drwxr-xr-x 2 root root 2 Jun 30 18:06 dir
dir
的权限分析dir
的权限分析d rwx r-x r-x
┬ ─┬─ ─┬─ ─┬─
┆ ┆ ┆ ┆
@@ -161,7 +161,7 @@
┆ ╰─────────── 2. User |7 (4+2+1)
╰─────────────── 1. File Type | directory
-CSS 功能丰富,不仅仅是布局页面
-<link
href="./path/to/stylesheet/style.css"
rel="stylesheet"
@@ -53,14 +53,14 @@
>
-<style>
body {
background-color: linen;
}
</style>
-<h2 style="text-align: center;">
居中文本
</h2>
@@ -69,7 +69,7 @@
</p>
-<div class="classname"></div>
<div class="class1 ... classn"></div>
@@ -164,34 +164,34 @@
h1, h2 {
color: red;
}
-h3.section-heading {
color: blue;
}
-div[attribute="SomeValue"] {
background-color: red;
}
-p:first-child {
font-weight: bold;
}
-.box:empty {
background: lime;
height: 80px;
width: 80px;
}
-.item {
grid-row: 1 / span 2;
}
-#grid-container {
display: block;
}
@@ -1212,11 +1212,11 @@
grid-row-start: auto|row-line;
grid-row-end: auto|row-line|span n;
-
grid-row-start: 2;
grid-row-end: span 2;
-#container {
display: grid;
justify-items: center;
diff --git a/docs/curl.html b/docs/curl.html
index 13085528..0a2a8d0a 100644
--- a/docs/curl.html
+++ b/docs/curl.html
@@ -98,10 +98,10 @@
--cert-type # der/pem/eng
-k, --insecure # 对于自签名证书
-apk add --update curl # alpine linux 中安装
-$ docker create --name my_redis --expose 6379 redis:3.0.2
-重命名容器
docker rename my-nginx nginx-server
diff --git a/docs/electron.html b/docs/electron.html
index ae9fb381..cb299e05 100644
--- a/docs/electron.html
+++ b/docs/electron.html
@@ -47,7 +47,7 @@
Electron 是一个使用 JavaScript、HTML 和 CSS 构建桌面应用程序的框架
-mkdir my-app && cd my-app
@@ -114,7 +114,7 @@
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
diff --git a/docs/emmet.html b/docs/emmet.html
index 26e430a7..16532423 100644
--- a/docs/emmet.html
+++ b/docs/emmet.html
@@ -2939,13 +2939,13 @@ Alias of command
:- :- !
!important
-
@font-face {
font-family:;
src:url(|);
}
-@font-face {
font-family: 'FontName';
src: url('FileName.eot');
@@ -2957,10 +2957,10 @@ Alias of command
font-weight: normal;
}
-@import url();
-@-webkit-keyframes identifier {
from { }
to { }
@@ -2978,12 +2978,12 @@ Alias of command
to { }
}
-@media screen {
}
-function fn () {
let x = 0
if (true) {
@@ -51,17 +51,17 @@
}
}
-const message = `Hello ${name}`
-let bin = 0b1010010
let oct = 0o755
@@ -79,7 +79,7 @@
// 同: Math.pow(2, 8)
"hello".repeat(3)
"hello".includes("ll")
"hello".startsWith("he")
@@ -88,42 +88,42 @@
"hello".padEnd(8, '!') // hello!!!
"\u1E9B\u0323".normalize("NFC")
-Number.EPSILON
Number.isInteger(Infinity) // false
Number.isNaN("NaN") // false
-Math.acosh(3) // 1.762747174039086
Math.hypot(3, 4) // 5
Math.imul(Math.pow(2, 32) - 1, Math.pow(2, 32) - 2) // 2
-// 返回一个真实的数组
Array.from(document.querySelectorAll("*"))
// 类似于 new Array(...),但没有特殊的单参数行为
Array.of(1, 2, 3)
请参阅: 新方法
-class Circle extends Shape {
- constructor (radius) {
this.radius = radius
}
- getArea () {
return Math.PI * 2 * this.radius
}
- expand (n) {
return super.expand(n) * Math.PI
}
- static createFromDiameter(diameter) {
return new Circle(diameter / 2)
}
@@ -131,7 +131,7 @@
原型的语法糖。 请参阅: 类
-new Promise((resolve, reject) => {
if (ok) { resolve(result) }
@@ -171,10 +171,10 @@
请参阅:异步函数
const [first, last] = ['Nikola', 'Tesla']
-let {title, author} = {
title: 'The Silkworm',
author: 'R. Galbraith'
@@ -182,7 +182,7 @@
支持匹配数组和对象。 请参阅:解构
-const scores = [22, 33]
const [math = 50, sci = 50, arts = 50] = scores
@@ -230,67 +230,67 @@
使用 rest(...)
运算符单独提取一些键和对象中的剩余键
const options = {
...defaults,
visible: true
}
-const options = Object.assign(
{}, defaults,
{ visible: true })
对象扩展运算符允许您从其他对象构建新对象。 请参阅:对象传播
-const users = [
...admins,
...editors,
'rstacruz'
]
-const users = admins
.concat(editors)
.concat([ 'rstacruz' ])
扩展运算符允许您以相同的方式构建新数组。 请参阅:扩展运算符
-function greet (name = 'Jerry') {
return `Hello ${name}`
}
-function fn(x, ...y) {
// y 是一个数组
return x * y.length
}
-setTimeout(() => {
···
})
-readFile('text.txt', (err, data) => {
...
})
-arr.map(n => n*2)
// 没有花括号 = 隐式返回
// 同: arr.map(function (n) { return n*2 })
@@ -301,7 +301,7 @@
类似函数,但保留了 this
。
请参阅:箭头函数
function log(x, y = 'World') {
console.log(x, y);
}
diff --git a/docs/expressjs.html b/docs/expressjs.html
index 55c0d3c8..075464bd 100644
--- a/docs/expressjs.html
+++ b/docs/expressjs.html
@@ -167,7 +167,7 @@
console.dir(app.locals.email)
// => 'me@myapp.com'
-:- | :- |
---|---|
mount | 子应用挂载到父应用上,子应用上触发事件 # |
app.get('/', function (req, res) {
console.dir(res.headersSent) // false
res.send('OK')
console.dir(res.headersSent) // true
})
-:- | :- |
---|---|
res.append() | # |
res.attachment() | # |
res.cookie() | # |
res.clearCookie() | # |
res.download() | 提示要下载的文件 # |
res.end() | 结束响应过程 # |
res.format() | # |
res.get() | # |
res.json() | 发送 JSON 响应 # |
res.jsonp() | 发送带有 JSONP 支持的响应 # |
res.links() | # |
res.location() | # |
res.redirect() | 重定向请求 # |
res.render() | 渲染视图模板 # |
res.send() | 发送各种类型的响应 # |
res.sendFile() | 将文件作为八位字节流发送 # |
res.sendStatus() | # |
res.set() | # |
res.status() | # |
res.type() | # |
res.vary() | # |
为传递给此路由器的任何请求调用
diff --git a/docs/find.html b/docs/find.html index 96d2b3b2..752c93eb 100644 --- a/docs/find.html +++ b/docs/find.html @@ -290,7 +290,7 @@Option | Description |
---|---|
atime | 访问时间(上次文件 |
mtime | 修改时间(上次文件 |
ctime | 更改时间(上次文件 |
Option | Description |
---|---|
-mtime +0 | 24 小时前修改 |
-mtime 0 | 从现在到 1 天前修改 |
-mtime -1 | 不到 1 天前修改(与 -mtime 0 相同) |
-mtime 1 | 24 至 48 小时前修改 |
-mtime +1 | 超过 48 小时前修改 |
-mtime +1w | 上次修改时间超过 1 周前 |
-atime 0 | 从现在到 24 小时前最后一次访问 |
-atime +0 | 访问时间超过 24 小时 |
-atime 1 | 在 24 至 48 小时前访问 |
-atime +1 | 访问时间超过 48 小时 |
-atime -1 | 不到 24 小时前访问过(与 -atime 0 相同) |
-ctime -6h30m | 文件状态在过去 6 小时 30 分钟内发生变化 |
查找最近 50 天修改的文件
$ find / -mtime 50
diff --git a/docs/github-actions.html b/docs/github-actions.html
index 46cac18d..975bd7e5 100644
--- a/docs/github-actions.html
+++ b/docs/github-actions.html
@@ -232,14 +232,14 @@
name: production_environment
url: https://github.com
-GitHub
会保留 GITHUB_
环境变量前缀供 GitHub
内部使用。设置有 GITHUB_
前缀的环境变量或密码将导致错误。
- name: 测试 nodejs 获取环境变量
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
在 https://github.com/<用户名>/<项目名称>/settings/secrets
中添加 secrets
API_TOKEN
,在工作流中设置环境变量 API_TOKEN
在 if
条件下使用表达式时,可以省略表达式语法 (${{ }}
),因为 GitHub 会自动将 if
条件作为表达式求值
steps:
- uses: actions/hello-world-action@v1.1
@@ -250,7 +250,7 @@
env:
MY_ENV_VAR: ${{ <expression> }}
-
( )
(逻辑分组)[ ]
(指数)||
(或者)使用 working-directory
关键字,您可以指定运行命令的工作目录(./temp
)
jobs:
job1:
runs-on: ubuntu-latest
@@ -823,7 +823,7 @@
working-directory: scripts
作业中的所有 run
步骤提供默认的 shell
和 working-directory
使用 bash
运行脚本
steps:
- name: Display the path
diff --git a/docs/golang.html b/docs/golang.html
index fb00cbfc..0841d1fc 100644
--- a/docs/golang.html
+++ b/docs/golang.html
@@ -107,18 +107,18 @@
var u uint = 7 // uint (unsigned)
var p float32 = 22.7 // 32-bit float
-isTrue := true
isFalse := false
-fmt.Println(true && true) // true
fmt.Println(true && false) // false
fmt.Println(true || true) // true
@@ -126,7 +126,7 @@
fmt.Println(!true) // false
参见:更多操作符
-┌────┬────┬────┬────┬─────┬─────┐
| 2 | 3 | 5 | 7 | 11 | 13 |
@@ -148,7 +148,7 @@
fmt.Println(a[0], a[1]) //=> Hello World
fmt.Println(a) // => [Hello World]
-var twoDimension [2][3]int
for i := 0; i < 2; i++ {
for j := 0; j < 3; j++ {
@@ -158,7 +158,7 @@
// => 2d: [[0 1 2] [1 2 3]]
fmt.Println("2d: ", twoDimension)
-func main () {
b := *getPointer()
fmt.Println("Value is", b)
@@ -200,13 +200,13 @@
// 将等于字符Z
s := string(i)
-i := 90
// 需要导入“strconv”
s := strconv.Itoa(i)
fmt.Println(s) // Outputs: 90
-package main
import (
@@ -545,14 +545,14 @@
import "fmt"
import "math/rand"
-
import r "math/rand"
diff --git a/docs/html.html b/docs/html.html
index fbde61cf..7780c2c9 100644
--- a/docs/html.html
+++ b/docs/html.html
@@ -221,36 +221,36 @@
</iframe>
-请参阅:内联框架元素
-<script type="text/javascript">
let text = "Hello 快速参考";
alert(text);
</script>
-<body>
...
<script src="app.js"></script>
</body>
-<style type="text/css">
h1 {
color: purple;
}
</style>
-<head>
...
<link rel="stylesheet" href="style.css"/>
</head>
-<body>
<header>
@@ -422,12 +422,12 @@
</video>
-<audio
controls
src="https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3">
@@ -435,11 +435,11 @@
</audio>
-<ruby>
汉 <rp>(</rp><rt>hàn</rt><rp>)</rp>
字 <rp>(</rp><rt>zì</rt><rp>)</rp>
@@ -448,7 +448,7 @@
</ruby>
-<ul>
<li>User <bdi>hrefs</bdi>: 60 points</li>
<li>User <bdi>jdoe</bdi>: 80 points</li>
<li>User <bdi>إيان</bdi>: 90 points</li>
</ul>
-<progress value="50" max="100"></progress>
@@ -649,7 +649,7 @@
<label for="ck">记住我</label>
</form>
-HTML <form>
元素用于收集信息并将其发送到外部源。
<label for="Name">Name:</label>
<input type="text" name="Name" id="">
-请参阅:HTML输入标记
-<textarea rows="2" cols="30" name="address" id="address"></textarea>
-Textarea 是一个多行文本输入控件
-<input type="radio" name="gender" id="m">
<label for="m">Male</label>
<input type="radio" name="gender" id="f">
<label for="f">Female</label>
-单选按钮用于让用户只选择一个
-<input type="checkbox" name="s" id="soc">
<label for="soc">Soccer</label>
<input type="checkbox" name="s" id="bas">
<label for="bas">Baseball</label>
-复选框允许用户选择一个或多个
-<label for="city">City:</label>
<select name="city" id="city">
<option value="1">Sydney</option>
@@ -765,7 +765,7 @@
<option value="3">Cromwell</option>
</select>
-选择框是选项的下拉列表
-<fieldset>
<legend>Your favorite monster</legend>
<input type="radio" id="kra" name="m">
@@ -784,7 +784,7 @@
<label for="sas">Sasquatch</label>
</fieldset>
-<label for="b">Choose a browser: </label>
<input list="list" id="b" name="browser"/>
<datalist id="list">
@@ -806,7 +806,7 @@
<option value="Microsoft Edge">
</datalist>
-<form action="register.php" method="post">
<label for="foo">Name:</label>
<input type="text" name="name" id="foo">
@@ -827,7 +827,7 @@
<input type="reset" value="重置">
</form>
-将数据提交到服务器
重置为默认值
type="checkbox" | |
type="radio" | |
type="file" | |
type="hidden" | |
type="text" | |
type="password" | |
type="image" | |
type="reset" | |
type="button" | |
type="submit" |
type="color" | |
type="date" | |
type="time" | |
type="month" | |
type="datetime-local" | |
type="week" | |
type="email" | |
type="tel" | |
type="url" | |
type="number" | |
type="search" | |
type="range" |
$ htop [-dChustv]
-$ apt install htop # Debian
$ dnf install htop # Fedora
$ emerge sys-process/htop # Gentoo
@@ -57,7 +57,7 @@
$ Compile htop # GoboLinux
htop 的软件包在大多数发行版中都可用下载
-长选项的强制参数对于短选项也是强制的
diff --git a/docs/javascript.html b/docs/javascript.html index ecb1f3e0..c63ef21d 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -172,7 +172,7 @@ // 无穷 Number.POSITIVE_INFINITY -const pi = Math.PI; // 3.141592653589793
Math.round(4.4); // = 4 - 数字四舍五入
Math.round(4.5); // = 5
@@ -199,7 +199,7 @@
// 随机整数,从 1
Math.floor(Math.random() * 5) + 1;
-// 像脚本代码一样执行字符串
eval();
@@ -234,13 +234,13 @@
false || false; // false
10 > 100 || 10 > 20; // false
-true && true; // true
1 > 2 && 2 > 1; // false
true && false; // false
4 === 4 && 3 > 1; // true
-1 > 3 // false
3 > 1 // true
250 >= 250 // true
@@ -248,20 +248,20 @@
1 === 2 // false
1 === '1' // false
-let lateToWork = true;
let oppositeValue = !lateToWork;
// => false
console.log(oppositeValue);
-null ?? 'I win'; // 'I win'
undefined ?? 'Me too'; // 'Me too'
false ?? 'I lose' // false
0 ?? 'I lose again' // 0
'' ?? 'Damn it' // ''
-const isMailSent = true;
if (isMailSent) {
console.log('Mail sent to recipient');
@@ -340,31 +340,31 @@
const sum = (param1, param2) => {
return param1 + param2;
};
console.log(sum(2,5)); // => 7
-const printHello = () => {
console.log('hello');
};
printHello(); // => hello
-const checkWeight = weight => {
console.log(`Weight : ${weight}`);
};
checkWeight(25); // => Weight : 25
-const multiply = (a, b) => a * b;
// => 60
console.log(multiply(2, 30));
从 ES2015 开始提供箭头函数
-// 有 return
function sum(num1, num2) {
return num1 + num2;
@@ -1101,7 +1101,7 @@
// 调用静态方法
Dog.bark();
-class ClassStaticField {
static staticField = 'static field'
}
@@ -1109,7 +1109,7 @@
console.log(ClassStaticField.staticField)
// 预期输出值:"static field"
-class Song {
constructor() {
this.title;
@@ -1189,7 +1189,7 @@
multiply, duplicate
}
-// main.js
import add, { subtract, multiply, duplicate } from './myMath.js';
console.log(add(6, 2)); // 8
@@ -1199,7 +1199,7 @@
// index.html
<script type="module" src="main.js"></script>
-// myMath.js
function add(x,y){
return x + y
@@ -1221,7 +1221,7 @@
duplicate
}
-// main.js
const myMath = require('./myMath.js')
console.log(myMath.add(6, 2)); // 8
@@ -1229,7 +1229,7 @@
console.log(myMath.multiply(6, 2)); // 12
console.log(myMath.duplicate(5)) // 10
-创建 promises
@@ -1241,18 +1241,18 @@ } }) -promise
.then((result) => { ··· })
.catch((error) => { ··· })
-Promise.all(···)
Promise.race(···)
Promise.reject(···)
Promise.resolve(···)
-const executorFn = (resolve, reject) => {
resolve('Resolved!');
};
diff --git a/docs/jest.html b/docs/jest.html
index 3eabf9d5..4ca8886e 100644
--- a/docs/jest.html
+++ b/docs/jest.html
@@ -337,7 +337,7 @@
// fn.mock.calls[0][0] — 第一次调用的第一个参数
expect(fn.mock.calls[0][0]).toBe(2)
-toBeCalled
→ toHaveBeenCalled
toBeCalledWith
→ toHaveBeenCalledWith
lastReturnedWith
→ toHaveLastReturnedWith
nthReturnedWith
→ toHaveNthReturnedWith
// 检查对象是否是类的实例。
expect(new A()).toBeInstanceOf(A)
@@ -422,11 +422,11 @@
// 测试函数在调用时是否抛出与最新快照匹配的错误。
expect(fn).toThrowErrorMatchingSnapshot()
-toThrowError
→ toThrow
在异步测试中指定一些预期的断言是一个很好的做法,所以如果你的断言根本没有被调用,测试将会失败。
diff --git a/docs/json.html b/docs/json.html index 9edc4585..12be6ce3 100644 --- a/docs/json.html +++ b/docs/json.html @@ -152,18 +152,18 @@\" | 双引号 Double quote |
\\ | 反斜杠 Backslash |
\/ | 正斜杠 Forward slash |
\b | 退格 Backspace |
\f | 换页 Form feed |
\n | 换行 Newline |
\r | 回车 Carriage return |
\t | 标签 Tab |
\u | 后跟四个十六进制数字 |
{
"url": "https://quickref.me",
"msg" : "Hi,\n\"QuickRef.ME\"",
"intro": "Share quick reference and cheat sheet for developers."
}
-{ "foo": 'bar' }
Have to be delimited by double quotes
-类型 | 说明 |
---|---|
Integer | 数字 1-9、0 和正数或负数 |
Fraction | 0.3、3.9 等分数 |
Exponent | 指数,如 e、e+、e-、E、E+、E |
{
"positive" : 12,
"negative" : -1,
@@ -197,11 +197,11 @@
"zero" : 0
}
-{ "foo": 0xFF }
在JSON中,只能使用十进制文字
-{
"color": "Purple",
"id": "210",
diff --git a/docs/lerna.html b/docs/lerna.html
index a474fbca..6d823220 100644
--- a/docs/lerna.html
+++ b/docs/lerna.html
@@ -271,7 +271,7 @@
:- :- --canary
#使用此标志运行时,以更精细的方式(每次提交)发布包 --contents <dir>
#要发布的子目录。 必须适用于所有包,并且必须包含 package.json
文件 --dist-tag <tag>
#使用此标志运行时,将使用给定的 npm dist-tag
(默认为 latest
)发布到 npm
--git-head <sha>
#打包 tarball
时将显式 SHA
设置为清单上的 gitHead
,仅允许使用 from-package
位置 --graph-type <all|dependencies>
#设置在构建包图时使用哪种依赖项。默认值是依赖项,即仅包含包的 package.json
的依赖项部分中列出的包 --ignore-scripts
#传递时,此标志将在 lerna
发布期间禁用运行生命周期脚本 --ignore-prepublish
#传递时,此标志将禁用在 lerna
发布期间运行已弃用的预发布脚本 --legacy-auth
#发布需要身份验证的包时,您正在使用仅使用旧版 Base64
用户名:密码
的内部托管 NPM 注册表。这与 NPM 发布 _auth
标志相同 --no-git-reset
#默认情况下,lerna publish
确保对工作树的任何更改都已重置 --no-granular-pathspec
#默认情况下,lerna publish
将尝试(如果启用)git checkout
仅在发布过程中临时修改的叶包清单 --verify-access
#从历史上看,lerna
试图通过使用给定令牌执行一些抢占式 npm API
请求来快速解决授权/身份验证问题 --otp
#发布需要双重身份验证的包时,您可以使用 --otp
指定一次性密码 --preid
#与同名的 lerna
版本选项不同,该选项只适用于 --canary
版本计算 --pre-dist-tag <tag>
#与 --dist-tag
的工作方式相同,但仅适用于使用预发布版本发布的软件包 --registry <url>
#使用此标志运行时,转发的 npm
命令将为您的包使用指定的注册表 --tag-version-prefix
#此选项允许提供自定义前缀而不是默认前缀:v
--temp-tag
#传递时,此标志将更改默认发布过程,首先将所有更改的包发布到临时 dist-tag(lerna-temp)
,然后将新版本移动到 --dist-tag
配置的 dist-tag
(默认latest
) --yes
#使用此标志运行时,lerna publish
将跳过所有确认提示
-
:- | :- |
---|---|
--no-verify-access # | 旧的抢先访问验证现在默认关闭,因此不需要 --no-verify-access |
--skip-npm # | 直接调用 lerna version |
$ lerna version 1.0.1 # 明确的
$ lerna version patch # semver 关键字
@@ -470,7 +470,7 @@
:- :- --allow-branch <glob>
#与启用 lerna version
的 git
分支匹配的 glob
白名单 --amend
#使用此标志运行时,lerna version
将在当前提交上执行所有更改,而不是添加新的 --changelog-preset
#默认情况下,更改日志预设设置为 angular --conventional-commits
#使用常规提交规范来确定版本 bump 并生成 CHANGELOG.md 文件 --conventional-graduate
#将使用 *
对指定的包(逗号分隔)或所有包进行分级 --conventional-prerelease
#预发布版本发布指定的包 --create-release <type>
#根据更改的包创建正式的 GitHub
或 GitLab
版本 --exact
#在更新的包中精确指定更新的依赖项(没有标点符号),而不是与 semver 兼容(使用^
) --force-publish
#强制发布指定的包 --git-remote <name>
#把 git
更改推送到指定的远程位置,而不是origin
--ignore-changes
#检测更改的包时忽略与 glob
匹配的文件中的更改 --ignore-scripts
#禁用在 lerna version
期间运行的生命周期脚本 --include-merged-tags
#在检测到更改的包时包括来自合并分支的标签 --message <msg>
#此选项别名为 -m
以与 git commit
进行奇偶校验 --no-changelog
#使用常规提交时,不要生成任何 CHANGELOG.md 文件 --no-commit-hooks
#允许 git commit hooks
在提交版本更改时运行。通过 --no-commit-hooks
禁用此行为 --no-git-tag-version
#将提交对 package.json
文件的更改并标记发布。通过 --no-git-tag-version
禁用该行为 --no-granular-pathspec
#仅添加在版本控制过程中更改的叶包清单(可能还有变更日志)。这产生了 git add --packages/*/package.json
的等价物,但针对更改的内容量身定制 --no-private
#在选择版本、提交和标记版本时包含私有包。通过 --no-private
禁用此行为 --no-push
#将已提交和标记的更改推送到配置的 git remote
。通过 --no-push
禁用此行为 --preid
#使用此标志运行时,lerna 版本将使用指定的预发布标识符增加 premajor
、preminor
、prepatch
或 prerelease
semver bumps --sign-git-commit
#此选项类似于同名的 npm 版本选项 --sign-git-tag
#此选项类似于同名的 npm
版本选项 --force-git-tag
#此选项替换任何现有标记而不是失败 --tag-version-prefix
#此选项允许提供自定义前缀而不是默认前缀:v
--yes
#使用此标志运行时,lerna
版本将跳过所有确认提示
-
将本地包链接
在一起,并安装
其余的包依赖项
$ lerna bootstrap -- --production \
--no-optional
@@ -527,7 +527,7 @@
:- :- --hoist [glob]
#在 repo
根目录安装与 glob
匹配的外部依赖项,以便它们可用于所有包 --strict
#与提升 (hoist) 一起使用时,会在发出版本警告后抛出错误并停止引导 --nohoist [glob]
#不要在 repo
根目录安装与 glob
匹配的外部依赖项。这可用于选择不提升某些依赖项 --ignore
#当与 bootstrap
命令一起使用时,还可以在 lerna
中设置 --ignore
标志
-
:- | :- |
---|---|
--ignore-prepublish # | 跳过默认在引导程序包中运行的预发布生命周期脚本 |
--ignore-scripts # | 跳过通常在引导程序包中运行(准备等)的任何生命周期脚本 |
--registry <url> # | 指定 npm 包的仓库地址 |
--npm-client <client> # | 必须是知道如何安装 npm 包依赖项的可执行文件 |
--use-workspaces # | 启用与 Yarn Workspaces 的集成(从 yarn@0.27+ 开始可用) |
--no-ci # | 在 CI 环境中调用 npm ci 而不是 npm install |
--force-local # | 此标志会导致引导命令始终对本地依赖项进行符号链接,而不管匹配的版本范围如何 |
$ lerna info
lerna notice cli v6.0.0
@@ -609,7 +609,7 @@
# 所有匹配 “package-util-*” 的包都将被忽略,除非它们是
# 依赖于名称与 “package-*” 匹配的包
-:- | :- |
---|---|
--scope <glob> # | 仅包括名称与给定 glob 匹配的包 |
--ignore <glob> # | 排除名称与给定 glob 匹配的包 |
--no-private # | 排除私有包 |
--since [ref] # | 仅包括自指定 ref 以来已更改的包 |
--exclude-dependents # | 使用 --since 运行命令时排除所有传递依赖项,覆盖默认的“changed”算法 |
--include-dependents # | 无论 --scope 、--ignore 或 --since 是什么,在运行命令时都包括所有传递依赖项 |
--include-dependencies # | 无论 --scope 、--ignore 或 --since # 是什么,在运行命令时都包括所有传递依赖项 |
--include-merged-tags # | 使用 --since 运行命令时包括来自合并分支的标签 |
列出自上次标记版本以来已更改的本地软件包
lerna changed
支持 lerna ls
支持的所有选项为了与 CSS
保持兼容,calc()
并不对数学表达式进行计算,但是在嵌套函数中会计算变量和数学公式的值
@var: 50vh/2;
width: calc(50% + (@var - 20px));
// 结果是 calc(50% + (25vh - 20px))
-@min768: ~"(min-width: 768px)";
.element {
diff --git a/docs/markdown.html b/docs/markdown.html
index a41b91fd..31499de8 100644
--- a/docs/markdown.html
+++ b/docs/markdown.html
@@ -129,10 +129,10 @@
4 空格缩进做一个代码块
-`Inline code` 周围有反引号
-| 左栏 | 中间栏 | 右栏 |
| ----------| ------------ | --------- |
| 单元格 1 | 居中 | $1600 |
@@ -165,17 +165,17 @@

-[](https://github.com/)
[](link_url)
-![替代文字][logo]
[logo]: /images/logo.png "Logo Title"
-:- | :- |
---|---|
CREATE DATABASE db ; | 创建 数据库 |
SHOW DATABASES; | 列出 数据库 |
USE db; | 切换 到数据库 |
CONNECT db ; | 切换 到数据库 |
DROP DATABASE db; | 删除 数据库 |
:- | :- |
---|---|
SHOW TABLES; | 列出当前数据库的表 |
SHOW FIELDS FROM t; | 表的列表字段 |
DESC t; | 显示表格结构 |
SHOW CREATE TABLE t; | 显示创建表sql |
TRUNCATE TABLE t; | 删除表中的所有数据 |
DROP TABLE t; | 删除表格 |
:- | :- |
---|---|
show processlist; | 列出进程 |
kill pid; | 杀死进程 |
# 显示当前mysql的version的各种信息
mysql> status;
# 显示当前mysql的version信息
@@ -418,7 +418,7 @@
ON table_name TRIGGER_TYPE
EXECUTE stored_procedure;
-:- | :- |
---|---|
BEFORE | 在事件发生前调用 |
AFTER | 事件发生后调用 |
:- | :- |
---|---|
INSERT | 为INSERT调用 |
UPDATE | 调用UPDATE |
DELETE | 调用DELETE |
:- | :- |
---|---|
FOR EACH ROW | - |
FOR EACH STATEMENT | - |
在t表的c1和c2上创建索引
CREATE INDEX idx_name
ON t(c1,c2);
diff --git a/docs/netstat.html b/docs/netstat.html
index a9455ae1..70f4057e 100644
--- a/docs/netstat.html
+++ b/docs/netstat.html
@@ -288,12 +288,12 @@
以下命令将输出服务器上正在发生和正在发生的活动 SYNC_REC
数量。数量应该很低(小于 5
)。如果该数字为两位数,则您可能正在遭受 DoS
攻击或被邮件轰炸。
$ netstat -n -p|grep SYN_REC | wc -l
-
$ netstat -n -p | grep SYN_REC | awk '{print $5}' | awk -F: '{print $1}'
与上面的命令一样,该命令也列出了发送 SYN_REC
连接状态的节点的所有唯一 IP
地址
$ netstat -antu | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -n
diff --git a/docs/nginx.html b/docs/nginx.html
index 73bb1984..e49baf60 100644
--- a/docs/nginx.html
+++ b/docs/nginx.html
@@ -294,7 +294,7 @@
server {
listen 80;
server_name example.com;
@@ -306,7 +306,7 @@
}
}
-upstream node_js {
server 0.0.0.0:3000;
# 其中 0.0.0.0:3000 是绑定在
@@ -322,7 +322,7 @@
}
}
-upstream node_js {
server 0.0.0.0:3000;
}
@@ -343,7 +343,7 @@
}
适用于 Node.js、Streamlit、Jupyter 等
-server {
listen 80;
@@ -799,17 +799,17 @@
location ~* "(base64_encode)(.*)(\()" {
deny all;
}
-location ~* "(eval\()" {
deny all;
}
-gzip on;
gzip_buffers 16 8k;
diff --git a/docs/npm.html b/docs/npm.html
index ada97bd6..131d550d 100644
--- a/docs/npm.html
+++ b/docs/npm.html
@@ -327,13 +327,13 @@
npm config set registry https://registry.npmmirror.com
请参阅:npmmirror 中国镜像站
-
ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/"
ELECTRON_BUILDER_BINARIES_MIRROR=https://npmmirror.com/mirrors/electron-builder-binaries/
; ELECTRON_CUSTOM_DIR="{{ version }}"
-//registry.npmjs.org/:_authToken=MYTOKEN
; 将适用于 @myorg 和 @another
//somewhere.com/:_authToken=MYTOKEN
diff --git a/docs/package.json.html b/docs/package.json.html
index cf4fc456..8f75e0c0 100644
--- a/docs/package.json.html
+++ b/docs/package.json.html
@@ -106,14 +106,14 @@
}
鼓励使用开源 (OSI-approved) 许可证,除非你有特别的原因不用它。 如果你开发的包是你工作的一部分,最好和公司讨论后再做决定。
-SEE LICENSE IN <文件名>
字符串指向你的包里顶级目录的一个 <文件名>。UNLICENSED
字符串。keywords
keywords
{
"keywords": [
"short", "relevant", "keywords"
diff --git a/docs/quickreference.html b/docs/quickreference.html
index 47811bee..4a4dee5f 100644
--- a/docs/quickreference.html
+++ b/docs/quickreference.html
@@ -46,17 +46,17 @@
简单的将仓库克隆下来本地调试页面展示。
-git clone git@github.com:jaywcjlove/reference.git
-npm i # 安装依赖
npm run build # 编译输出 HTML
npm run start # 监听 md 文件编译输出 HTML
HTML 存放在仓库根目录下的 dist
目录中,将 dist/index.html
静态页面在浏览器中打开预览。
在备忘清单采用 HTML 注释语法
,标识网站布局和一些样式,目的是为了在 GitHub
中也是正常毫无瑕疵的预览 Markdown
。
### 卡片标题
<!--rehype:wrap-class=col-span-2-->
@@ -73,22 +73,22 @@
以 <!--rehype:
开始,-->
结束,包裹参数内容
内容采用 URL 参数的字符拼接方式
-
<!--rehype:
+ key=value
+ &
+ key=value
+ -->
标识开始
+ 参数
+ 分隔符(&)
+ 参数
+ 标识结束
### H2 部分
<!--rehype:body-class=cols-2-->
### H3 部分
<!--rehype:wrap-class=row-span-2-->
-### 标题
<!--rehype:wrap-class=row-span-3&style=color:red;-->
-类 | 说明 |
---|---|
body-style | 包裹所有卡片外壳 的样式 |
body-class | 用于卡片栏布局,添加类 名 |
wrap-style | 卡片栏添加 CSS 样式 |
wrap-class | 用于卡片占位,添加类 名 |
_我是红色_<!--rehype:style=color: red;-->
**加粗红色**<!--rehype:style=color: red;-->
@@ -554,7 +554,7 @@
在 Title 1
标题添加 col-span-2
和 row-span-2
占位类,使用 空格
间隔。
:- | :- |
---|---|
%m/%d/%Y | 06/05/2013 |
%A, %B %e, %Y | Sunday, June 5, 2013 |
%b %e %a | Jun 5 Sun |
:- | :- |
---|---|
%H:%M | 23:05 |
%I:%M %p | 11:05 PM |
标题为 H4
的基本表格。
每个部分可以有以下子项:
-每个盒子(卡片)都是一个 H3
部分。 盒子将包含 H3
自身内的所有东西。
这是一个包含段落的基本部分。
import React, {Component} from 'react'
import ReactDOM from 'react-dom'
@@ -172,7 +172,7 @@
使用 setState
更新状态,下面是函数组件读取状态
<p>您点击了 {count} 次</p>
-import React from 'react';
class Student extends React.Component {
@@ -201,7 +201,7 @@
使用 setState
更新状态,class
组件中不能使用 hooks 。下面是 class
组件读取状态
<p>您点击了{this.state.count}次</p>
-
const elm = ['one', 'two', 'three'];
function Student() {
return (
@@ -308,7 +308,7 @@
)
);
-// 你可以直接获取 DOM button 的 ref:
const ref = React.createRef();
@@ -316,7 +316,7 @@
点击我
</FancyButton>;
-import {Component,createRef} from 'react'
class MyComponent extends Component {
@@ -397,7 +397,7 @@
:- :- id(string)
发生提交的 Profiler
树的 id
onRender(function)
组件树任何组件 “提交” 一个更新的时候调用这个函数
-
:- | :- |
---|---|
phase: "mount" | "update" | 判断是由 props /state /hooks 改变 或 “第一次装载” 引起的重渲染 |
actualDuration: number | 本次更新在渲染 Profiler 和它的子代上花费的时间 |
baseDuration: number | 在 Profiler 树中最近一次每一个组件 render 的持续时间 |
startTime: number | 本次更新中 React 开始渲染的时间戳 |
commitTime: number | 本次更新中 React commit 阶段结束的时间戳 |
interactions: Set | 当更新被制定时,“interactions” 的集合会被追踪 |
class CustomButton extends React.Component {
@@ -442,11 +442,11 @@
color: 'blue'
};
-<CustomButton /> ;
不传值 props.color
将自动设置为 blue
class Hello extends Component {
constructor (props) {
@@ -609,10 +609,10 @@
}
注意:组件必须总是返回一些东西。
-<Greeting firstName="三" lastName="张" />
-export default function Weather(props) {
const isLoggedIn = props.isLoggedIn;
return (
@@ -683,7 +683,7 @@
:- | - |
---|---|
this.forceUpdate() | 强制重新渲染 |
this.setState({ ... }) | 更新状态 |
this.setState(state =>{ ... }) | 更新状态 |
:- | - |
---|---|
defaultProps | 默认 props |
displayName | 显示组件名称(用于调试) |
:- | - |
---|---|
this.props | 组件接受参数 |
this.state | 组件内状态 |
import React, {PureComponent} from 'react'
class MessageBox extends PureComponent {
@@ -865,7 +865,7 @@
function Counter({ initialCount }) {
const [count, setCount] = useState(initialCount);
@@ -1279,7 +1279,7 @@
:- - any
任意类型 (props, propName, 组件名称)=>{}
自定义验证器
-
:- | - |
---|---|
string | 字符串 |
number | 数组 |
func | 函数 |
bool | 布尔值 |
symbol | - |
:- | - |
---|---|
oneOf(any) | 枚举类型 |
oneOfType([type]) | 几种类型中的任意一个类型 |
:- | - |
---|---|
array | 数组 |
arrayOf | 数组由某一类型的元素组成 |
:- | - |
---|---|
object | 对象 |
objectOf | 对象由某一类型的值组成 |
instanceOf(...) | 类的实例 |
shape | 对象由特定的类型值组成 |
exact | 有额外属性警告 |
:- | - |
---|---|
element | React 元素 |
elementType | React 元素类型(即 MyComponent ) |
node | DOM 节点 |
MyComponent.propTypes = {
email: PropTypes.string,
seats: PropTypes.number,
diff --git a/docs/regex.html b/docs/regex.html
index 6fb2d77e..26441b3d 100644
--- a/docs/regex.html
+++ b/docs/regex.html
@@ -1360,7 +1360,7 @@
表达式 [^c]ar
匹配一个后面跟着 ar
的除了c
的任意字符。
*
号*
号表达式 | 匹配示例 |
---|---|
[a-z]* | The car parked in the garage #21. |
\s*cat\s* | The fat cat sat on the concat enation. |
表达式 [a-z]*
匹配一个行中所有以小写字母开头的字符串。
+
号+
号表达式 | 匹配示例 |
---|---|
c.+t | The fat cat sat on the mat . |
表达式 c.+t
匹配以首字母c开头以t结尾,中间跟着至少一个字符的字符串。
?
号?
号表达式 | 匹配示例 |
---|---|
[T]he | The car is parked in the garage. |
[T]?he | The car is parked in the garage. |
表达式 [T]?he
匹配字符串 he
和 The
。
{}
号{}
号匹配指定开头或结尾的字符串就要使用到锚点。
-^
号 (符串的开头)^
号 (符串的开头)表达式 | 匹配示例 |
---|---|
(T|t)he | The car is parked in the garage. |
^(T|t)he | The car is parked in the garage. |
$
号 (否是最后一个)$
号 (否是最后一个)表达式 | 匹配示例 |
---|---|
(at\.) | The fat cat. sat. on the mat. |
(at\.)$ | The fat cat. sat. on the mat. |
>>> sentence = 'This is a sample string'
>>> bool(re.search(r'this', sentence, flags=re.I))
True
>>> bool(re.search(r'xyz', sentence))
False
->>> re.findall(r'\bs?pare?\b', 'par spar apparent spare part pare')
['par', 'spar', 'spare', 'pare']
>>> re.findall(r'\b0*[1-9]\d{2,}\b', '0501 035 154 12 26 98234')
['0501', '154', '98234']
->>> m_iter = re.finditer(r'[0-9]+', '45 349 651 593 4 204')
>>> [m[0] for m in m_iter if int(m[0]) < 350]
['45', '349', '4', '204']
->>> re.split(r'\d+', 'Sample123string42with777numbers')
['Sample', 'string', 'with', 'numbers']
->>> ip_lines = "catapults\nconcatenate\ncat"
>>> print(re.sub(r'^', r'* ', ip_lines, flags=re.M))
* catapults
* concatenate
* cat
->>> pet = re.compile(r'dog')
>>> type(pet)
<class '_sre.SRE_Pattern'>
@@ -1795,7 +1795,7 @@
>>> bool(pet.search('A cat crossed their path'))
False
-:- | :- |
---|---|
dotAll | 是否使用了 s 修饰符 |
flags | 返回标志的字符串 |
global | 是否使用了 g (全部)修饰符 |
hasIndices | 是否使用了 d 修饰符 |
ignoreCase | 匹配文本的时候是否忽略大小写 i |
multiline | 是否进行多行搜索 m |
lastIndex | 该索引表示从哪里开始下一个匹配 |
source | 正则表达式的文本 |
sticky | 搜索是否是 sticky |
unicode | Unicode 功能是否开启 |
:- | :- |
---|---|
match() | 获取匹配结果 |
matchAll() | 所有匹配项 |
replace() | 替换所有符合正则模式的匹配项 |
search() | 搜索以取得匹配正则模式的项 |
split() | 切割字符串返回字符串数组 |
compile() | (重新)编译正则表达式 |
exec() | 指定字符串中执行一个搜索匹配 |
test() | 正则表达式与指定的字符串是否匹配 |
toString() | 返回该正则表达式的字符串 |
let textA = 'I like APPles very much';
let textB = 'I like APPles';
let regex = /apples$/i
@@ -2136,21 +2136,21 @@
Pattern p = Pattern.compile(".s", Pattern.CASE_INSENSITIVE);
Matcher m = p.matcher("aS");
boolean s1 = m.matches();
System.out.println(s1); // Outputs: true
-boolean s2 = Pattern.compile("[0-9]+").matcher("123").matches();
System.out.println(s2); // Outputs: true
-boolean s3 = Pattern.matches(".s", "XXXX");
System.out.println(s3); // Outputs: false
-:- | - |
---|---|
CANON_EQ | 规范等价 |
CASE_INSENSITIVE | 不区分大小写的匹配 |
COMMENTS | 允许空格和注释 |
DOTALL | 圆点模式 |
MULTILINE | 多行模式 |
UNICODE_CASE | Unicode 感知大小写折叠 |
UNIX_LINES | Unix 行模式 |
还有更多方法...
-替换句子:
String regex = "[A-Z\n]{5}$";
@@ -2270,7 +2270,7 @@
expr REGEXP pat
-mysql> SELECT 'abc' REGEXP '^[a-d]';
1
mysql> SELECT name FROM cities WHERE name REGEXP '^A';
@@ -2279,28 +2279,28 @@
mysql> SELECT 'a' REGEXP 'A', 'a' REGEXP BINARY 'A';
1 0
-REGEXP_REPLACE(expr, pat, repl[, pos[, occurrence[, match_type]]])
-mysql> SELECT REGEXP_REPLACE('a b c', 'b', 'X');
a X c
mysql> SELECT REGEXP_REPLACE('abc ghi', '[a-z]+', 'X', 1, 2);
abc X
-REGEXP_SUBSTR(expr, pat[, pos[, occurrence[, match_type]]])
-mysql> SELECT REGEXP_SUBSTR('abc def ghi', '[a-z]+');
abc
mysql> SELECT REGEXP_SUBSTR('abc def ghi', '[a-z]+', 1, 3);
ghi
-REGEXP_LIKE(expr, pat[, match_type])
-mysql> SELECT regexp_like('aba', 'b+')
1
mysql> SELECT regexp_like('aba', 'b{2}')
@@ -2312,10 +2312,10 @@
mysql> SELECT regexp_like('a\nb\nc', '^b$', 'm');
1
-REGEXP_INSTR(expr, pat[, pos[, occurrence[, return_option[, match_type]]]])
-mysql> SELECT regexp_instr('aa aaa aaaa', 'a{3}');
2
mysql> SELECT regexp_instr('abba', 'b{2}', 2);
@@ -2325,7 +2325,7 @@
mysql> SELECT regexp_instr('abbabba', 'b{2}', 1, 3, 1);
7
-hue($color) // 0deg..360deg
saturation($color) // 0%..100%
lightness($color) // 0%..100%
alpha($color) // 0..1 (aka opacity())
-@debug rgb(204, 102, 153); // #c69
@debug rgba(107, 113, 127, 0.8); // rgba(107, 113, 127, 0.8)
@debug hsl(228, 7%, 86%); // #dadbdf
diff --git a/docs/semver.html b/docs/semver.html
index c1cc0972..283e50c6 100644
--- a/docs/semver.html
+++ b/docs/semver.html
@@ -174,7 +174,7 @@
范围 描述 1.2.3 - 2.3.4
是 >=1.2.3 <=2.3.4
-
范围 | 描述 |
---|---|
1.2.3 - 2.3 | 是 >=1.2.3 <2.4.0 |
1.2.3 - 2 | 是 >=1.2.3 <3.0.0 |
当右侧为部分(例如,2.3
)时,假定缺失的部分为x
(例如, 2.3.x
)。
如果左边是部分的(例如,1.2
),则假定缺少的部分为0
(例如, 1.2.0
)。
0.0.4
1.2.3
diff --git a/docs/styled-components.html b/docs/styled-components.html
index a42f40fa..46a0cd10 100644
--- a/docs/styled-components.html
+++ b/docs/styled-components.html
@@ -279,7 +279,7 @@
);
}
-import styled from 'styled-components';
const StyledCounter = styled.div`
@@ -312,7 +312,7 @@
);
}
-const Thing = styled.div.attrs((/* props */) => ({ tabIndex: 0 }))`
color: blue;
@@ -926,12 +926,12 @@
<MyComponent className="red-bg" />
由于某种原因,这个组件仍然有绿色背景,即使你试图用 red-bg
类覆盖它!
-
.red-bg.red-bg {
background-color: red;
}
-import styled, { ThemeProvider } from 'styled-components'
diff --git a/docs/sublime-text.html b/docs/sublime-text.html
index 977b88ed..1389cf31 100644
--- a/docs/sublime-text.html
+++ b/docs/sublime-text.html
@@ -388,12 +388,12 @@
/usr/local/bin/subl
-$ subl .
$ subl README.md
软链放到这个目录 /usr/local/bin/subl
,这是因为 Rootless
机制,不能存放到 位置。/usr/bin/subl
var numberOfDogs = 100
numberOfDogs += 1
print("有 \(numberOfDogs) 个斑点狗!")
@@ -93,7 +93,7 @@
%=
除并分配余数
-
var apples = 6
print("I have \(apples) apples!")
// 打印: I have 6 apples!
diff --git a/docs/toml.html b/docs/toml.html
index a52bd2b0..d0532ad6 100644
--- a/docs/toml.html
+++ b/docs/toml.html
@@ -162,7 +162,7 @@
author = "Anonymous"
text = "Love it!"
-{
"comments" : [
{
@@ -176,11 +176,11 @@
]
}
-[dog."tater.man"]
type = "pug"
-{
"dog": {
"tater.man": {
@@ -189,11 +189,11 @@
}
}
-[foo.bar.baz]
bat = "hi"
-{
"foo" : {
"bar" : {
@@ -204,7 +204,7 @@
}
}
-[a.b.c] # this is best practice
[ d.e.f ] # same as [d.e.f]
[ g . h .i ] # same as [g.h.i]
diff --git a/docs/typescript.html b/docs/typescript.html
index e27871fd..9e3a010a 100644
--- a/docs/typescript.html
+++ b/docs/typescript.html
@@ -61,7 +61,7 @@
Regexp, Promise
Object:
{ field: string }
@@ -74,10 +74,10 @@
Tuple:
[string, number]
-Object, String, Number, Boolean
-/** 可选择从现有接口或类型(Response, HTTPAble)中获取属性 */
interface JSONResponse extends Response, HTTPAble {
@@ -107,7 +107,7 @@
data: Response
}
-const api: APICall<ArtworkCall> = ...
api.data // Artwork
@@ -121,7 +121,7 @@
api.data.status
-interface Expect {
(matcher: boolean): string
(matcher: string): boolean;
@@ -165,11 +165,11 @@
Interface 可以通过多次声明来扩展
在性能关键 Type 中,Interface 比较检查可以更快。
-
就像您如何在不同范围内创建具有相同名称的变量一样,type 具有相似的语义。
-TypeScript 包含许多全局类型,它们将帮助您在类型系统中完成常见任务。检查他们的网站。
-type SanitizedInput = string;
type MissingNo = 404;
@@ -256,7 +256,7 @@
const input = getUserInput()
input // string | number
@@ -264,7 +264,7 @@
input // string
}
-const input = getUserInput()
input // string | { error: ... }
@@ -272,7 +272,7 @@
input // { error: ... }
}
-const input = getUserInput()
input // number | number[]
@@ -280,7 +280,7 @@
input // number[]
}
-const input = getUserInput()
input // number | number[]
@@ -288,7 +288,7 @@
input // number[]
}
-const data1 = {
name: "Zagreus"
@@ -338,7 +338,7 @@
| { status: 301, to: string }
| { status: 400, error: Error }
-const response = getResponse()
response // Responses
switch(response.status) {
@@ -347,7 +347,7 @@
case 400: return response.error
}
-描述影响当前范围的 CFA 更改的函数,因为它抛出而不是返回 false。
function assertResponse(obj: any): asserts obj is SuccessResponse {
@@ -356,7 +356,7 @@
}
}
-const res = getResponse():
res // SuccessResponse | ErrorResponse
@@ -365,7 +365,7 @@
res // SuccessResponse
-interface A {
x: number;
}
@@ -388,7 +388,7 @@
const abc = new ABC()
新 ABC 的参数来自构造函数。
-前缀 private 是一个仅类型的添加,在运行时没有任何影响。 在以下情况下,类之外的代码可以进入项目:
class Bag {
private item: any
@@ -397,17 +397,17 @@
Vs #private 是运行时私有的,并且在 JavaScript 引擎内部强制执行,它只能在类内部访问:
class Bag { #item: any }
-
函数内部‘this’的值取决于函数的调用方式。 不能保证始终是您可能在其他语言中使用的类实例。
您可以使用“此参数”、使用绑定功能或箭头功能来解决问题。
-一个类既可以用作类型也可以用作值。
const a:Bag = new Bag()
所以,小心不要这样做:
class C implements Bag {}
-// 确保类符合一组接口或类型 ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈▶┈┈╮
// 子类这个类 ┈┈┈┈┈┈┈┈↘ ┈┈┈┈┈┈┈┈┈┈┈┈┈┴┈┈┈┈┈┈┈
@@ -693,7 +693,7 @@
从构造函数类型的类型构造元组或数组类型。它产生一个包含所有参数类型的元组类型(如果 Type 不是函数,则类型 never )。
type Greeting = "Hello, world"
type ShoutyGreeting = Uppercase<Greeting>
// type ShoutyGreeting = "HELLO, WORLD"
@@ -703,7 +703,7 @@
// type MainID = "ID-MY_APP"
将字符串中的每个字符转换为大写版本。
-type Greeting = "Hello, world"
type QuietGreeting = Lowercase<Greeting>
// type QuietGreeting = "hello, world"
@@ -713,19 +713,19 @@
// type MainID = "id-my_app"
将字符串中的每个字符转换为等效的小写字母。
-type LowercaseGreeting = "hello, world";
type Greeting = Capitalize<LowercaseGreeting>;
// type Greeting = "Hello, world"
将字符串中的第一个字符转换为等效的大写字母。
-type UppercaseGreeting = "HELLO WORLD";
type UncomfortableGreeting = Uncapitalize<UppercaseGreeting>;
// type UncomfortableGreeting = "hELLO WORLD"
将字符串中的第一个字符转换为等效的小写字母。
-declare function f1(): {
a: number; b: string
};
diff --git a/docs/vim.html b/docs/vim.html
index 1e8fd83f..7d13e385 100644
--- a/docs/vim.html
+++ b/docs/vim.html
@@ -46,7 +46,7 @@
▼/▶ 光标 ▽/▷ 目标
-
╭┈┈┈┈┈┈┈┈┈┈┈┈┈ |
├┈┈┈┈┈┈┈┈┈┈┈┈┈ 0 $ ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮
┆ ╭┈┈┈┈┈┈┈┈┈┈ ^ fe ┈┈┈┈┈┈┈┈╮ ┆
@@ -58,7 +58,7 @@
▽ ▽ ▽▽ ▽ ▽ ▽▼ ▼▽ ▽ ▽ ▽ ▽▽ ▽
echo "A cheatsheet from quickReference"
- - SCREEN 1 START
╭┈┬┈┈┈┈┈┈┈┈┈▷ #!/usr/bin/python
┆ ┆ ╭┈┈┈▷
@@ -75,7 +75,7 @@
┆ - SCREEN 1 END
╰┈┈┈┈┈┈┈┈┈┈┈┈┈┈▷ print("SCREEN 2")
-快捷方式 | 说明 |
---|---|
h | j | k | l | 方向键 |
<C-u> / <C-d> | 上/下半页 |
<C-b> / <C-f> | 向上/向下翻页 |
快捷方式 | 说明 |
---|---|
b / w | 上一个/下一个单词 |
ge / e | 上一个/下一个词尾 |
快捷方式 | 说明 |
---|---|
0 (zero) / $ | 行的开始/结束 |
^ | 行开头 (非空白) |
快捷方式 | 说明 |
---|---|
Fe / fe | 移动到上一个/下一个e |
To / to | 在上一个/下一个o 之前/之后移动 |
| / n| | 转到第一个/n 列 |
快捷方式 | 说明 |
---|---|
gg / G | 第一行/最后一行 |
:n | nG | 转到第 n 行 |
} / { | 下一个/上一个空行 |
快捷方式 | 说明 |
---|---|
H / M / L | 上/中/下屏幕 |
zt / zz / zb | 上/中/下这条线 |
快捷方式 | 说明 |
---|---|
x | 删除字符 (剪切) |
p / P | 在之后/之前粘贴 |
xp | 交换两个字符 |
D | 删除到行尾 (剪切) |
dw | 删除单词 (剪切) |
dd | 删除线 (剪切) |
ddp | 交换两条线 |
yy | 拉线 (复制) |
"*p | "+p | 从系统剪贴板粘贴 |
"*y | "+y | 粘贴到系统剪贴板 |
快捷方式 | 说明 |
---|---|
d | x | 删除选择 (剪切) |
s | 替换选择 |
y | Yank 选择 (复制) |
快捷方式 | 说明 |
---|---|
:tabe [file] | |
:tabf [file] | 如果在新选项卡中存在则打开 |
:tabc | |
:tabo | 关闭 |
:tabs | 列出所有 |
:tabr | 转到第一个 |
:tabl | 转到 |
:tabm 0 | 0 |
:tabn | 转到 |
:tabp | 转到 |
快捷方式 | 说明 |
---|---|
gt | 转到 |
gT | 转到 |
2gt | 转到标签编号 2 |
<transition>
组件上的 duration
prop 定制一个显性的过渡持续时间 (以毫秒计):
<transition :duration="1000">
...
diff --git a/docs/yaml.html b/docs/yaml.html
index 616f0550..f507f9b2 100644
--- a/docs/yaml.html
+++ b/docs/yaml.html
@@ -65,7 +65,7 @@
b: false # 布尔类型
d: 2015-04-05 # 日期类型
-{
"n1": 1,
"n2": 1.234,
@@ -77,17 +77,17 @@
}
使用空格缩进。 元素部分之间必须有空间。
-some_thing: &VAR_NAME foobar
other_thing: *VAR_NAME
-{
"some_thing": "foobar",
"other_thing": "foobar"
}
-# A single line comment example
# block level comment example
# comment line 1
@@ -99,10 +99,10 @@
hello
world
-{"description": "hello\nworld\n"}
-parent: &defaults
a: 2
@@ -111,7 +111,7 @@
<<: *defaults
b: 4
-{
"parent": {
"a": 2,
@@ -123,7 +123,7 @@
}
}
-values: &ref
- Will be
@@ -132,7 +132,7 @@
other_values:
i_am_ref: *ref
-{
"values": [
"Will be",
@@ -146,15 +146,15 @@
}
}
-description: >
hello
world
-{"description": "hello world\n"}
----
document: this is doc 1
---
@@ -167,38 +167,38 @@
- Sammy Sosa
- Ken Griffey
-[
"Mark McGwire",
"Sammy Sosa",
"Ken Griffey"
]
-hr: 65 # Home runs
avg: 0.278 # Batting average
rbi: 147 # Runs Batted In
-{
"hr": 65,
"avg": 0.278,
"rbi": 147
}
-attributes:
- a1
- a2
methods: [getter, setter]
-{
"attributes": ["a1", "a2"],
"methods": ["getter", "setter"]
}
-children:
- name: Jimmy Smith
age: 15
@@ -208,7 +208,7 @@
name: Sammy Sosa
age: 12
-{
"children": [
{"name": "Jimmy Smith", "age": 15},
@@ -217,7 +217,7 @@
]
}
-my_sequences:
- [1, 2, 3]
- [4, 5, 6]
@@ -227,7 +227,7 @@
- 9
- 0
-{
"my_sequences": [
[1, 2, 3],
@@ -236,14 +236,14 @@
]
}
-Mark McGwire: {hr: 65, avg: 0.278}
Sammy Sosa: {
hr: 63,
avg: 0.288
}
-{
"Mark McGwire": {
"hr": 65,
@@ -255,7 +255,7 @@
}
}
-Jack:
id: 1
name: Franc
@@ -265,7 +265,7 @@
- b
location: {country: "A", city: "A-A"}
-{
"Jack": {
"id": 1,
@@ -278,26 +278,26 @@
}
}
-set1: !!set
? one
? two
set2: !!set {'one', "two"}
-{
"set1": {"one": null, "two": null},
"set2": {"one": null, "two": null}
}
集合表示为一个映射,其中每个键都与一个空值相关联
-ordered: !!omap
- Mark McGwire: 65
- Sammy Sosa: 63
- Ken Griffy: 58
-{
"ordered": [
{"Mark McGwire": 65},
@@ -306,7 +306,7 @@
]
}
-!!map | {Hash table, dictionary, mapping} |
!!seq | {List, array, tuple, vector, sequence} |
!!str | Unicode 字符串 |
\x12
(8-bit)\u1234
(16-bit)\U00102030
(32-bit)\\
(\)\"
(")\<TAB>
(TAB)\0
(NUL)\a
(BEL)\v
(VTAB)\e
(ESC)\_
(NBSP)\P
(PS)