Permalink
Browse files

delete terrible examples

  • Loading branch information...
1 parent 3b759b3 commit 1379ed40de8e3deef9ca2dd25e6192dfd055e690 @substack committed Jun 21, 2012
@@ -1,21 +0,0 @@
-var dnode = require('dnode');
-
-var client = dnode({
- // Compute the client's temperature and stuff that value into the callback
-
- temperature : function (cb) {
- var degC = Math.round(20 + Math.random() * 10 - 5);
- console.log(degC + '° C');
- cb(degC);
- }
-});
-
-client.connect(6060, function (remote, conn) {
- // Call the server's conversion routine, which polls the client's
- // temperature in celsius degrees and converts to fahrenheit
-
- remote.clientTempF(function (degF) {
- console.log(degF + '° F');
- conn.end(); // all done!
- });
-});
@@ -1,12 +0,0 @@
-var dnode = require('dnode');
-
-dnode(function (client) {
- // Poll the client's own temperature() in celsius and convert that value to
- // fahrenheit in the supplied callback
- this.clientTempF = function (cb) {
- client.temperature(function (degC) {
- var degF = Math.round(degC * 9 / 5 + 32);
- cb(degF);
- });
- };
-}).listen(6060);
View
@@ -1,16 +0,0 @@
-<script type="text/javascript" src="/dnode.js"></script>
-<script type="text/javascript">
- DNode({
- name : function (f) { f('Mr. Spock') }
- }).connect({ secure : true }, function (remote) {
- remote.timesTen(10, function (n) {
- document.getElementById("result").innerHTML = String(n);
- });
- remote.whoAmI(function (name) {
- document.getElementById("name").innerHTML = name;
- });
- });
-</script>
-
-<p>timesTen(10) == <span id="result">?</span></p>
-<p>My name is <span id="name">?</span>.</p>
View
@@ -1,50 +0,0 @@
-var https = require('https');
-var fs = require('fs');
-var dnode = require('dnode');
-
-try {
- var opts = {
- key : fs.readFileSync(__dirname + '/privatekey.pem'),
- cert : fs.readFileSync(__dirname + '/certificate.pem'),
- };
-}
-catch (e) {
- console.log('# {privatekey,certificate}.pem missing, do this first:');
- console.log('openssl genrsa -out privatekey.pem 1024');
- console.log('openssl req -new -key privatekey.pem -out certrequest.csr');
- console.log('openssl x509 -req -in certrequest.csr '
- + '-signkey privatekey.pem -out certificate.pem');
- process.exit();
-}
-
-var index = fs.readFileSync(__dirname + '/index.html');
-var server = https.createServer(opts, function (req, res) {
- if (req.url === '/') {
- res.writeHead(200, { 'Content-Type' : 'text/html' });
- res.end(index);
- }
- else if (!res.finished) {
- process.nextTick(function () {
- if (!res.finished) {
- res.writeHead(404, { 'Content-Type' : 'text/html' });
- res.end('Not found!');
- }
- });
- }
-});
-
-dnode(function (client) {
- this.timesTen = function (n,f) { f(n * 10) };
- this.whoAmI = function (reply) {
- client.name(function (name) {
- reply(name
- .replace(/Mr\.?/,'Mister')
- .replace(/Ms\.?/,'Miss')
- .replace(/Mrs\.?/,'Misses')
- );
- })
- };
-}).listen(server);
-server.listen(8020);
-
-console.log('https://localhost:8020/');
View
@@ -1,15 +0,0 @@
-var frames = 0, last = 0;
-setInterval(function () {
- if (last) {
- var fps = frames / (Date.now() - last) * 1000;
- console.log('fps: ' + fps);
- }
-
- last = Date.now();
- frames = 0;
-}, 1000);
-
-var dnode = require('dnode');
-dnode({
- emit : function (i) { frames ++ }
-}).connect(7575);
View
@@ -1,20 +0,0 @@
-var dnode = require('dnode');
-var EventEmitter = require('events').EventEmitter;
-
-var clients = {};
-setInterval(function () {
- Object.keys(clients).forEach(function (id) {
- var i = Math.floor(Math.random() * Math.pow(2,32));
- clients[id].emit(i);
- });
-}, 1000 / 50); // 50 fps
-
-dnode(function (client, conn) {
- conn.on('ready', function () {
- clients[conn.id] = client;
- });
-
- conn.on('end', function () {
- delete clients[conn.id];
- });
-}).listen(7575);
@@ -1,19 +0,0 @@
-<html>
-<head>
-<script src="/browserify.js" type="text/javascript"></script>
-<script type="text/javascript">
- var dnode = require('dnode');
-
- window.onload = function () {
- dnode.connect(function (remote, conn) {
- remote.cat(function (says) {
- document.getElementById('says').innerHTML = says;
- });
- });
- };
-</script>
-</head>
-<body>
- The cat says <span id="says">?</span>.
-</body>
-</html>
@@ -1,21 +0,0 @@
-var connect = require('connect');
-var browserify = require('browserify');
-var dnode = require('dnode');
-
-var server = connect.createServer();
-
-server.use(connect.static(__dirname));
-
-server.use(browserify({
- require : 'dnode',
- mount : '/browserify.js'
-}));
-
-dnode(function (client) {
- this.cat = function (cb) {
- cb('meow');
- };
-}).listen(server);
-
-server.listen(6857);
-console.log('http://localhost:6857/');
@@ -1,17 +0,0 @@
-<html>
-<head>
-<script src="/dnode.js" type="text/javascript"></script>
-<script type="text/javascript">
- window.onload = function () {
- DNode.connect(function (remote) {
- remote.cat(function (says) {
- document.getElementById('says').innerHTML = says;
- });
- });
- };
-</script>
-</head>
-<body>
-The cat says <span id="says">?</span>.
-</body>
-</html>
@@ -1,14 +0,0 @@
-var connect = require('connect');
-var dnode = require('dnode');
-
-var server = connect.createServer();
-server.use(connect.static(__dirname));
-
-dnode(function (client) {
- this.cat = function (cb) {
- cb('meow ');
- };
-}).listen(server);
-
-server.listen(6857);
-console.log('http://localhost:6857/');
@@ -1,17 +0,0 @@
-<html>
-<head>
-<script src="/dnode.js" type="text/javascript"></script>
-<script type="text/javascript">
- window.onload = function () {
- DNode.connect(function (remote) {
- remote.cat(function (says) {
- document.getElementById('says').innerHTML = says;
- });
- });
- };
-</script>
-</head>
-<body>
-The cat says <span id="says">?</span>.
-</body>
-</html>
@@ -1,14 +0,0 @@
-var express = require('express');
-var server = express.createServer();
-var dnode = require('dnode');
-
-server.use(express.static(__dirname));
-
-dnode(function (client) {
- this.cat = function (cb) {
- cb('meow');
- };
-}).listen(server);
-
-server.listen(6857);
-console.log('http://localhost:6857/');
@@ -1,17 +0,0 @@
-<html>
-<head>
-<script src="/dnode.js" type="text/javascript"></script>
-<script type="text/javascript">
- window.onload = function () {
- DNode.connect(function (remote) {
- remote.cat(function (says) {
- document.getElementById('says').innerHTML = says;
- });
- });
- };
-</script>
-</head>
-<body>
-The cat says <span id="says">?</span>.
-</body>
-</html>
View
@@ -1,21 +0,0 @@
-var http = require('http');
-var fs = require('fs');
-var dnode = require('dnode');
-
-var index = fs.readFileSync(__dirname + '/index.html');
-
-var server = http.createServer(function (req, res) {
- if (req.url === '/') {
- res.writeHead(200, { 'Content-Type' : 'text/html' });
- res.end(index);
- }
-});
-
-dnode(function (client) {
- this.cat = function (cb) {
- cb('meow');
- };
-}).listen(server);
-
-server.listen(6857);
-console.log('http://localhost:6857/');
File renamed without changes.
File renamed without changes.

0 comments on commit 1379ed4

Please sign in to comment.