a list of slides from nodeconf
you may want to take a look at the jsconf-gist too!
a list of slides from nodeconf
you may want to take a look at the jsconf-gist too!
The idea is to have nginx installed and node installed. I will extend this gist to include how to install those as well, but at the moment, the following assumes you have nginx 0.7.62 and node 0.2.3 installed on a Linux distro (I used Ubuntu).
In a nutshell,
So for example, www.foo.com request comes and your css, js, and images get served thru nginx while everything else (the request for say index.html or "/") gets served through node.
| var sys = require('sys'), | |
| fs = require('fs'), | |
| Url = require('url'), | |
| http = require('http'), | |
| querystring = require('querystring'); | |
| //create a Heatmap Obj that inherits | |
| //from EventEmitter | |
| var events = require('events'); |
| // helper function that goes inside your socket connection | |
| client.connectSession = function(fn) { | |
| var cookie = client.request.headers.cookie; | |
| var sid = unescape(cookie.match(/connect\.sid=([^;]+)/)[1]); | |
| redis.get(sid, function(err, data) { | |
| fn(err, JSON.parse(data)); | |
| }); | |
| }; | |
| // usage |
| function getClientAddress(req) { | |
| return req.headers['x-forwarded-for'] || req.connection.remoteAddress; | |
| } |
| var cron = require('./cron'), sys = require('sys'); | |
| cron.Every((2).seconds(), function() { sys.puts('Working!'); }); |
| #!/usr/bin/env ruby | |
| # Aside from removing Ruby on Rails specific code this is taken verbatim from | |
| # mislav's git-deploy (http://github.com/mislav/git-deploy) and it's awesome | |
| # - Ryan Florence (http://ryanflorence.com) | |
| # | |
| # Install this hook to a remote repository with a working tree, when you push | |
| # to it, this hook will reset the head so the files are updated | |
| if ENV['GIT_DIR'] == '.' |
#Four Ways To Do Pub/Sub With jQuery 1.7 and jQuery UI (in the future)
Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.
(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)
##Option 1: Using jQuery 1.7's $.Callbacks() feature:
The idea is to have nginx installed and node installed. I will extend this gist to include how to install those as well, but at the moment, the following assumes you have nginx 0.7.62 and node 0.2.3 installed on a Linux distro (I used Ubuntu).
In a nutshell,
So for example, www.foo.com request comes and your css, js, and images get served thru nginx while everything else (the request for say index.html or "/") gets served through node.