This file contains hidden or 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
<h3>Beards grown this week: <span id='downloads' class='fa fa-circle-o-notch fa-spin'></span></h3> |
This file contains hidden or 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
module.exports = "While you wait, how about some tasty bacon?\n\n"+ | |
" __ _.._ \n"+ | |
" .-'__`-._.'.--.'.__., \n"+ | |
" /--' '-._.' '-._./ \n"+ | |
" /__.--._.--._.'``-.__/ \n"+ | |
" '._.-'-._.-._.-''-..' \n"+ | |
"\n"; |
This file contains hidden or 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
ws.prototype.sendJson = function(data, options, callback) { | |
this.send.call(this, JSON.stringify(data), options, callback); | |
}; |
This file contains hidden or 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 net = require('net'); | |
var server = net.createServer(); | |
server.on('connection', function(socket) { | |
console.log('connected!'); | |
var start = Math.floor(new Date().getTime()/1000); | |
socket.readings = {}; |
This file contains hidden or 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
/* npm insatll -g mocha | |
* npm install express | |
* node ./<this> | |
* put tests in ./test/ and they can be called by hitting http://localhost:3030/test/:file | |
* you can test all tests by hitting http://localhost:3030/test/all | |
*/ | |
var express = require('express'), | |
app = express(); | |
var spawn = require('child_process').spawn; |
This file contains hidden or 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
[ 0, 1, 2, 3, 4, 5 ].forEach(function(y) { var z = --y || 'wut!?'; console.log(z); }) | |
/* output: | |
-1 | |
"wut!?" | |
1 | |
2 | |
3 | |
4 | |
*/ |
This file contains hidden or 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
/* http://en.wikipedia.org/wiki/Varan */ | |
var Faye = require('faye'), | |
express = require('express'), | |
ping = require('ping'); | |
var bayeux = new Faye.NodeAdapter({ mount: '/faye', timeout: 45 }), | |
client = bayeux.getClient(), | |
app = express(); | |
app.configure(function() { |
This file contains hidden or 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
/**************************************************************************** | |
* Inspired by https://github.com/joshuah/insert-coin/blob/master/printer.js * | |
****************************************************************************/ | |
var net = require('net'); | |
var printers = [ | |
{ ip: '192.168.1.10', lcdRows: 2, lcdCols: 16 } | |
]; |
This file contains hidden or 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 config = fs.readFileSync('configFile.txt').toString(); | |
var interfaces = config.match(/interface .+[\r]*\n [\s\S]+?[^\ ]!/g); | |
console.log(interfaces): | |
/* | |
[ | |
"interface Vlan1\n description ...\n!", | |
"interface Vlan2\n description ...\n!", | |
... |
This file contains hidden or 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
/********************************************/ | |
/* insert random delays to simulate latency */ | |
/********************************************/ | |
function delay(callback, n) { | |
var r = Math.floor(Math.random()*(n || 5000)); | |
setTimeout(function() { callback(); }, r); | |
} | |
// specify a max on the delay timer range | |
delay(function() { console.log('BLARGH!'); }, 10000); |