jotting

《NOTE》:Twenty Nineteen

May

JavaScript

Naming 命名規則

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Function
(X) CheckValidToken
(O) chkToken

// Bool
(X) TokenValid
(O) isTokenValid
(O) isXXX...

// Constant
(O) IS_VALID

// Array
(O) policyItems
(O) Policys
(O)
// Variable
(O) countPolicys

//

Bash

複製 Output

1
2
echo "Hello world" | pbcopy
# "Hello world" is now in your clipboard

Linux

檢索 Systemd 日誌 - Journalctl

1
2
3
4
5
6
7
8
9
10
11
12
13
journalctl -f --no-pager -n 50 -u <service>

# -u By Unit
# see messages logged by any systemd unit

# -f Follow
# To run journalctl like the Linux tail command so it continuously prints log messages as they are added

# --no-pager
# tell it to not use a pager

# -n <number>
# printing the last number

June

JavaScript

React

1
2
3
4
5
6
7
8
9
10
this.setState(({ PolicyReview }) => ({
PolicyReview: {
...PolicyReview,
listHistory: PolicyReview.listHistory.map((obj, index) => {
return index === Number(indexCollapse)
? Object.assign(obj, { isOpen: !obj.isOpen })
: obj;
}),
},
}));

VS Code

回到上下一個工作

1
2
3
# Mac:
prev: Ctrl + -
next: Ctrl + Shift + -

React

ClassNames

1
<div className={classNames(styles.xxxxx, styles.yyyyy, styles.zzzzz)} />