Skip to content

Instantly share code, notes, and snippets.

View Daymannovaes's full-sized avatar
🔳
.

Dayman Novaes Daymannovaes

🔳
.
  • Belo Horizonte, MG Brazil
View GitHub Profile
// (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 = [
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, ' '),
// 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'));
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
*
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
*
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.