schema | type | description |
---|---|---|
id | number | id of current instance |
created_at | date | when instance created? |
updated_at | date | when instance updated? |
status | [1,2,3] | life status of instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const binary = 0b1111 | |
//=> 15 | |
const oct = 0o1111 | |
//=> 585 | |
const decimal = 1111 | |
// => 1111 | |
const hex = 0x1111 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const value = Number(amount) | |
this.validateFaield = !isNaN(value) ? value > balance : true | |
|| | |
|| | |
this.validateFailed = !(value <= balance) | |
// compare NaN value always return false. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ "key": "ctrl+`", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus" }, | |
{ "key": "ctrl+`", "command": "workbench.action.terminal.focus", "when": "!terminalFocus" } | |
] | |
// Paste above code into F1: Open KeyboardShortcuts preferences. yourself keybinds.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// regex 分组的一个好例子 | |
const pattern = /^(0*([1-9]\d{1,3})\ +)?([1-9]\d{7,})$/ | |
const str = '086 18118771840' | |
pattern.exec(str) | |
/* => [ '086 18118771840', '086 ', '86', '18118771840' ] | |
* 这里,用正则来匹配想要的字段,加上括号,即可自动分组, | |
* 应用: 根据条件提取字段,分组甚至能够在正则表达式里面直接使用。 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1, Object.is | |
Object.is('hello', 'hello') | |
// => true | |
Object.is(+0, -0) | |
// => false | |
Object.is(NaN, NaN) | |
// => true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'C:\Users\Administrator/Desktop/7-42.pdf' is wrong. | |
should be 'C:\\Users\\Administrator/Desktop/7-42.pdf' | |
because \ is preserved to escape character. | |
const str = 'C:\\Users\\Administrator/Desktop/7-42.pdf' | |
str.replace(/\//g, '\\') | |
// => 'C:\\Users\\Administrator\\Desktop\\7-42.pdf' | |
const obj = {
[variable]: value,
}
const total = ['age', 'name', 'favourite'].map(key => dataLists.reduce((sum, data) => ({
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# sudo passwd root: set password for root user | |
sudo passwd root # for root user | |
sudo passwd $USER # for current logged in user. | |
# Add a new user | |
sudo adduser <qm> | |
# add epel yum repository |