Last active
April 17, 2018 16:29
-
-
Save mintyPT/9ae4cbc285ddb4e10276ca4cf944dd69 to your computer and use it in GitHub Desktop.
Bookmarklet to search Github repos with updates in the last X days
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
javascript: (function()%7Bvar t%3D%7Beval:%27"Date.prototype.yyyymmdd%3Dfunction()%7Bvar t%3Dthis.getMonth()%2B1,e%3Dthis.getDate()%3Breturn%5Bthis.getFullYear(),%5C%5C"-%5C%5C",(t>9%3F%5C%5C"%5C%5C":%5C%5C"0%5C%5C")%2Bt,%5C%5C"-%5C%5C",(e>9%3F%5C%5C"%5C%5C":%5C%5C"0%5C%5C")%2Be%5D.join(%5C%5C"%5C%5C")%7D%3Bvar search%3Dprompt(%5C%5C"Recent search on github%3F%5C%5C"),diffDays%3Dprompt(%5C%5C"Since how many days%3F%5C%5C"),today%3Dnew Date,priorDate%3D(new Date).setDate(today.getDate()-parseInt(diffDays)),d%3Dnew Date(priorDate).yyyymmdd()%3Bwindow.location%3D%5C%5C"https://github.com/search%3Futf8%3D✓%26q%3D%5C%5C"%2BencodeURIComponent(search%2B%5C%5C" pushed:>%5C%5C"%2Bd)%2B%5C%5C"%26type%3DRepositories%5C%5C"%3B"%27%7D,e%3D!0%3Bif("object"%3D%3Dtypeof this.artoo%26%26(artoo.settings.reload%7C%7C(artoo.log.verbose("artoo already exists within this page. No need to inject him again."),artoo.loadSettings(t),artoo.exec(),e%3D!1)),e)%7Bvar o%3Ddocument.getElementsByTagName("body")%5B0%5D%3Bo%7C%7C(o%3Ddocument.createElement("body"),document.firstChild.appendChild(o))%3Bvar a%3Ddocument.createElement("script")%3Bconsole.log("artoo.js is loading..."),a.src%3D"//medialab.github.io/artoo/public/dist/artoo-latest.min.js",a.type%3D"text/javascript",a.id%3D"artoo_injected_script",a.setAttribute("settings",JSON.stringify(t)),o.appendChild(a)%7D%7D).call(this)%3B |
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
// http://medialab.github.io/artoo/generator/ | |
// https://stackoverflow.com/questions/3066586/get-string-in-yyyymmdd-format-from-js-date-object | |
Date.prototype.yyyymmdd = function() { | |
var mm = this.getMonth() + 1; // getMonth() is zero-based | |
var dd = this.getDate(); | |
return [this.getFullYear(), | |
'-', | |
(mm>9 ? '' : '0') + mm, | |
'-', | |
(dd>9 ? '' : '0') + dd | |
].join(''); | |
}; | |
var search = prompt('Recent search on github?') | |
var diffDays = prompt('Since how many days?') | |
var today = new Date() | |
var priorDate = new Date().setDate(today.getDate()-parseInt(diffDays)) | |
var d = new Date(priorDate).yyyymmdd() | |
// https://github.com/search?utf8=%E2%9C%93&q=express+pushed%3A%3E2017-01-01&type=Repositories | |
window.location = 'https://github.com/search?utf8=%E2%9C%93&q='+encodeURIComponent(search +' pushed:>'+d)+'&type=Repositories' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment