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 http = require('http'), | |
io = require('socket.io'), | |
fs = require('fs'), | |
server = http.createServer(function(req, res){ | |
// your normal server code | |
res.writeHead(200, {'Content-Type': 'text/html'}); | |
res.end(fs.readFileSync('test.html')); | |
}); | |
server.listen(80); |
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
<script src="http://localhost/socket.io/socket.io.js"></script> | |
<script> | |
var socket = new io.Socket('localhost'); | |
socket.connect(); | |
socket.on('connect', function(){ | |
alert("connected"); | |
}) | |
socket.on('message', 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>nowjs test</title> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> | |
<script src="/nowjs/now.js"></script> | |
<script> | |
$(function(){ | |
now.receiveMessage = function(name, message){ |
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
<script src="/socket.io/socket.io.js"></script> | |
<script> | |
var socket = io.connect(); | |
socket.on('a', function(){ | |
//alert(1); | |
}); | |
socket.on('b', function (data) { |
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
<script src="/socket.io/socket.io.js"></script> | |
<script> | |
var i = 0; | |
var socket = io.connect(); | |
socket.on('connect', function(){ | |
setInterval(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
<script src="/socket.io/socket.io.js"></script> | |
<script> | |
var socket = io.connect(); | |
socket.on('connect', function(){ | |
socket.emit('print', 'a'); | |
socket.emit('print', 'b'); | |
}); | |
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
require(['libs/now/0.7.4/now'], function(Now) { | |
Now.pong = function(){ | |
alert('pong!'); | |
} | |
Now.ready(function(){ | |
Now.ping(); | |
}); | |
} |
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
// BAD | |
for (var key in this._workingPeers) { | |
var peer = this._workingPeers[key]; | |
} | |
// GOOD | |
var indices = Object.keys(this._workingPeers); | |
for (var i = 0; i < indices.length; i++) { | |
var peer = this._workingPeers[indices[i]]; | |
} |
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
{#each :card.fields as :card_field} | |
{#if not(equal(:card_field.type, 'score-system'))} | |
<derby:view ns="lui" view=cardFields:{{:card_field.type}}:showCard> | |
{/} | |
{/} |
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
# | |
# as | |
# | |
# When added as attribute to custom directive, exposes the isolate scope of the directive to parent scope | |
# | |
# Attributes: | |
# as: Name to save isolate scope as on parent scope | |
## | |
# Example: | |
### |
OlderNewer