javascript

A Clock, using D3.js

Hey, look! I made a clock! The Apple Watch is now obsolete.

I am learning how to use the D3.js library to do data visualizations. It doesn't really make sense to consider hour, minute, and second as data to be "visualized", but this was a simple exercise to learn how to create graphical elements and animate them as the data changes.

If you're interested, you can click the JavaScript, CSS, and HTML links at the top to see exactly how it is implemented. (Note that JSFiddle is magically importing the D3 library, so you don't see that in the HTML.)

Here is another way to view the clock along with its source: http://bl.ocks.org/kristopherjohnson/1db0d39a9ed54d224ee7

Node.js Cheatsheet

I am learning about node.js. This is my cheatsheet. It may not be useful to you at all.

Also see My JavaScript Cheatsheet.

My JavaScript Cheatsheet

A couple of times per year, I have to work on something that requires me to write some JavaScript. When I do, I have to reacquaint myself with the language by skimming through JavaScript: The Good Parts and finding some good online reference documentation.

In an effort to reduce the time needed to do this next time, I'm recording the little things that I ran across that I didn't remember or wished I could have found faster. So this is my own personal refresher for JavaScript. It may not help you at all.

Also see my Node.js Cheatsheet.

Reference Links

JacksOrBetter as a Web App

A little over a year ago, I created my first iPhone app, JacksOrBetter. As an exercise in learning CSS, JavaScript, and jQuery, I've created a web-based version of JacksOrBetter.

Quick-and-Dirty Guide to QUnit

I'm playing around with JavaScript in my spare time, and have started creating a web app. As I usually do, particularly when learning something new, I am using a test-driven development approach. I looked at a few JavaScript unit-testing frameworks, and decided to go with QUnit, the testing framework used by the jQuery project.

QUnit isn't too hard to set up or use, but my unfamiliarity with JavaScript, jQuery, and related things meant it took a little more work than it should have. A few out-of-date QUnit tutorials on the web made things worse. So, here is a quick-and-dirty QUnit tutorial that might be helpful for others who are the same boat that I was in.

JavaScript: The Good Parts

As a result of the recent hubbub about web apps, I decided to get myself up to speed on JavaScript and CSS. Knowing Douglas Crockford's reputation as the JavaScript guru, I read his book, entitled JavaScript: The Good Parts.

It's a good book. The basic idea is that while JavaScript is actually a pretty cool little programming language, it has a lot of features that are best not used, and it has many outright flaws, so Crockford presents a recommended subset of the language.

The most valuable parts of the book are appendices A and B, entitled "Awful Parts" and "Bad Parts", respectively. These appendices list the gotchas of JavaScript and present rationale for leaving certain constructs out of the recommended subset.

My only gripe with the book is that, while it is presented as an introductory book, it seems to assume some previous knowledge and experience with JavaScript. I got a bit lost in some parts, particularly those regarding prototypes, the new keyword, and how this gets bound in various situations. (I was able to eventually figure these things out with a bit of Googling.) It also assumes some experience with functional programming, which is OK with me, but which will probably confuse a lot of introductory readers.

So, while I can enthusiastically recommend the book, I think I'd recommend it as a second JavaScript book.

Syndicate content