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
{ | |
"meta": { | |
"protocol": 48, | |
"version": "1.4.3" | |
}, | |
"00": { | |
"name": "Keep Alive", | |
"source": "B", | |
"structure": [ | |
["int","keepAliveId"] |
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 net = require("net"); | |
var port = 25560; // the port it listens to | |
var target_host = "127.0.0.1"; // the host that receives the data | |
var target_port = 25575; // the port that receives the data | |
server = net.createServer(function(socket){ | |
socket.pause() | |
var target = net.connect(target_port, target_host, function(){ | |
socket.resume() | |
socket.on("data", 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
function parseTime(time){ | |
time = time.split(/(\,([ ]*and[ ]*)?|\;)/g); | |
var ms = 0; | |
for(var i = 0; i < time.length; i++){ | |
var measure = time[i].trim(); | |
switch(true){ | |
case measure.search(/years?$/)>=0: ms+=parseFloat(measure, 10)*1000*60*60*24*365; break; | |
case measure.search(/months?$/)>=0: ms+=parseFloat(measure, 10)*1000*60*60*24*30; break; | |
case measure.search(/weeks?$/)>=0: ms+=parseFloat(measure, 10)*1000*60*60*24*7; break; | |
case measure.search(/days?$/)>=0: ms+=parseFloat(measure, 10)*1000*60*60*24; break; |
NewerOlder