Skip to content

Instantly share code, notes, and snippets.

@rmill
rmill / prices.js
Created January 9, 2020 23:05
Get the average price per sqr foot on rentfaster.ca
// https://www.rentfaster.ca/ab/calgary/rentals/condo/?l=16,51.0302,-114.1004&city_slug=ab%2Fcalgary
pricesqrft = 0.0;
numPlaces = 0;
$('.listings.listings-list .sv_dtl').each((i, listing) => {
let price = parseInt($(listing).find('.infobox-price span').eq(1)[0].textContent);
if (isNaN(price)) return;
let sqft = $(listing).find('.sq_feet')[0];
if (sqft === undefined) return;
@rmill
rmill / hammer.js
Last active August 29, 2015 14:06
Hammer Icarus with lots of requests
var currentRequests = 0;
var requestsPerMinute = 10;
var MAX_REQUESTS = 100;
var requestStatus = [];
var poll = setInterval(function () {
console.log('****** REQUESTS ******');
if (requestStatus.length == 0) {
console.log('No requests sent');
@rmill
rmill / migration-2013-06-25.sql
Last active December 18, 2015 23:29
Updates the devices_events_locations table
/* Create the temp table */
CREATE TABLE devices_events_locations_temp LIKE devices_events_locations; -- 1 sec
/* Run the Migration on the temp table */
ALTER TABLE devices_events_locations_temp
ADD beacon_name VARCHAR(64) DEFAULT NULL,
ADD beacon_address VARCHAR(64) DEFAULT NULL,
ADD CONSTRAINT `FK_D66205B1F6AD5579` FOREIGN KEY (beacon_id) REFERENCES beacons (id),
ADD CONSTRAINT `FK_D66205B1FFC3B1AC` FOREIGN KEY (device_event_id) REFERENCES devices_events (id); -- 1 sec