The random rantings of a concerned programmer.

Archive for the 'Random' Category

(untitled)

April 23rd, 2013 | Category: Random

There is a “must be this tall to ride” limit on the Internet, and that is your own IP and the ability to act as a peer on the network.
If you don’t meet those requirements, you are just a consumer. You’re eyeballs that someone else is renting out. You’re a digital serf.

5 comments

turns out i just hate computers

October 11th, 2012 | Category: Random

So I was trolling around on HN (god help us all) and stumbled upon someone jamming a link in sideways to an otherwise reasonable circlejerk. The link was so fucking interesting I can’t help but post about it.

Eve.com? Really?

Circle jerk tip #4: check your goddamn copy before submitting links to the collective.

Browsing some more on that site I find this link, which purports to be a guide to learning Unix on OSX. Ignore the fact that it’s a fucking video tutorial about fucking Unix, the part you should be looking at is the table of contents. It goes fucking on and on about useless drivel without actually mentioning the one fucking saving grace of using a terminal-based system.

fucking. man. pages.

fucking fuck.

Turns out I don’t hate computers. I just fucking hate anyone who uses them.

FUCK.

EDIT, PS: shoutout to the nodejs releng team who managed to, between 0.6.13 and 0.6.17 subtly change fs.createWriteStream to NOT throw an exception when open(2) returns an error, and instead emit an error event on the stream object. Way to keep a goddamn stable API between fucking minor releases, guys. Also go fuck yourselves I hate you.

EDIT2: before anyone asks, yeah I would run an virtualenv thing to maintain parallel nodejs installs to prevent issues like this; that is, if I didn’t give a fuck about my system

7 comments

Untitled

July 28th, 2012 | Category: Random

I just rewrote the entire backend codebase for one of my work projects from node.js to Go.

My co-workers thought I was joking when I told them.

Ha. Ha. Ha.

1 comment

Fun Javascript Primitives Time

July 17th, 2012 | Category: Random

Suppose you have some javascript, and you’re inspecting some arguments passed in from another developer because you’re an asshole and want to throw TypeError‘s whenever possible to spite the fact that you’re not using a strong, statically-typed language. So you write some code:

function dongstrap(a1) {
  if (!(a1 instanceof String)) {
    throw new TypeError("ASSHATS");
  }
}

You go to test it and … wait, what? dongstrap("dongs"); doesn’t throw? So you fire up your handy javascript REPL and, sure enough, "" instanceof String == false.

What. The. Fuck.

Okay, so string literals aren’t really objects. Okay. So they shouldn’t behave like objects.

String.prototype.dongs = function() { 
  throw new Error("dongs"); 
}

"".dongs(); // Throws "dongs"

Okay, so string literals BEHAVE like objects, but are not objects. I imagine that they were originally vanilla primitive types — you couldn’t coerce them to ever act like objects and had to check the type via typeof whatever === 'string'. Fine, I get it, Javascript is old as shit. And then someone else comes along and is like

SMALLTALK IS LOVE, SEX ME SOME RUBY, ALL VALUES ARE CAN BE OBJECTS

And that’s fine and all; but during the actual implementation meeting (probably for backwards-compatibility nonsense), they were like “HEY, LET’S TACK THIS SHIT ON TOP OF IT AND MAKE ALL KINDS OF HOLES FOR PEOPLE TO FALL INTO, JOB SECURITY ETC” and there were nods all around, because it was just after the first dot-com bubble and everyone was sleepless at night with worry about how they’d make their next mortgage payment, much less send their still-infantile children through an over-priced, over-valued 4-year course on increasing bodily tolerance to liquor.

So if we revisit the original function, and instead invoke the String constructor directly –

dongstrap(new String("dongs"));

The exception gets thrown as expected.

And that would make sense and all, but we’ve already rewritten to

function dongstrap2(a1) {
  if (typeof a1 === 'string') {
    throw new TypeError('seriously');
  }
}

…and guess what typeof(new String('')) is? Yeah. It’s not string. It’s object. So, frustrated and infuriated, you replace the keys displaced from slamming your keyboard on the ground and with gritted teeth smash out the third and final implementation before breaking out the fifth of whiskey stashed in your desk drawer next to the loaded colt .45

function dongstrap3(a1) {
  if (!(a1 instanceof String) && !(typeof a1 === 'string')) {
    throw new TypeError('fuck you');
  }
}

After commiting your changes, as you raise the revolved to your jaw, you have two thoughts:

  1. Why the fuck was I, nay, anyone, writing in such a braindead language?
  2. This madness probably applies to Numbers as well.
4 comments

So, I lied.

May 12th, 2012 | Category: Random

4scrape is alive again. Completely rewritten from scratch in Go, featuring even more stupid bullshit on the frontend. And it’s using a real fulltext indexer this time around. In it for the long haul this time around.

15 comments

Next Page »