This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Server | |
var express = require('express'); | |
var fs = require('fs'); | |
var app = express(); | |
var server = require('http').createServer(app).listen(5000); | |
var bus = require('bus.io')(server); | |
//you don't have to listen to connection event unless you like | |
bus.io().on('connection', function(socket) { | |
console.log(socket.id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Create a Simple Server with Bus.io and Socket.io-Client */ | |
//on the server (be sure to have redis running locally!) | |
var bus = require('bus.io')(3000); | |
//on the client | |
var socket = require('socket.io-client')('http://localhost:30000'); | |
socket.on('connect', function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var queryString = function(queryStr) { | |
this._query = []; | |
queryStr = queryStr || window.location.search.substr(1); | |
var pairs = queryStr.split("&"); | |
for(var i in pairs) { | |
var keyval = pairs[i].split("="); | |
this._query[keyval[0]] = keyval[1]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>LazyLoading Test</title> | |
<script> | |
var AsyncLoader = function(src, cb) { | |
var s = document.createElement('script'); | |
s.type = 'text/javascript'; | |
s.async = true; | |
s.src = src + '?=' + Math.random(); // make sure we are loading this once | |
if(typeof(cb) == 'function') { |