Skip to content

Instantly share code, notes, and snippets.

@deleteme
Forked from anonymous/snippet.txt
Created December 2, 2008 23:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deleteme/31340 to your computer and use it in GitHub Desktop.
Save deleteme/31340 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>All work and no play makes Jack a dull boy.</title>
<style type="text/css" media="screen">
#paper {
font-family: monospace;
font-size: 18px;
margin: 300px auto 0 auto;
width: 470px;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js"></script>
<script type="text/javascript">
var DyingProgrammer = new Class.create({
initialize: function(){
this.phrase = 'All work and no play makes Jack a dull boy. ';
this.phraseSplit = this.phrase.split('');
this.delayRange = $A($R(1, 3));
this.i = 0;
document.observe('dom:loaded', this.work.bind(this));
},
work: function(){
this.paper = $('paper');
this.type();
},
type: function(){
this.paper.insert(this.phraseSplit[this.i]);
this.type.bind(this).delay(Math.ceil(this.delayRange.length * Math.random()) / 10);
this.i++;
if (this.i > this.phraseSplit.length) this.i = 0;
}
});
var matt = new DyingProgrammer();
</script>
</head>
<body>
<p id="paper"></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment