#bookmarklet

Bookmarklet to get the number of your GitLab contributions in 2018

If you are working with GitLab and are interested in the number of contributions you’ve made this year, here’s a handy, little bookmarklet to calculate your contributions.

GitLab Contributions Bookmarklet

  • Drag the link above to your browser’s bookmark bar.
  • Go to https://gitlab.com/users/​[username]/activity
    (replace [username] with, well, your username and, if necessary, gitlab.com with your custom domain).
  • Hit the bookmarklet and – voilà – there’s the number of your contributions made in 2018! 🎉

Screenshot of GitLab contributions bookmarklet

Here’s the JavaScript, if you’re interested or want to run it in your console:

(function() {
	var rects = document.querySelectorAll('#activity .js-contrib-calendar rect.user-contrib-cell');
	var name = document.querySelectorAll('.user-info .cover-title')[0].textContent.replace(/(\r\n\t|\n|\r\t)/gm,'');
	var yearToCount = '2018';
	var counter = 0;
	rects.forEach((item) => {
		var text = item.getAttribute('data-original-title');
		var count = text.substr(0, text.indexOf(' ')); 

		if (text.indexOf(yearToCount) > -1 && count !== 'No') {
			counter += parseInt(count);
		}
	});
	alert(name + ' did ' + counter + ' contributions in ' + yearToCount + '.');
}())

Bookmarklet: Save to Archive.org

Here’s a handy little bookmarklet I used while writing my bachelor thesis to save quoted web pages. It enables you to add a web page to the Internet Archive’s Wayback Machine without opening it’s frontpage, copying and pasting the URL. Just drag the following link to your browser’s bookmark bar, hit it and it saves the current web page to Archive.org’s index.

Save to Archive.org

Et voilà : You can archive a lot of web pages with minimal effort.