Viewing the examples

There are two routes, and they are for two different readers, so they are listed as two rather than as one with a caveat attached. The published site is for reading the examples; a local server is for working on the page that draws them. Nobody needs both.

1. The published site

Open the example page. Pick a cheatsheet from the first dropdown and an example from the second, and the sheet is composed in the browser. Where an example is a script, the page says so and asks for the console; the script's output - the illustrated examples from the cheat sheet posts - goes there. A cheatsheet that runs nothing is drawn without any of that being mentioned. Nothing is downloaded and nothing is installed.

The address bar follows the selection, so a cheatsheet can be linked to directly. The fragment is the cheatsheet's own path, as in index.html#javascript/arrays/splicing-arrays, and a link naming one that has since been renamed or removed opens the page as though it carried no fragment at all, with the dead slug cleared out of the address bar rather than left there for the reader to copy and pass on.

2. A local server

For anyone changing the page, the catalog or a sheet. Clone the repository, serve the root, and open the address it prints:

php -S localhost:8000

A server is required rather than convenient, and this is the part worth reading twice: the page reads its catalog with fetch and imports the drawing surface as a module, and a browser refuses both to a file:// document. Opening index.html straight from disk does not give a degraded view of the page, it gives a blank one.

Source for examples

The examples used are based on examples from:

  1. Javascript Arrays:

Part of the cheatsheets documentation. The repository is on GitHub, and the example page it documents is here.

Contents