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
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)] |
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
const fs = require('fs') | |
const path = require('path') | |
const voidFn = () => {} | |
class Utils { | |
constructor() { | |
this.gitignoreFileName = '.gitignore' | |
} |
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 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 |
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
#!/usr/bin/env python | |
naturals = 0 | |
squares = 0 | |
for i in xrange(101): | |
naturals += i | |
squares += i*i | |
naturals_square = naturals * naturals |
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
from lxml import html | |
import requests | |
separator = '\t' | |
csv = open('stocks.csv', 'w+') | |
csv.write( | |
'NAME' + separator | |
+'DESC' + separator | |
+'PRICE' + separator |