Strings & Ints

Uncategorized

Building a Lego gearbox – and then breaking it

by elbekko on Jun.10, 2010, under Uncategorized

So, today we decided to build the AeroShift gearbox. It’s pretty nicely done, and we quickly had it whipped up (first in LDD for the building guide, although it’s so simple that really wasn’t necessary). After a bit of almost-careful initial testing, we made up a gearshift lever (that thing is sturdier than the rest of the gearbox I bet), and then it looked like this:
(continue reading…)

Leave a Comment more...

A Greasemonkey script for reddit users.

by elbekko on Dec.24, 2009, under Uncategorized

I wrote this little script to convert imgur links into their fast version, because the imgur site often loads very slowly for me (don’t ask me why, I have no clue).

So, behold:

// ==UserScript==
// @name           Reddit Pics
// @namespace      http://www.reddit.com/r/
// @description    Makes imgur links into the proper link
// @include        http://www.reddit.com/r/
// ==/UserScript==

var entries = document.getElementsByTagName("a");

for(var i = 0; i != entries.length; i++)
{
	var link = entries[i];

	// Is link to imgur
	if(/*link.className.indexOf("title loggedin ") != -1 && */link.href.indexOf("imgur.com") != -1)
	{
		if(link.href.split(".").length < 3)
		{
			link.title = "Original at: " + link.href;
			link.href += ".png";
			link.href = wtf_replace(link.href, "imgur.com", "i.imgur.com");
		}
		else if(link.href.indexOf("i.imgur.com") == -1)
		{
			link.title = "Original at: " + link.href;
			link.href = wtf_replace(link.href, "imgur.com", "i.imgur.com");
		}
	}
}

function wtf_replace(str, text, rwith)
{
	return str.substr(0, str.indexOf(text)) + rwith + str.substr(str.indexOf(text) + text.length);
}

Don't mind the custom replace function, it was to debug the regex, but I figure this could well be faster and I can't be arsed removing it.

Just set it to work on all of Reddit, and every link to imgur will be turned into the fast version.

Leave a Comment more...

Ogame style corrections

by elbekko on Mar.12, 2009, under Uncategorized

Not too long ago I was asked to join in playing Ogame with a few classmates. But the first pageload was already a huge facepalm, a style so horrendous it nearly made me cry. Nearly. What it did make me do, is whip out Stylish and Firebug, and get cracking.
(continue reading…)

1 Comment more...