Tutorial

FacebookTwitter

Using Node.js and your phone to control a Browser game

http://cykod.com/blog/post/2011-08-using-nodejs-and-your-phone-to-control-a-browser-game This past week I undertook a pretty cool project as the Intern here at Cykod. We were wondering how easily a smart phone –specifically using its gyroscopes and accelerometers– could be used as a controller for a multi-player game on a larger screen. With a bit of Node.js and HTML5 magic, it turned out to be pretty simple. Concept We want to use a desktop (laptop, iPad, etc. something with a bigger screen that multiple players can easily look at) connection to act as the common game space.

Node.js and Redis Pub-Sub

http://howtonode.org/redis-pubsub Static Version This is the 7th in a series of posts leading up to Node.js Knockout on how to use node.js . This post, cross-posted from GitHub , was written by James Bracy , founder of Redis To Go . Redis To Go is a dead simple solution for managed Redis instances.

Creating safe and composable 'mixins' with traits.js

http://howtonode.org/traitsjs Static Version In this article I will introduce traits.js , a small library to define, compose and instantiate traits. Traits are reusable sets of properties and form an alternative to multiple inheritance or mixins.
Learning JS

Capturing Packets in JavaScript with node_pcap

Static Version OK, I hear you. Capturing packets is hard and best left to kernel hackers, assembly language programmers, and black hat security researches. If you just want to make things for the web using node.js, why should you care? Pulling packets off the network can show you what your computers are saying to each other without disrupting the flow of or changing any applications. http://howtonode.org/capturing-packets-in-javascript
http://howtonode.org/intro-to-jake Static Version Jake is a JavaScript build program for Node.js, with capabilities similar to GNU Make or Ruby's Rake. If you've ever built projects with Rake, you'll be very at home using Jake Jake has the following features:

Intro to Jake - JavaScript build tool for Node.js

var http = require ( 'http' ); http . createServer ( function ( request , response ) { var proxy = http . createClient ( 80 , request . headers [ 'host' ]) var proxy_request = proxy . request ( request . method , request . url , request . headers ); proxy_request . addListener ( 'response' , function ( proxy_response ) { proxy_response . addListener ( 'data' , function ( chunk ) { response . write ( chunk , 'binary' ); }); proxy_response . addListener ( 'end' , function () { response . end (); }); response . writeHead ( proxy_response . statusCode , proxy_response . headers ); }); request . addListener ( 'data' , function ( chunk ) { proxy_request . write ( chunk , 'binary' ); }); request . addListener ( 'end' , function () { proxy_request . end (); }); }). listen ( 8080 ); This is just amazing. In 20 lines of node.js code and 10 minutes of time I was able to write a HTTP proxy. http://www.catonmat.net/http-proxy-in-nodejs/

A HTTP Proxy Server in 20 Lines of node.js Code

Introducing node-lazy - lazy lists for node.js

I wrote an awesome node.js module for use at StackVM - a module called node-lazy that does lazy list processing through events! It comes really handy when you need to treat a stream of events like a list. The best use case currently is returning a lazy list from an asynchronous function, and having data pumped into it via events. In asynchronous programming you can't just return a regular list because you don't yet have data for it. http://www.catonmat.net/blog/lazy-lists-javascript-nodejs/
http://tjholowaychuk.com/post/543349452/apachebench-gnuplot-graphing-benchmarks ApacheBench GnuPlot Graphing Benchmarks In this post I am going to be showing you how you can get set up creating http benchmark graphs using Gnuplot and ApacheBench . The ApacheBench or ab executable is packaged with Apache’s httpd, however it can be installed stand-alone as well from Google Code . The Application First things first, below we have an insanely simple NodeJS application, that will respond with the string Hello World , nothing fancy.

TJ Holowaychuk (ApacheBench GnuPlot Graphing Benchmarks)

http://tjholowaychuk.com/post/1160048947/c-indentation-based-language-lexer-tutorial C Indentation Based Language Lexer Tutorial In this tutorial I wanted to show you how you can start your own programming language, starting by creating what is commonly referred to as a lexer or scanner. The grammar for our “language” will be indentation based much like Python , however will implement a tiny subset of tokens for illustration purposes. If you prefer, you may also jump straight to the Source Code .

TJ Holowaychuk (C Indentation Based Language Lexer Tutorial)