Skip to content

Instantly share code, notes, and snippets.

@cclough
cclough / gist:3736696
Created September 17, 2012 10:59
ls -a -R -l
cclough:rsj christian [master] $ls -a -R -l
total 56
drwxr-xr-x 9 christian staff 306 17 Sep 11:33 .
drwxr-xr-x 11 christian staff 374 17 Sep 11:55 ..
-rw-r--r-- 1 christian staff 6148 17 Sep 11:25 .DS_Store
drwxr-xr-x 14 christian staff 476 17 Sep 10:10 .git
-rw-r--r-- 1 christian staff 12 16 Sep 14:41 .gitignore
-rw-r--r-- 1 christian staff 21 16 Sep 14:05 Procfile
-rw-r--r-- 1 christian staff 1261 17 Sep 10:40 index.html
-rw-r--r--@ 1 christian staff 261 17 Sep 11:57 package.json
@cclough
cclough / gist:3728356
Created September 15, 2012 14:54
Client
<script src="/socket.io/socket.io.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
var socket = io.connect();
// on connection to server, ask for user's name with an anonymous callback
socket.on('connect', function(){
// call the server-side function 'adduser' and send one parameter (value of prompt)
socket.emit('adduser', prompt("What's your name?"));
});
@cclough
cclough / gist:3728355
Created September 15, 2012 14:54
Server
var app = require('express').createServer()
var io = require('socket.io').listen(app);
app.listen(8080);
// routing
app.get('/', function (req, res) {
res.sendfile(__dirname + '/index.html');
});
@cclough
cclough / gist:3728181
Created September 15, 2012 14:23
package.json for roulette_server@cclough
{
"name": "roulette_server",
"description": "example chat application with socket.io",
"version": "0.0.1-1",
"dependencies": {
"express": "2.4.6",
"socket.io": "0.8.4"
},
"subdomain": "cclough.roulette_server",
"scripts": {