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
// (x, y) | |
let stepActionByType = { | |
'down': [0, 1], | |
'left down': [-1, 1], | |
'left up': [-1, 0], | |
'up': [0, -1], | |
'right up': [1, -1], | |
'right down': [1, 0] | |
}; | |
let stepTypeOrder = [ |
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://mg.olx.com.br/belo-horizonte-e-regiao/eletrodomesticos?f=p&pe=1200&ps=800&q=geladeira | |
results = $('#main-ad-list li:not(.list_native)').map((a, i) => { | |
let $f = $(i).find.bind($(i)); | |
return { | |
href: $f('a')[0].href, | |
title: $f('h3').text().trim(), | |
price: $f('.OLXad-list-price').text().trim().replace(/R\$ ?/, '').replace(/\./, ','), | |
region: $f('.detail-region').text().trim().replace(/\n/g, '').replace(/\t/g, '').replace(/ +/g, ' '), |
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
// first run npm install -g request | |
function requestFile(url, callback) { | |
return require('request').get(url, callback); | |
} | |
let url = 'https://www.google.com.br/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png'; | |
// stream test | |
requestFile(url).pipe(require('fs').createWriteStream('image-stream.png')); |
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 output = ""; | |
/** | |
* EXPLAINING | |
* | |
* The 'output' var holds the string with the generated output, | |
* which should be used as INPUT in the PA | |
* | |
* HOW TO USE | |
* |
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 output = ""; | |
/** | |
* EXPLAINING | |
* | |
* The 'output' var holds the string with the generated output, | |
* which should be used as INPUT in the PA | |
* | |
* HOW TO USE | |
* |
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 output = ""; | |
var rateCovered = 0.2; | |
/** | |
* EXPLAINING | |
* | |
* The 'output' var holds the string with the generated output, | |
* which should be used as INPUT in the PA | |
* | |
* the 'rateCovered' var holds the chance of a square not be a tip. |
NewerOlder