Skip to content

Instantly share code, notes, and snippets.

View andrefa's full-sized avatar

André andrefa

  • Vancouver, Canada
View GitHub Profile
const got = require('got');
const jsdom = require("jsdom");
const { JSDOM } = jsdom;
const cgUrl = 'https://vancouver.craigslist.org/search/van/apa?search_distance=4&postal=V6E1W5&min_bedrooms=2&minSqft=600&availabilityMode=0&pets_cat=1&laundry=1&sale_date=all+dates';
const pageSize = 120;
const find = (element, expression) => element.querySelector(expression) || {}
const list = (element, expression) => [...element.querySelectorAll(expression)]
const fs = require('fs')
const path = require('path')
const voidFn = () => {}
class Utils {
constructor() {
this.gitignoreFileName = '.gitignore'
}
// FUNCTION DEFINITION
function triggerDragAndDrop(selectorDrag, selectorIframe, selectorDrop) {
// function for triggering mouse events
var fireMouseEvent = function (type, elem, centerX, centerY) {
var evt = document.createEvent('MouseEvents');
evt.initMouseEvent(type, true, true, window, 1, 1, 1, centerX, centerY, false, false, false, false, 0, elem);
elem.dispatchEvent(evt);
};
// fetch target elements
#!/usr/bin/env python
naturals = 0
squares = 0
for i in xrange(101):
naturals += i
squares += i*i
naturals_square = naturals * naturals
@andrefa
andrefa / bovespa.py
Created July 11, 2016 12:39
Lista todas as acoes da bovespa, delay de 15 minutos.
from lxml import html
import requests
separator = '\t'
csv = open('stocks.csv', 'w+')
csv.write(
'NAME' + separator
+'DESC' + separator
+'PRICE' + separator