Skip to content

Instantly share code, notes, and snippets.

@cheery
Created June 25, 2012 10:02
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 cheery/2987746 to your computer and use it in GitHub Desktop.
Save cheery/2987746 to your computer and use it in GitHub Desktop.
web app template
# position into www/index.coffee
getBuffer = (url, response) ->
xhr = new XMLHttpRequest()
xhr.open 'GET', url, true
xhr.responseType = 'arraybuffer'
xhr.onload = response
xhr.send()
$ ->
document.body.innerHTML = "<p>hello there!</p>"
getBuffer 'firmware', () ->
if this.status == 200
window.firmware = new DataView(this.response)
<!-- position into www/index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>web app template</title>
<script src="lib/jquery.min.js"></script><!-- wget http://code.jquery.com/jquery.min.js -->
<script src="index.js"></script>
</head>
<body>
</body>
</html>
#!/usr/bin/env coffee
express = require 'express'
spawn = require('child_process').spawn
compiler = spawn 'coffee', ['-cw', 'www']
compiler.stdout.on 'data', (data) -> process.stdout.write('compiler: ' + data)
app = express.createServer()
app.use express.static('www')
app.listen(8000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment