Skip to content

Commit

Permalink
Format: update some table formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
rstacruz committed Jul 4, 2020
1 parent 02c3e97 commit d4e3421
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 58 deletions.
56 changes: 32 additions & 24 deletions bash.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,11 @@ See: [Unofficial bash strict mode](http://redsymbol.net/articles/unofficial-bash
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` |
| `{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)

Expand Down Expand Up @@ -163,19 +165,19 @@ DIR=${SRC%$BASE} #=> "/path/to/" (dirpath)

### Substitution

| Code | Description |
| --- | --- |
| `${FOO%suffix}` | Remove suffix |
| `${FOO#prefix}` | Remove prefix |
| --- | --- |
| `${FOO%%suffix}` | Remove long suffix |
| `${FOO##prefix}` | Remove long prefix |
| --- | --- |
| `${FOO/from/to}` | Replace first match |
| `${FOO//from/to}` | Replace all |
| --- | --- |
| `${FOO/%from/to}` | Replace suffix |
| `${FOO/#from/to}` | Replace prefix |
| Code | Description |
| ----------------- | ------------------- |
| `${FOO%suffix}` | Remove suffix |
| `${FOO#prefix}` | Remove prefix |
| --- | --- |
| `${FOO%%suffix}` | Remove long suffix |
| `${FOO##prefix}` | Remove long prefix |
| --- | --- |
| `${FOO/from/to}` | Replace first match |
| `${FOO//from/to}` | Replace all |
| --- | --- |
| `${FOO/%from/to}` | Replace suffix |
| `${FOO/#from/to}` | Replace prefix |

### Comments

Expand Down Expand Up @@ -563,15 +565,19 @@ History
### Commands
| `history` | Show history |
| Command | Description |
| --------------------- | ----------------------------------------- |
| `history` | Show history |
| `shopt -s histverify` | Don't execute expanded result immediately |
### Expansions
| `!$` | Expand last parameter of most recent command |
| `!*` | Expand all parameters of most recent command |
| `!-n` | Expand `n`th most recent command |
| `!n` | Expand `n`th command in history |
| Expression | Description |
| ------------ | ---------------------------------------------------- |
| `!$` | Expand last parameter of most recent command |
| `!*` | 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>` |
### Operations
Expand Down Expand Up @@ -737,10 +743,12 @@ read -n 1 ans # Just one character

### Special variables

| `$?` | Exit status of last task |
| `$!` | PID of last background task |
| `$$` | PID of shell |
| `$0` | Filename of the shell script |
| Expression | Description |
| ---------- | ---------------------------- |
| `$?` | Exit status of last task |
| `$!` | 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).

Expand Down
80 changes: 46 additions & 34 deletions react.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,29 +282,27 @@ Lifecycle
{: .-two-column}

### Mounting

| Method | Description |
| --- | --- |
| `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) |
| `render()` | Render [#](https://reactjs.org/docs/react-component.html#render) |
| `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) |
| --- | --- |
| `componentDidCatch()` | Catch errors (16+) [#](https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html) |
| Method | Description |
| ------------------------ | ---------------------------------------------------------------------------------------------------- |
| `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) |
| `render()` | Render [#](https://reactjs.org/docs/react-component.html#render) |
| `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) |
| --- | --- |
| `componentDidCatch()` | Catch errors (16+) [#](https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html) |

Set initial the state on `constructor()`.
Add DOM event handlers, timers (etc) on `componentDidMount()`, then remove them on `componentWillUnmount()`.

### Updating

| Method | Description |
| --- | --- |
| `componentDidUpdate` *(prevProps, prevState, snapshot)* | Use `setState()` here, but remember to compare props |
| `shouldComponentUpdate` *(newProps, newState)* | Skips `render()` if returns false |
| `render()` | Render |
| `componentDidUpdate` *(prevProps, prevState)* | Operate on the DOM here |
| Method | Description |
| ------------------------------------------------------- | ---------------------------------------------------- |
| `componentDidUpdate` _(prevProps, prevState, snapshot)_ | Use `setState()` here, but remember to compare props |
| `shouldComponentUpdate` _(newProps, newState)_ | Skips `render()` if returns false |
| `render()` | Render |
| `componentDidUpdate` _(prevProps, prevState)_ | Operate on the DOM here |

Called when parents change properties and `.setState()`. These are not called for initial renders.

Expand Down Expand Up @@ -714,40 +712,54 @@ import PropTypes from 'prop-types'

See: [Typechecking with PropTypes](https://reactjs.org/docs/typechecking-with-proptypes.html)

| `any` | Anything |
| Key | Description |
| ----- | ----------- |
| `any` | Anything |

#### Basic

| `string` | |
| `number` | |
| `func` | Function |
| `bool` | True or false |
| Key | Description |
| -------- | ------------- |
| `string` | |
| `number` | |
| `func` | Function |
| `bool` | True or false |

#### Enum

| `oneOf`_(any)_ | Enum types |
| `oneOfType`_(type array)_ | Union |
| Key | Description |
| ------------------------- | ----------- |
| `oneOf`_(any)_ | Enum types |
| `oneOfType`_(type array)_ | Union |

#### Array

| `array` | |
| `arrayOf`_(...)_ | |
| Key | Description |
| ---------------- | ----------- |
| `array` | |
| `arrayOf`_(...)_ | |

#### Object

| `object` | |
| `objectOf`_(...)_ | Object with values of a certain type |
| `instanceOf`_(...)_ | Instance of a class |
| `shape`_(...)_ | |
| Key | Description |
| ------------------- | ------------------------------------ |
| `object` | |
| `objectOf`_(...)_ | Object with values of a certain type |
| `instanceOf`_(...)_ | Instance of a class |
| `shape`_(...)_ | |

#### Elements

| `element` | React element |
| `node` | DOM node |
| Key | Description |
| --------- | ------------- |
| `element` | React element |
| `node` | DOM node |

#### Required

| `(···).isRequired` | Required |
| Key | Description |
| ------------------ | ----------- |
| `(···).isRequired` | Required |

### Basic types

Expand Down

0 comments on commit d4e3421

Please sign in to comment.