Smooth CoffeeScript

Page 179

Modularity websocket.on 'data', (data) -> show data # process data blue = 'rgba(40,20,255,0.7)' websocket.write JSON.stringify color: if data is '' then blue else data websocket.on 'close', -> show 'closing' process.exit 0 # Exit server completely circ = new cp.CircularPosition 0.01 annoy = setInterval (-> websocket.write JSON.stringify circ.nextPoint()), 20 wsServer = ws.createServer wsHandler wsServer.listen 8080 # Launch test server and client UI require './prelude' viewServer webpage

◦•◦ Through the examples, exercises and explanations you have a foundation for your own projects: a collaborative web application, a multi-user game, a library with an aesthetically pleasing implementation, … First choose what your project is going to be about, then look to github for supporting code and libraries. A couple of interesting ones for web applications are Zappa and SocketStream. If you would like a broader foundation in computer science then read: Concepts, Techniques, and Models of Computer Programming by Peter van Roy and Seif Haridi. Not a word of CoffeeScript, but plenty of insight. Dimidium facti qui coepit habet: sapere aude, incipe He who has begun has half done. Dare to be wise; begin! Quintus Horatius Flaccus

178


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.