CodeSimulator

CodeSimulator

A Javascript library that creates animated output that looks like code, but isn't really.

It randomly generates code sequences using several base blocks (flow control, variable definition, execution statements, and SQL queries). Good for if you ever need output that looks code-y, but is actually nonsense!

See it in action Download CodeSimulator.js View on Github

Usage

Include Prototype.js and CodeSimulator, then do:

<script src="http://ajax.googleapis.com/ajax/libs/prototype/1.7.1/prototype.js"></script>
<script src="CodeSimulator.js"></script>

<script>
// The DOM element we want to output code to
var code = $("code");

var simulator = new CodeSimulator({output: code});
</script>

Notes & caveats

There are a few things to know about this library:

  • CodeSimulator doesn't generate real code.
  • CodeSimulator mixes up syntax from lots of different languages.

Download CodeSimulator.js View on Github

Contact

Found a bug? Got a question? Or just want to say hello? Find me on Twitter as @craigmunro.