I haven't had a chance to do more than plan a few topics to write about here, since I've
been working hard on my textbook. You can now browse the built pages on GitHub
without needing to check out the repo. This is a pretty handy way to publish a website. It's
not particularly attractive yet, but there are two-and-a-half chapters up so far, and more
on the way. I guess those long bus commutes are good for something, right?
In addition to the text, browsing the repo's /js directory will expose a few interesting
AMD modules now that I've started building the interactive parts of the book as well.
Given my plans for various visualizations and live quizzes, I suspect the script package may
be as interesting as the book for a lot of people by the time I'm done. Here's most of what
I've got so far:
- dom/Delay: This module implements lazy-loading for interactives, so that they
don't start running until the specified element is scrolled into view. There's a partner
package to this, dom/Visible, that will enable events for when an element enters or leaves
visibility, but I haven't started that one yet.
- dom/Stage: It's no secret that I hate the Canvas API, so this module
implements a poor man's ActionScript display tree. You can create sprites and textboxes,
and attach them to each other in a heirarchy. Stage also takes care of handling rotation,
translation, and scaling for you, so you only have to express drawing instructions in
terms of local coordinates.
- meta/Evil: An eval() that's relatively safe. It uses a function
constructor to run the code in a safe scope, and adds a "return" statement to the last
line. If it fails to compile or run correctly, it returns an object with an "error"
property. I use this in a lot of the examples so far, and it should be fine as long as the
user doesn't type "while (true);" into the box.
As always, please feel free to file issues and pull requests against the textbook--bearing
in mind that it's a work in progress. The overall structure, which you can see on the table
of contents, parallels my class progression pretty closely, but I'm amenable to shifting
sections around if there's a good argument for it. I'm also thinking about ways to handle
the interactive experience--for example, should inline exercises be hidden behind a link so
that the text flows better? I'm not aware of anyone who's writing the same kind of "live"
teaching document that I am, so this is uncharted territory for us all.