Format: update some table formatting

This commit is contained in:
Rico Sta. Cruz 2020-07-04 23:29:16 +10:00
parent 02c3e97f4a
commit d4e3421ac6
2 changed files with 78 additions and 58 deletions

56
bash.md
View File

@ -102,9 +102,11 @@ See: [Unofficial bash strict mode](http://redsymbol.net/articles/unofficial-bash
echo {A,B}.js echo {A,B}.js
``` ```
| `{A,B}` | Same as `A B` | | Expression | Description |
| ---------- | ------------------- |
| `{A,B}` | Same as `A B` |
| `{A,B}.js` | Same as `A.js B.js` | | `{A,B}.js` | Same as `A.js B.js` |
| `{1..5}` | Same as `1 2 3 4 5` | | `{1..5}` | Same as `1 2 3 4 5` |
See: [Brace expansion](http://wiki.bash-hackers.org/syntax/expansion/brace) See: [Brace expansion](http://wiki.bash-hackers.org/syntax/expansion/brace)
@ -163,19 +165,19 @@ DIR=${SRC%$BASE} #=> "/path/to/" (dirpath)
### Substitution ### Substitution
| Code | Description | | Code | Description |
| --- | --- | | ----------------- | ------------------- |
| `${FOO%suffix}` | Remove suffix | | `${FOO%suffix}` | Remove suffix |
| `${FOO#prefix}` | Remove prefix | | `${FOO#prefix}` | Remove prefix |
| --- | --- | | --- | --- |
| `${FOO%%suffix}` | Remove long suffix | | `${FOO%%suffix}` | Remove long suffix |
| `${FOO##prefix}` | Remove long prefix | | `${FOO##prefix}` | Remove long prefix |
| --- | --- | | --- | --- |
| `${FOO/from/to}` | Replace first match | | `${FOO/from/to}` | Replace first match |
| `${FOO//from/to}` | Replace all | | `${FOO//from/to}` | Replace all |
| --- | --- | | --- | --- |
| `${FOO/%from/to}` | Replace suffix | | `${FOO/%from/to}` | Replace suffix |
| `${FOO/#from/to}` | Replace prefix | | `${FOO/#from/to}` | Replace prefix |
### Comments ### Comments
@ -563,15 +565,19 @@ History
### Commands ### Commands
| `history` | Show history | | Command | Description |
| --------------------- | ----------------------------------------- |
| `history` | Show history |
| `shopt -s histverify` | Don't execute expanded result immediately | | `shopt -s histverify` | Don't execute expanded result immediately |
### Expansions ### Expansions
| `!$` | Expand last parameter of most recent command | | Expression | Description |
| `!*` | Expand all parameters of most recent command | | ------------ | ---------------------------------------------------- |
| `!-n` | Expand `n`th most recent command | | `!$` | Expand last parameter of most recent command |
| `!n` | Expand `n`th command in history | | `!*` | Expand all parameters of most recent command |
| `!-n` | Expand `n`th most recent command |
| `!n` | Expand `n`th command in history |
| `!<command>` | Expand most recent invocation of command `<command>` | | `!<command>` | Expand most recent invocation of command `<command>` |
### Operations ### Operations
@ -737,10 +743,12 @@ read -n 1 ans # Just one character
### Special variables ### Special variables
| `$?` | Exit status of last task | | Expression | Description |
| `$!` | PID of last background task | | ---------- | ---------------------------- |
| `$$` | PID of shell | | `$?` | Exit status of last task |
| `$0` | Filename of the shell script | | `$!` | PID of last background task |
| `$$` | PID of shell |
| `$0` | Filename of the shell script |
See [Special parameters](http://wiki.bash-hackers.org/syntax/shellvars#special_parameters_and_shell_variables). See [Special parameters](http://wiki.bash-hackers.org/syntax/shellvars#special_parameters_and_shell_variables).

View File

@ -282,29 +282,27 @@ Lifecycle
{: .-two-column} {: .-two-column}
### Mounting ### Mounting
| Method | Description |
| Method | Description | | ------------------------ | ---------------------------------------------------------------------------------------------------- |
| --- | --- | | `constructor` _(props)_ | Before rendering [#](https://reactjs.org/docs/react-component.html#constructor) |
| `constructor` _(props)_ | Before rendering [#](https://reactjs.org/docs/react-component.html#constructor) | | `componentWillMount()` | _Don't use this_ [#](https://reactjs.org/docs/react-component.html#componentwillmount) |
| `componentWillMount()` | _Don't use this_ [#](https://reactjs.org/docs/react-component.html#componentwillmount) | | `render()` | Render [#](https://reactjs.org/docs/react-component.html#render) |
| `render()` | Render [#](https://reactjs.org/docs/react-component.html#render) | | `componentDidMount()` | After rendering (DOM available) [#](https://reactjs.org/docs/react-component.html#componentdidmount) |
| `componentDidMount()` | After rendering (DOM available) [#](https://reactjs.org/docs/react-component.html#componentdidmount) | | --- | --- |
| --- | --- | | `componentWillUnmount()` | Before DOM removal [#](https://reactjs.org/docs/react-component.html#componentwillunmount) |
| `componentWillUnmount()` | Before DOM removal [#](https://reactjs.org/docs/react-component.html#componentwillunmount) | | --- | --- |
| --- | --- | | `componentDidCatch()` | Catch errors (16+) [#](https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html) |
| `componentDidCatch()` | Catch errors (16+) [#](https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html) |
Set initial the state on `constructor()`. Set initial the state on `constructor()`.
Add DOM event handlers, timers (etc) on `componentDidMount()`, then remove them on `componentWillUnmount()`. Add DOM event handlers, timers (etc) on `componentDidMount()`, then remove them on `componentWillUnmount()`.
### Updating ### Updating
| Method | Description |
| Method | Description | | ------------------------------------------------------- | ---------------------------------------------------- |
| --- | --- | | `componentDidUpdate` _(prevProps, prevState, snapshot)_ | Use `setState()` here, but remember to compare props |
| `componentDidUpdate` *(prevProps, prevState, snapshot)* | Use `setState()` here, but remember to compare props | | `shouldComponentUpdate` _(newProps, newState)_ | Skips `render()` if returns false |
| `shouldComponentUpdate` *(newProps, newState)* | Skips `render()` if returns false | | `render()` | Render |
| `render()` | Render | | `componentDidUpdate` _(prevProps, prevState)_ | Operate on the DOM here |
| `componentDidUpdate` *(prevProps, prevState)* | Operate on the DOM here |
Called when parents change properties and `.setState()`. These are not called for initial renders. Called when parents change properties and `.setState()`. These are not called for initial renders.
@ -714,40 +712,54 @@ import PropTypes from 'prop-types'
See: [Typechecking with PropTypes](https://reactjs.org/docs/typechecking-with-proptypes.html) See: [Typechecking with PropTypes](https://reactjs.org/docs/typechecking-with-proptypes.html)
| `any` | Anything | | Key | Description |
| ----- | ----------- |
| `any` | Anything |
#### Basic #### Basic
| `string` | | | Key | Description |
| `number` | | | -------- | ------------- |
| `func` | Function | | `string` | |
| `bool` | True or false | | `number` | |
| `func` | Function |
| `bool` | True or false |
#### Enum #### Enum
| `oneOf`_(any)_ | Enum types | | Key | Description |
| `oneOfType`_(type array)_ | Union | | ------------------------- | ----------- |
| `oneOf`_(any)_ | Enum types |
| `oneOfType`_(type array)_ | Union |
#### Array #### Array
| `array` | | | Key | Description |
| `arrayOf`_(...)_ | | | ---------------- | ----------- |
| `array` | |
| `arrayOf`_(...)_ | |
#### Object #### Object
| `object` | | | Key | Description |
| `objectOf`_(...)_ | Object with values of a certain type | | ------------------- | ------------------------------------ |
| `instanceOf`_(...)_ | Instance of a class | | `object` | |
| `shape`_(...)_ | | | `objectOf`_(...)_ | Object with values of a certain type |
| `instanceOf`_(...)_ | Instance of a class |
| `shape`_(...)_ | |
#### Elements #### Elements
| `element` | React element | | Key | Description |
| `node` | DOM node | | --------- | ------------- |
| `element` | React element |
| `node` | DOM node |
#### Required #### Required
| `(···).isRequired` | Required | | Key | Description |
| ------------------ | ----------- |
| `(···).isRequired` | Required |
### Basic types ### Basic types