Thursday, September 15, 2011

Introducing Whitespace2.0.vim!

This is a raving that I wrote some months ago now while I was working a different job in a different country. I should point out that I liked the guys I was working with and they, generally speaking, were not retards...




The guys I'm working with are fucking geniuses and I fucking love them! I've been doing some maintenance on their PHP apps at work, and their coding standards are so advanced that Vim can't even support them out of the box! Luckily, I'm pro at vimscript and was able to write a plugin to help me!

<blink>Whitespace2.0! Now available on github! Get it here!</blink>

The making of Whitespace2.0 - A documentary

Right. First things first: we will need a random number generator. For this, we will nick some code from here.


Secondly, we will need to modify the behaviour of the tab key with this code:


Additionally, we need trailing whitespace to occasionally appear.

Sweet, that should do it.

PHP devs are blithering retards because Jesus made them that way

The other day a programmer at my work hacked on some PHP that I had written and, when I pulled the changes, I saw my code was now riddled with mixed indenting. I felt like he had just been in my bedroom and knocked all my transformers off the shelf and then just left them there. On the floor! That FUCK! I was going through Rapid Cyclic Weapon Escalation Syndrome1 and was in danger of rage-crapping my pants when I was reminded of that old bible story from primary school.

You know the one I'm talking about.

What are you? Stupid!? OK, here's an except:

... Jesus is on the assembly line putting together the final prototypes of all the programmers. He's bored as fuck and this shit has been dragging out all day - who knew there were so many fucking languages! All he wants is to be at home sucking on a beer and watching the tube, but instead he is stuck on the line putting the nerds together for daddy.

Poor Jesus...

So when the next head comes down the line, he pops the lid off and, instead of ramming in the corresponding brain, he hoists up his skirts and takes a giant shit right in there and snaps the lid back on ...

And thus explains why most PHP programmers are either:

A. too stupid to indent properly
B. completely ignorant about tabs, spaces and good indenting
C. don't know how to use their editors


(1). A mental disorder in which the subject fantasizes about killing someone with progressively larger and larger weapons until they have exhausted all possibilities, whereupon they begin combining weapons together into super-weapons. The ultimate culmination of which is a giant mega weapon made up of all known weapons in the universe.

9 comments:

  1. Oh man, I just laughed out loud so hard at this post. Thanks for the afternoon humour.

    ReplyDelete
  2. I was a php dev when I wrote this. Dont take this blog too seriously :-)

    I <3 unicorns

    ReplyDelete
  3. I almost shat myself reading this..

    ReplyDelete
    Replies
    1. Hey, there are so many people with indentation mental diceases that you need weapons from paralel universes! And about that, can you recommend a good reading about best indentation practices? What do you think?

      PS: your NERDTree is the best, You own my momma, my sister, my grandma . You deserves.

      Delete
    2. Thanks, glad you find the NERDTree helpful! :)

      One day im going to write a vim plugin that kills people who cant indent properly!

      Indentation practices are actually really simple:

      1. be consistent - never mix tabs and spaces, and follow the indent style of the existing code

      2. if using tabs then make sure you use tabs for indentation and spaces for alignment

      As for whether tabs or spaces are better... if you google "tabs vs spaces" you will get heaps of results - there will be enough on the first page of results to keep you reading all night.

      The question is very subjective, but here is my answer:

      Tabs are better, but since no one knows how to use them properly, spaces are better.

      Delete
  4. Totally agree. Tabs are "faster", spaces are "slower". And you can adjust your tab width :) Those who wants to program first need to learn: indentation, character encoding (another issue that needs good weapons to deal with idiots), text editors or IDEs. Only after that, they are allowed to post their oppinions. +10 to you.

    ReplyDelete
  5. why do you need trailing whitespace?
    also how does this make sure the whitespace/tab consistency? it looks like tab or 4 spaces is returned randomly...
    Could you explain more how the code works?

    ReplyDelete
    Replies
    1. The code emulates bad indenting/whitespace practices - its just a joke and should not be used under any circumstances :)

      Delete
    2. oh hahhaha I got the joke now. wow I'm slow lol

      Delete