View index.js
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 tress = require('tress'); | |
var needle = require('needle'); | |
var cheerio = require('cheerio'); | |
var resolve = require('url').resolve; | |
var fs = require('fs'); | |
var URL = 'http://www.ferra.ru/ru/techlife/news/'; | |
var results = []; | |
var q = tress(function(url, callback){ |
View vanilla_index.js
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 index(item, collection) { | |
return [].slice.call(document.querySelectorAll(collection)).indexOf(document.querySelector(item)); | |
} | |
console.log(index('#item', '.collection')); |
View react-redux-bp.js
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
//ACTION_CREATORS | |
const actions = { | |
setText: function(text){ | |
return{ | |
type: 'SET_TEXT', | |
text: text | |
} | |
}, | |
inc: function(){ |
View icrawler-ferra.js
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 icrawler = require('icrawler'); | |
var fs = require('fs'); | |
var URL = 'http://www.ferra.ru/ru/techlife/news/'; | |
var opts = { | |
errorsFirst: true, | |
concurrency: 10, | |
saveOnFinish: false, | |
saveOnCount: 500, |
View win-ctrl-c-graceful-shutdown.js
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
if (process.platform === 'win32') { | |
require('readline') | |
.createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}) | |
.on('SIGINT', function () { | |
process.emit('SIGINT'); | |
}); | |
} |
View sha256.js
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 crypto = require('crypto'); | |
module.exports = function (obj){ | |
var str = JSON.stringify(obj); | |
return crypto.createHash('sha256').update(str).digest('base64'); | |
}; |
View SimpleHTTPServer
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
$python -m SimpleHTTPServer 8000 |