Skip to content

Instantly share code, notes, and snippets.

@ubershmekel
Created October 4, 2021 03:41
Show Gist options
  • Save ubershmekel/f38eef7044396a2605c02b7e3213ed9d to your computer and use it in GitHub Desktop.
Save ubershmekel/f38eef7044396a2605c02b7e3213ed9d to your computer and use it in GitHub Desktop.
Paste this in the JS console when looking at github commit history
dateEls = [...document.querySelectorAll('relative-time')]
dates = dateEls.map(it => new Date(it.attributes['datetime'].textContent));
durations = [];
for (const [i, dt] of dates.entries()) {
const hours = Math.round((dates[i] - dates[i + 1]) / 3600e2) / 10;
const newNode = document.createTextNode("- took hours " + hours);
dateEls[i].parentNode.appendChild(newNode);
durations.push(hours)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment