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 httprequest = require('request'); | |
| var page = 1; | |
| var maxPage = 50; | |
| function performAfterLoadAttempt(error, response, body) { | |
| "use strict"; | |
| //Log the Body | |
| console.log(body); |
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 httprequest = require('request'), | |
| async = require('async'), | |
| requests = [], | |
| page, | |
| maxPage = 50, | |
| url = "http://www.google.com/?p="; | |
| //Callback which each Request hits | |
| function performAfterLoadAttempt(error, response, body) { | |
| "use strict"; |
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 httprequest = require('request'), | |
| async = require('async'), | |
| requests = [], | |
| page, | |
| maxPage = 50, | |
| url = "http://www.google.com/?p="; | |
| //Callback which each Request hits | |
| function performAfterLoadAttempt(error, response, body) { | |
| "use strict"; |
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
| //start.js | |
| require('fs').readdirSync('./config').forEach(function (file) { | |
| require('./config/' + file); | |
| }); | |
| //config/http.js | |
| var container = require('http').createServer(); | |
| container.listen(); | |
| //config/express.js |
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 start = (new Date()).getTime(); | |
| var testArray = ["j","a","b"]; | |
| for( var i = 0; i < 5000000; i++ ) { | |
| if( Array.isArray(testArray) ) {}; | |
| } | |
| console.log( (new Date()).getTime() - start + " ms" ); | |
| start = (new Date()).getTime(); |
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 req = require('request'), | |
| cheerio = require('cheerio'), | |
| async = require('async'), | |
| urls = ["http://google.com/", "http://test.de/", "http://bild.de/"]; | |
| function crawlUrl(url, callback) { | |
| "use strict"; | |
| var array = []; |
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 async = require('async'), | |
| urlIDs = [1, 2, 3], | |
| httprequest = require('request'), | |
| cheerio = require('cheerio'); | |
| async.reduce(urlIDs, [], function (results, item, reduceCallback) { | |
| "use strict"; | |
| console.log("I've iterated " + item + "x"); | |
| process.nextTick(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
| var async = require('async'), | |
| urlIDs = [1, 2, 3], | |
| httprequest = require('request'), | |
| cheerio = require('cheerio'); | |
| async.reduce(urlIDs, [], function (results, item, reduceCallback) { | |
| "use strict"; | |
| console.log("I've iterated " + item + "x"); | |
| process.nextTick(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
| var util = require('util'); | |
| var Stream = require('stream'); | |
| var stream1 = new Stream(); | |
| stream1.readable = stream1.writable = true; | |
| stream1.paused = false; | |
| console.log(util.inspect(stream1, null, true)); | |
| var stream2 = new Stream(); |
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 MuxDemux = require('mux-demux'); | |
| var net = require('net'); | |
| var BufferStream = require("buffer-stream") | |
| function StreamConnection() { | |
| var mdm1 = MuxDemux(); | |
| var con = net.connect(8642); | |
| con.pipe(mdm1).pipe(con); |
OlderNewer