修订版 | ac569451f3d0e5a3392e7ab456a56fb3adea1543 (tree) |
---|---|
时间 | 2020-02-13 23:55:05 |
作者 | Erik <erikgronwal@user...> |
Commiter | Erik |
Regular updates
@@ -5,7 +5,7 @@ services: | ||
5 | 5 | volumes: |
6 | 6 | - .:/app |
7 | 7 | - rubygems:/usr/local/bundle |
8 | - - node_modules:/app/node_modules | |
8 | + - ./node_modules:/app/node_modules | |
9 | 9 | ports: |
10 | 10 | - '4001:4001' |
11 | 11 | - '35729:35729' |
@@ -31,7 +31,7 @@ section>p+p+p | ||
31 | 31 | Expands to |
32 | 32 | ```html |
33 | 33 | <section> |
34 | - <p></p> | |
34 | + <pt></p> | |
35 | 35 | <p></p> |
36 | 36 | <p></p> |
37 | 37 | </section> |
@@ -83,7 +83,7 @@ wrap.setState({ show: true }) | ||
83 | 83 | #### Asserting |
84 | 84 | |
85 | 85 | ```js |
86 | -expect(wrap.props('name')).toEqual('Moe') | |
86 | +expect(wrap.prop('name')).toEqual('Moe') | |
87 | 87 | expect(wrap.state('show')).toEqual(true) |
88 | 88 | ``` |
89 | 89 |
@@ -64,12 +64,17 @@ Deletes the branch only if the changes have been pushed and merged with remote. | ||
64 | 64 | git branch -D $branchname |
65 | 65 | ``` |
66 | 66 | |
67 | -Delete a branch irrespective of its merged status. | |
67 | +```bash | |
68 | +git branch -d $branchname | |
69 | +``` | |
70 | + | |
71 | +> Note: You can also use the -D flag which is synonymous with --delete --force instead of -d. This will delete the branch regardless of its merge status. | |
72 | +> Delete a branch irrespective of its merged status. | |
68 | 73 | |
69 | 74 | ### Delete remote branch |
70 | 75 | |
71 | 76 | ```bash |
72 | -git push origin :$branchname | |
77 | +git push origin --delete :$branchname | |
73 | 78 | ``` |
74 | 79 | |
75 | 80 | Works for tags, too! |
@@ -395,6 +395,39 @@ v, ok := <- ch | ||
395 | 395 | |
396 | 396 | See: [Range and close](https://tour.golang.org/concurrency/4) |
397 | 397 | |
398 | +### WaitGroup | |
399 | + | |
400 | +```go | |
401 | +import "sync" | |
402 | + | |
403 | +func main() { | |
404 | + var wg sync.WaitGroup | |
405 | + | |
406 | + for _, item := range itemList { | |
407 | + // Increment WaitGroup Counter | |
408 | + wg.Add(1) | |
409 | + go doOperation(item) | |
410 | + } | |
411 | + // Wait for goroutines to finish | |
412 | + wg.Wait() | |
413 | + | |
414 | +} | |
415 | +``` | |
416 | +{: data-line="1,4,8,12"} | |
417 | + | |
418 | +```go | |
419 | +func doOperation(item string) { | |
420 | + defer wg.Done() | |
421 | + // do operation on item | |
422 | + // ... | |
423 | +} | |
424 | +``` | |
425 | +{: data-line="2"} | |
426 | + | |
427 | +A WaitGroup waits for a collection of goroutines to finish. The main goroutine calls Add to set the number of goroutines to wait for. The goroutine calls `wg.Done()` when it finishes. | |
428 | +See: [WaitGroup](https://golang.org/pkg/sync/#WaitGroup) | |
429 | + | |
430 | + | |
398 | 431 | ## Error control |
399 | 432 | |
400 | 433 | ### Defer |
@@ -17,12 +17,11 @@ This parses the given date using the given format. Returns a moment object. | ||
17 | 17 | ### Formatting |
18 | 18 | |
19 | 19 | ```js |
20 | -m | |
21 | - .format() | |
22 | - .format('dddd') | |
23 | - .format('MMM Do YY') // → "Sep 2nd 07" | |
24 | - .fromNow() // → "31 minutes ago" | |
25 | - .calendar() // → "Last Friday at 9:32PM" | |
20 | +m.format() // "2013-03-01T00:00:00+01:00" | |
21 | +m.format('dddd') // "Friday" | |
22 | +m.format('MMM Do YY') // "Mar 1st 13" | |
23 | +m.fromNow() // "7 years ago" | |
24 | +m.calendar() // "03/01/2013" | |
26 | 25 | ``` |
27 | 26 | |
28 | 27 | ### Add |
@@ -44,7 +44,7 @@ create table(:documents) do | ||
44 | 44 | add :age, :integer |
45 | 45 | add :price, :float |
46 | 46 | add :price, :float, precision: 10, scale: 2 |
47 | - add :published_at, :datetime | |
47 | + add :published_at, :utc_datetime | |
48 | 48 | add :group_id, references(:groups) |
49 | 49 | add :object, :json |
50 | 50 |
@@ -74,13 +74,13 @@ This creates `main.js` and `vendor.js`. | ||
74 | 74 | #### Terminal |
75 | 75 | |
76 | 76 | ```bash |
77 | -npm install -D rollup-plugin-json | |
77 | +npm install -D @rollup/plugin-json | |
78 | 78 | ``` |
79 | 79 | |
80 | 80 | #### rollup.config.js |
81 | 81 | |
82 | 82 | ```js |
83 | -import json from 'rollup-plugin-json' | |
83 | +import json from '@rollup/plugin-json' | |
84 | 84 | |
85 | 85 | export default { |
86 | 86 | input: 'src/main.js', |
@@ -97,12 +97,12 @@ export default { | ||
97 | 97 | |
98 | 98 | #### Terminal |
99 | 99 | ```bash |
100 | -npm install --save-dev rollup-plugin-node-resolve | |
100 | +npm install -D @rollup/plugin-node-resolve | |
101 | 101 | ``` |
102 | 102 | |
103 | 103 | #### rollup.config.js |
104 | 104 | ```js |
105 | -import resolve from 'rollup-plugin-node-resolve' | |
105 | +import resolve from '@rollup/plugin-node-resolve' | |
106 | 106 | |
107 | 107 | export default { |
108 | 108 | input: 'src/main.js', |
@@ -121,13 +121,13 @@ When you run a npm run build, no warning is emitted and contains the imported mo | ||
121 | 121 | #### Terminal |
122 | 122 | |
123 | 123 | ```bash |
124 | -npm install -D rollup-plugin-node-resolve | |
124 | +npm install -D @rollup/plugin-node-resolve | |
125 | 125 | ``` |
126 | 126 | |
127 | 127 | #### rollup.config.js |
128 | 128 | |
129 | 129 | ```js |
130 | -import resolve from 'rollup-plugin-node-resolve' | |
130 | +import resolve from '@rollup/plugin-node-resolve' | |
131 | 131 | |
132 | 132 | export default { |
133 | 133 | input: 'src/main.js', |
@@ -157,7 +157,7 @@ npm install -D rollup-plugin-babel | ||
157 | 157 | #### rollup.config.js |
158 | 158 | |
159 | 159 | ```js |
160 | -import resolve from 'rollup-plugin-node-resolve' | |
160 | +import resolve from '@rollup/plugin-node-resolve' | |
161 | 161 | import babel from 'rollup-plugin-babel' |
162 | 162 | |
163 | 163 | export default { |
@@ -15,7 +15,7 @@ category: CLI | ||
15 | 15 | $ tmux new -s session_name |
16 | 16 | |
17 | 17 | $ tmux attach # Default session |
18 | - $ tmux attach -s session_name | |
18 | + $ tmux attach -t session_name | |
19 | 19 | |
20 | 20 | $ tmux switch -t session_name |
21 | 21 |
@@ -49,6 +49,7 @@ category: CLI | ||
49 | 49 | C-b hkjl # navigation |
50 | 50 | C-b HJKL # resize |
51 | 51 | C-b o # next window |
52 | + C-b q # show pane numbers | |
52 | 53 | C-b x # close pane |
53 | 54 | |
54 | 55 | C-b { or } # move windows around |
@@ -45,7 +45,7 @@ Getting started | ||
45 | 45 | | Shortcut | Description | |
46 | 46 | | --- | --- | |
47 | 47 | | `b` _/_ `w` | Previous/next word | |
48 | -| `e` _/_ `ge` | Previous/next end of word | | |
48 | +| `ge` _/_ `e` | Previous/next end of word | | |
49 | 49 | {: .-shortcuts} |
50 | 50 | |
51 | 51 | #### Line |