Dear mister turdburger

To the turdburger who lives in my apartment block,

I know that you might think it’s funny to press all of the eight lift floor buttons just before you get out at the ground floor but I’ll tell you something: it’s not, especially when you’re waiting in the basement for that lift which is already one of the slowest lifts in the world. Luckily on this occasion I didn’t have any takeway food with me that was diminishing in quality due to those peskily irresistible laws of thermodynamics but let me tell you this: if I actually catch you doing it you will get a very rude education in what a man with a loud, booming voice and some very choice words can do to your quaint sense of humour.

Your fellow lift user and the voice of fucking reason,

JavaScript reduce

Tonight Matt posted a JavaScript solution to a problem he saw described elsewhere. Here’s a version that I whipped up to use JavaScript 1.8’s new Array.prototype.reduce function.

var arrVal = ["a", "b", "c", "c", "d", "e", "e", "e", "e", "e",
  "f", "e", "f", "e", "f", "a", "a", "a", "f", "f", "f"];

function group(previousValue, currentValue, index, arr)
	if (index > 0  && arr[index - 1] == currentValue)
		return previousValue.slice(0,-1).concat([previousValue.slice(-1)[0].concat(currentValue)]);
	return previousValue.concat([[currentValue]]);

function format(previousValue, currentValue, index, arr)
	return previousValue.concat(
		currentValue.length < 3 ? 
		currentValue.join(" ") :
		currentValue.slice(0,2).join(" ") + 
			" " + currentValue.slice(2).join(" ") + "");

print(arrVal.reduce(group, []).reduce(format, []).join(" "));

Dear mister robber

Dear mister (or ms though I doubt it) robber,

Thank you for smashing my car window last week while it was parked in my parking space. The lousy handful of change that you stole, that probably amounted to a maximum of $15, is now going to cost me $463 in repairs (along with a couple of hours of cleaning up and delaying a trip I wanted to take). I hope that it was really worth it for you and that you did really need the money — next time I might just leave my doors unlocked to save us both the hassle.

Your victim,