Skip to content

Instantly share code, notes, and snippets.

@sacah
sacah / dateDiff.js
Last active September 18, 2021 00:57
Calculate days, months, years between two dates
function dateDiff_COMMENTED(date1, date2) {
let days = 0;
let months = 0;
let years = 0;
// The calculations need date1 to be earlier than date2.
// If date2 is earlier, swap date1 and date2
if (date1 > date2) [date2, date1] = [date1, date2];
let year1 = date1.getFullYear();
let year2 = date2.getFullYear();
@sacah
sacah / Realestate.com.au-Tweaks.js
Last active August 29, 2015 14:24
Tweaks to Realestate.com.au, hide previously viewed properties, add pins on Sydney Train stations with peak hour transport info
// ==UserScript==
// @name Realestate.com.au hide previously viewed properties
// @namespace http://www.sacah.net
// @include http://www.realestate.com.au/buy/*
// @version 1
// @grant none
// @license None
// ==/UserScript==
/* Clear saved results with
@sacah
sacah / hide-previously-viewed-properties-realestate-com-au.user.js
Last active August 29, 2015 14:07
Greasemonkey script for RealEstate.com.au - Hide previously viewed properties
// ==UserScript==
// @name Realestate.com.au hide previously viewed properties
// @namespace http://www.sacah.net
// @include http://www.realestate.com.au/*
// @version 1
// @grant none
// @license None
// ==/UserScript==
/* Clear saved results with