Skip to content

Instantly share code, notes, and snippets.

@scturtle
Last active December 24, 2015 01:39
Show Gist options
  • Select an option

  • Save scturtle/6725106 to your computer and use it in GitHub Desktop.

Select an option

Save scturtle/6725106 to your computer and use it in GitHub Desktop.
display "last solved days algo" directly in Project Euler
// ==UserScript==
// @name PE days
// @namespace scturtle
// @include http://projecteuler.net/*
// @include https://projecteuler.net/*
// @version 1
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js
// @grant none
// ==/UserScript==
(function () {
if ('Username' == $('table.grid > tbody > tr > th:nth-child(2)').html()) {
$('th').first().after('<th>days ago</th>');
$('div.info, a.info').each(function () {
var days = $(this).children('span').html().match(/\s(\w+)\sday/)[1];
if (days == 'past') days = 0;
var color = days <= 60 ? "#D00" : "gray";
$(this).parent().parent().parent().parent().parent().after(
'<td style="color:' + color + ';text-align:center;"> ' + days + '</td>'
)
})
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment