a list of slides from nodeconf
you may want to take a look at the jsconf-gist too!
| /** | |
| * Manages connections to hosts. | |
| * | |
| * @param {String} uri | |
| * @Param {Boolean} force creation of new socket (defaults to false) | |
| * @api public | |
| */ | |
| io.connect = function (host, details) { | |
| var uri = io.util.parseUri(host) |
| <script src="/socket.io/socket.io.js"></script> | |
| <script> | |
| var socket = io.connect(); | |
| socket.on('a', function(){ | |
| //alert(1); | |
| }); | |
| socket.on('b', function (data) { |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
a list of slides from nodeconf
you may want to take a look at the jsconf-gist too!
| au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery | |
| set nocompatible | |
| set autoindent | |
| set tabstop=2 | |
| set showmatch | |
| set vb t_vb= | |
| set ruler | |
| set nohls | |
| set incsearch | |
| syntax on |
| // IE7 support for querySelectorAll in 226 bytes... It's a little slow but better than a 20kb solution when you need something cross platform and lightweight. | |
| (function(d){d=document,a=d.styleSheets[0]||d.createStyleSheet();d.querySelectorAll=function(e){a.addRule(e,'f:b');for(var l=d.all,b=0,c=[],f=l.length;b<f;b++)l[b].currentStyle.f&&c.push(l[b]);a.removeRule(0);return c}})() |
| /** | |
| * Module dependencies. | |
| */ | |
| var inspect = require('sys').inspect; | |
| console.inspect = function(obj, depth){ | |
| if (!obj) return; |
| var detectBackOrForward = function(onBack, onForward) { | |
| hashHistory = [window.location.hash]; | |
| historyLength = window.history.length; | |
| return function() { | |
| var hash = window.location.hash, length = window.history.length; | |
| if (hashHistory.length && historyLength == length) { | |
| if (hashHistory[hashHistory.length - 2] == hash) { | |
| hashHistory = hashHistory.slice(0, -1); | |
| onBack(); |
| #!/usr/bin/env node | |
| var http = require('http') | |
| , webapp = require('webapp'); | |
| http.createServer(webapp.bind([])).listen(8000); | |
| // ^^^^^^^^^^^^^^^ | |
| // | (x) | |
| // ROFLSCALE DEQUE ---/ |
| Black: 0, 0, 0 | |
| Red: 229, 34, 34 | |
| Green: 166, 227, 45 | |
| Yellow: 252, 149, 30 | |
| Blue: 196, 141, 255 | |
| Magenta: 250, 37, 115 | |
| Cyan: 103, 217, 240 | |
| White: 242, 242, 242 |