Tree: Visualizing File Structures with JavaScript

Sometimes it is useful to be able to see the structure of a directory of files in an intuitive way, such as a tree visualization. Unfortunately, many of the available tools for doing to must be downloaded and installed, which takes time and is sometimes a more complicated and risky endeavor than one would hope … Read moreTree: Visualizing File Structures with JavaScript


Sometimes when I need a certain functionality when programming, the best solution is to use a pre-existing library. Instead of coding something myself, which could take dozens of hours, it is likely that someone else has already done the same thing better. But sometimes, even with the vast resources available on the internet, it is … Read moremicronotes

100 Posts on OnlyOnesAndZeros – Behind the Scenes

I recently celebrated 100 posts on OnlyOnesAndZeros and created this post analyzing the posts I have written so far and sharing some statistics about them. Here’s how I did it. First, I used a WordPress plugin called WordPress Exporter to perform a custom XML export of the 100 posts that I have published so far. If you’re … Read more100 Posts on OnlyOnesAndZeros – Behind the Scenes

Web – Another JavaScript Program

Note: I’m now doing posts with previews on the home page instead of the full text. If you think a post is going to be interesting, you can click “Read more” (or the post’s title) to read the full post. If you don’t think it’s going to be interesting, then you can still read the post, but you might not like it. I think they’re all pretty interesting, but I may be biased (possibly because I wrote them all). Previous posts that I haven’t written descriptions for (and don’t plan to, at least in the near future) will just display the first few words of the post before the “Read more” link. On future posts, instead of this, you’ll see a description of what the post is actually about, something like this:

This is a program that creates nice-looking (at least in my opinion) “webs” using JavaScript and the HTML5 canvas. It creates random “nodes” and then connects them with bézier curves. You can also customize the way the webs look, so that’s pretty cool, I guess.

Read moreWeb – Another JavaScript Program

Some Fun with Bookmarklets and the Contenteditable HTML Attribute

Introduction ooh, new fancy section header title things (you’re welcome) I know it’s been a while since I posted last1, and I’m going to try to post more frequently. I just have a lot of unfinished projects that I didn’t really feel were ready. With that out of the way, I have something interesting to … Read moreSome Fun with Bookmarklets and the Contenteditable HTML Attribute

Conway’s Game of Life

Conway's game of life simulation

Conway’s Game of Life is a simulation of cells interacting with other cells, or an example of cellular automata. White squares represent dead cells, and black squares represent live cells. There a few simple rules governing the universe:

  • Any cell with less than 2 neighbors dies from loneliness
  • Any cell with over 3 neighbors dies from overpopulation
  • Any cell with 2 or 3 neighbors stays alive
  • Any dead cell with exactly 3 neighbors can become alive (through reproduction)

The simulation is performed using these rules, which are repeated over and over on the entire grid. These simple rules can lead to extraordinarily complex systems. Most systems, however, (especially random ones) will eventually collapse into unmoving shapes or simple oscillators. I created a version of Life in JavaScript using the HTML5 canvas. A 2-dimensional array stores the grid of squares. You can run it here or see the code here. The simulation is completed in a “closed” universe, where I have border cells (not shown on the screen) on the edges to prevent calculation errors with cells missing neighbors. These cells are always white and have no calculations performed on them. The program I wrote is not interactive, as I just wanted to see if I could make a version of Life using JavaScript. I might make an interactive one in the future, but for now I would recommend this simulation that I have been using. My programs starts with half of the cells alive (randomly selected) and eventually stabilizes. If you refresh, the simulation will restart.

JavaScript “Dust” With Distance-Based Probabilities

I recently wrote a program in JavaScript that generates “dust” by picking a random pixel on the screen, then deciding randomly whether to shade it in or not. The farther away the pixel is from a certain point (in this case, (700, 350)), the lower the chance it will be shaded in. To determine the … Read moreJavaScript “Dust” With Distance-Based Probabilities