Skip to content

Commit

Permalink
Copyedit minor nits in docs/intro/*.md
Browse files Browse the repository at this point in the history
* Fix minor typos
* Fix missing/broken Markdown
* Use more idiomatic wording and punctuation
  • Loading branch information
japhb committed Nov 27, 2017
1 parent c94eef5 commit 419b93a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions docs/intro/getstarted.md
Expand Up @@ -5,7 +5,7 @@ Here's a list of things to do to get Cro running on your machine.
## Install Perl 6

Cro services are written in Perl 6; if you have not yet installed that,
[see this instructions](https://perl6.org/downloads/). Note that you will
[see these instructions](https://perl6.org/downloads/). Note that you will
need a fairly modern Perl 6; the ones included in packages can be very old.

Provided you install Perl 6 using Rakudo Star, the `zef` module manager will
Expand Down Expand Up @@ -61,7 +61,7 @@ There should now be a page saying 'Hello Cro!' at http://localhost:10000

Congratulations, you have successfully installed Cro!

Now learn more about [building a HTTP service](http-server).
Now learn more about [building an HTTP service](http-server).

## Extra credit: use `cro stub` and `cro run`

Expand Down
2 changes: 1 addition & 1 deletion docs/intro/http-client.md
Expand Up @@ -9,7 +9,7 @@ The simplest `GET` request can be written as:
# Import the client class.
use Cro::HTTP::Client;
# Doing the request
# Make the request
my $resp = await Cro::HTTP::Client.get('https://www.perl6.org/');
```

Expand Down
2 changes: 1 addition & 1 deletion docs/intro/http-server.md
Expand Up @@ -66,6 +66,6 @@ react whenever signal(SIGINT) {
}
```

And the application is up and running, so it's time to improve it: add
With this the application is up and running, so it's time to improve it: add
more logic and use other features. See `Cro::HTTP::Router` and
`Cro::HTTP::Server` to learn more.
30 changes: 15 additions & 15 deletions docs/intro/spa-with-cro.md
Expand Up @@ -30,7 +30,7 @@ So, we'll make a SPA that supports:

* Submitting new tips (a POST to the backend)
* Having the latest tips appear live (delivered over a web socket)
* Being able to agree to disagree with a tip (also a POST)
* Being able to agree or disagree with a tip (also a POST)
* Being able to see a list of the tips sorted most agreeable to most
disagreeable (obtained by a `GET`)

Expand Down Expand Up @@ -244,7 +244,7 @@ bundle.js 2.5 kB 0 [emitted] main

## Serving and using the bundle

Next up, edit `static/index.html`, and just before the closing </body> tag
Next up, edit `static/index.html`, and just before the closing `</body>` tag
add:

```
Expand Down Expand Up @@ -285,7 +285,7 @@ ways we could factor it, but the key thing to keep in mind is that a web
application is a concurrent system, and in Cro requests are processed on a
thread pool. This means two requests may be processed at the same time!

To handle this, we'll use the OO::Monitors module. A monitor is like a class,
To handle this, we'll use the `OO::Monitors` module. A monitor is like a class,
but it enforces mutual exclusion on its methods - that is, only one thread
may be inside the methods on a particular instance at a time. Thus, provided
we don't leak out our internal state (making defensive copies if we do have
Expand Down Expand Up @@ -343,8 +343,8 @@ that, we'll come back to them one at a time.

Next up is to make this available to our routes. We could make the instance in
`Routes.pm6`, but that will make it hard to test our routes in isolation of
the business logic. Instead, we'll make the sub in Routes.pm6 take an instance
of the business logic object as parameter:
the business logic. Instead, we'll make the sub in `Routes.pm6` take an instance
of the business logic object as a parameter:

```
use Cro::HTTP::Router;
Expand Down Expand Up @@ -432,7 +432,7 @@ done-testing;

The first part tests that we can add two tips, and that if we tap the `Supply`
of latest tips then we are given those two straight away. The second part is a
bit more involved: it checks that if we tap the latest tips Supply, and then a
bit more involved: it checks that if we tap the latest tips `Supply`, and then a
new tip is added, then we will also be told about this new tip.

Now to make them pass! Here's the implementation in the `monitor`:
Expand Down Expand Up @@ -477,7 +477,7 @@ a `start` to dispatch the notifications asynchronously.
The `latest-tips` method also needs a little care. Remember that anything we
return from a `monitor` is not protected by the mutual exclusion. Thus, we
should make a copy of the latest existing tips outside of the `supply` block,
while the monitor is protected `%!tips-by-id`. Then, when the returned
while the monitor is protecting `%!tips-by-id`. Then, when the returned
`supply` block is tapped, we subscribe to the latest tips, and then emit each
of the latest existing ones.

Expand Down Expand Up @@ -506,7 +506,7 @@ $ npm install --save-dev babel-loader babel-core babel-preset-es2015 babel-prese
```

Next, we need to create a `.babelrc` file, saying to use this react preset
(babel is the thing used to turn modern JavaScript into browser-compatible
(Babel is the thing used to turn modern JavaScript into browser-compatible
JavaScript). It should simply contain:

```
Expand All @@ -515,7 +515,7 @@ JavaScript). It should simply contain:
}
```

Finally, the `webpack.config.js` needs updating to say to use this. After the
Finally, the `webpack.config.js` needs updates to use this. After the
changes, it should look as follows:

```
Expand Down Expand Up @@ -891,7 +891,7 @@ asynchronous operation starts, which we can use to indicate that on the UI,
and a further one once it has completed, so we can again indicate that the
operation completed in the UI.

First, let's setup `react-thunk`, which is a piece of middleware. Back in
First, let's setup `redux-thunk`, which is a piece of middleware. Back in
`frontend/index.js`, add:

```
Expand All @@ -916,7 +916,7 @@ Finally, change:
let store = createStore(tipsyReducer);
```

To apply the middlware also:
To apply the middleware also:

```
let store = createStore(tipsyReducer, applyMiddleware(thunkMiddleware));
Expand All @@ -937,7 +937,7 @@ Note that this doesn't yet change anything; build it and the behavior should
be just the same. Now that we've done this, however, we can see that it will
be possible to do this dispatch in a callback after the network operation.

There's, of course, dozens of good ways to deal with asynchronous operations
There's of course dozens of good ways to deal with asynchronous operations
in JavaScript, and if you are seriously building single page applications I
strongly recommend looking into using a promise library. There's also Redux
middleware that will integrate with that. For now, we'll do the simplest
Expand Down Expand Up @@ -971,7 +971,7 @@ export function addTip() {
```

Reload it, maybe open your browser's development tools (F12 usually), flip to
the Network tap, and click Add Tip. All being well, you'll observe the request
the Network tab, and click Add Tip. All being well, you'll observe the request
was made and it produced a 204 response. Alternatively, you may like to stop
the `cro run` and instead do `cro trace`; type a message, click Add Tip again,
and you should see the request body dumped in the trace output.
Expand Down Expand Up @@ -1435,7 +1435,7 @@ refactor away in `frontend/index.js`:
});
```

Next, we'll update the dispatch to props map, to incldue our new agree and
Next, we'll update the dispatch to props map, to include our new agree and
disagree actions:

```
Expand Down Expand Up @@ -1491,7 +1491,7 @@ var App = props => (
```

And there we have it. `npm run build`, refresh, and give it a spin. Clicking
agree of disagree in either list ends up with the sort order in the Top Tips
agree or disagree in either list ends up with the sort order in the Top Tips
list changing to reflect the votes.

At last, we're done.
Expand Down

0 comments on commit 419b93a

Please sign in to comment.