Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
whee, i made their pointless C compile!
typedef struct {
int girlfriend;
} holder;
typedef struct {
holder a;
} toplevel;
typedef struct {
int this;
} yoda;
int main() {
holder holder = { 2 };
yoda understand = { 2 };
toplevel get = {holder};
int you = 2;
/* whee, i made this stupid code work! */
if (you == understand.this) {
get.a.girlfriend;
}
return 0;
}
@rvagg

This comment has been minimized.

Copy link

@rvagg rvagg commented Aug 4, 2013

// JavaScript / Node
var understand = { 'this': 'bleh' }
  , you        = 'bleh'
  , get        = { a: {
      get girlfriend () {
        throw new Error('You suck, Unilever')
      }
    }}

if (you == understand.this) {
  get.a.girlfriend;
}
@Acconut

This comment has been minimized.

Copy link

@Acconut Acconut commented Aug 4, 2013

// Golang

package main;

type Understanding struct{
    this string
}

type Getter struct{
    a What
}

type What struct{
    girlfriend string
}

func main() {

    you := "you"
    understand := Understanding{}
    get := Getter{What{}}

    if you == understand.this {
        get.a.girlfriend
    }
}
@sinm

This comment has been minimized.

Copy link

@sinm sinm commented Aug 4, 2013

def method_missing name, *args; Object.new; end
get a girlfriend if you understand this
@michaelneale

This comment has been minimized.

Copy link

@michaelneale michaelneale commented Aug 4, 2013

    // Scala: 
    object AxeAssholes {                                                                                                                                                                                        

       case class Holder1(girlfriend: String)                                                                                                                                                               
       case class Holder2(a: Holder1)                                                                                                                                                                       
       case class Understand(`this`: Int)                                                                                                                                                                   

       val you = 1                                                                                                                                                                                            
       val understand = Understand(1)                                                                                                                                                                         
       val get = Holder2(Holder1("assholes"))                                                                                                                                                                                                                                                                                                                                                                           

       /* here you go you hateful mysogynists */                                                                                                                                                              

       if (you == understand.`this`) {                                                                                                                                                                        
          get.a.girlfriend;                                                                                                                                                                                   
       }                                                                                                                                                                                                      
  } 
@rvagg

This comment has been minimized.

Copy link

@rvagg rvagg commented Aug 5, 2013

// Axe.java
public class Axe {
  enum get {
    a;
    public void girlfriend () {
      throw new RuntimeException(
        "Error: Unilever's marketing department needs some imagination");
    }
  }

  static class understand {
    public void jockMarket () {
      understand you = this;

      /****************************/
      if (you == understand.this) {
        get.a.girlfriend();
      }
      /****************************/
    }
  }

  public static void main(String[] args) {
    new understand().jockMarket();
  }
}

Sadly I couldn't come up with a way to get rid of the () on girlfriend.

@mwotton

This comment has been minimized.

Copy link
Owner Author

@mwotton mwotton commented Aug 5, 2013

betcha wish your girlfriend had an () like me.

@rvagg

This comment has been minimized.

Copy link

@rvagg rvagg commented Aug 5, 2013

@rvagg

This comment has been minimized.

Copy link

@rvagg rvagg commented Aug 5, 2013

My slim grasp of Rust:

// axe.rc
fn main() {
  struct Understand { this: int }
  let you = 1;
  let understand = Understand { this: 1 };
  struct A;
  impl A { fn girlfriend(&self) { println("DOUCHE!"); } }
  struct Get { a: A }
  let get = Get { a: A };

  /***************************/
  if (you == understand.this) {
    get.a.girlfriend();
  }
  /***************************/
}
@droope

This comment has been minimized.

Copy link

@droope droope commented Aug 5, 2013

fucking offensive aye?

@sgerrand

This comment has been minimized.

Copy link

@sgerrand sgerrand commented Aug 5, 2013

@sinm Your rubby example explodes (intentional?) 😾

# axe.rb
def method_missing name, *args; return; end
get a girlfriend if you understand this
=> nil
@sgerrand

This comment has been minimized.

Copy link

@sgerrand sgerrand commented Aug 5, 2013

betcha wish your girlfriend had an () like me.

🙈 A new low, @mwotton.

@laurentlbm

This comment has been minimized.

Copy link

@laurentlbm laurentlbm commented Aug 5, 2013

C#

namespace Axe
{
    class Program
    {
        static void Main(string[] args)
        {
            var you = 1;
            var understand = new {@this = 1};
            var get = new
            {
                a = new
                {
                    girlfriend = new Action(() => { throw new Exception("Discrimination"); })
                }
            };

            if (you == understand.@this)
            {
                get.a.girlfriend();
            }
        }
    }
}
@jswartwood

This comment has been minimized.

Copy link

@jswartwood jswartwood commented Aug 5, 2013

JavaScript Redux (browser only)

you = understand = a = window
understand.this = window
get = this

if (you == understand.this) {
    get.a.girlfriend
}
@jswartwood

This comment has been minimized.

Copy link

@jswartwood jswartwood commented Aug 5, 2013

Also... If I may...

switch (ad, you.buy.axe, you) {
    case 1:
        throw HighSchoolFootball
    case 2:
        throw FratParties
    case 3:
        throw GarbageInTheDumpsterBehindMcDonalds (as.part.of.your.job) 
}
@user24

This comment has been minimized.

Copy link

@user24 user24 commented Aug 5, 2013

lame.php

define("you", "ab");
define("understand", "a");
define("this", "b");
define("get", "screw");
define("a", "you");
define("girlfriend", "axe");

if(you == understand.this) {
    get.a.girlfriend;
}
?>
@caius

This comment has been minimized.

Copy link

@caius caius commented Aug 5, 2013

Nowhere near being idiomatic ruby, but rather gets the point across.

def method_missing name, *args
  @i ||= -4
  @i += 1
  o = ""
  o += args.first + " " if args.first
  o += %w(You suck Unilever.)[@i] if @i >= 0
  o
end

get a girlfriend if you understand this
# => "You suck Unilever."
@elnn

This comment has been minimized.

Copy link

@elnn elnn commented Aug 5, 2013

#!/usr/bin/env python
class foo: girlfriend=42
class get: a=foo()
class understand: this=42
if __name__ == "__main__":
  you = 42
  if you == understand.this:
    get.a.girlfriend
@scubbo

This comment has been minimized.

Copy link

@scubbo scubbo commented Aug 5, 2013

Axe.py

class MisogynyEnabler:
        pass

understand, get = MisogynyEnabler(), MisogynyEnabler()

you = 1
understand.this = 1

if you == understand.this:
        try:
                get.a.girlfriend
        except AttributeError:
                raise Exception('Outdated attitudes detected')
@sharpobject

This comment has been minimized.

Copy link

@sharpobject sharpobject commented Aug 5, 2013

setmetatable(_G,{__index=function()return _G end, __call=function()end})
if you == understand.this then
  get.a.girlfriend()
end

Lua won't parse the middle line without an assignment or a function call, unfortunately.

@user24

This comment has been minimized.

Copy link

@user24 user24 commented Aug 5, 2013

another php attempt with not-quite-right syntax but I found it funny (and this one actually executes something)


class Axe {
    public function __get($name) {
        if($name == "girlfriend") {
            echo "lol only single males know code";
        } else {
            return new Axe();
        }
    }
}

$get = new Axe(); // sadly constants can't hold objects otherwise I could get rid of the dollar.

define("you", "lolmoney");
define("understand", "lol");
define("this", "money");

if(you == understand.this) {
    $get->a->girlfriend;
}

?>
@orf

This comment has been minimized.

Copy link

@orf orf commented Aug 5, 2013

#!/usr/bin/env python
class a(object): __getattr__ = lambda s,*a,**k: s
locals().update({i:a() for i in ('you', 'understand', 'get')})

if you == understand.this:
    get.a.girlfriend
@ifonefox

This comment has been minimized.

Copy link

@ifonefox ifonefox commented Aug 5, 2013

Here's my python version:

class Object():
    def __init__(self):
        self.a = self
        self.girlfriend = self
        self.this = self


def axe(you, understand, get):
    if you == understand.this:
        get.a.girlfriend

you = Object()
understand = you
get = Object()

axe(you, understand, get)
@matthewfranglen

This comment has been minimized.

Copy link

@matthewfranglen matthewfranglen commented Aug 5, 2013

/* You "class" */

function You() {
    this.understanding = ['some-bullshit-pseudocode', 'axe-being-terrible'];
}

You.prototype.understand = function (wat) {
    return this.understanding.indexOf(wat) !== -1;
};

/* Girlfriend "class" */

function Girlfriend() {}

Girlfriend.prototype.get = function () {
    alert('lolol u smell like a 14 year-old');
};

/* Main shit */

function init() {
    var you = new You();
    var thisBullshit = 'some-bullshit-pseudocode';

    if (you.understand(thisBullshit)) {
        var girlfriend = new Girlfriend();
        girlfriend.get();
    }
}

init();

(not written by me, thank @BellendSebastian)

@nicuveo

This comment has been minimized.

Copy link

@nicuveo nicuveo commented Aug 5, 2013

It is worth noting (for extreme values of "worth") that this snippet is also valid (though pointless) brainfuck syntax.

@phpnode

This comment has been minimized.

Copy link

@phpnode phpnode commented Aug 5, 2013

coffeescript!

you = understand: (that) => this is that
get = a: girlfriend: -> alert 'You suck Unilever!'
do get.a.girlfriend if you.understand this
@davzie

This comment has been minimized.

Copy link

@davzie davzie commented Aug 5, 2013

I'm married. Fuck you all. totters off

@davglass

This comment has been minimized.

Copy link

@davglass davglass commented Aug 5, 2013

#!/bin/bash

you="bleh.blah"
understand="bleh"
this="blah"
get="echo "
a="You suck,"
girlfriend=" Unilever"

if [ ${you} == "${understand}.${this}" ]; then
    ${get}${a}${girlfriend};
fi
@bfontaine

This comment has been minimized.

Copy link

@bfontaine bfontaine commented Aug 5, 2013

Brainfuck:

          +++                                                                                                                                                                                                                                  
         +++++
         ++[>+
         >+++>
         +++++
         ++>++
 +++ +++ ++<<< <-]>>
>>-----------.+++++++
+++++++++++++++.++++++.<
<++.>>--.++.------------
------.++++++++.<<.>+++
++++++++++++.>+++.----
 -.+++.-------.+++++
++If++you++understand++this+;+get+a+girlfriend.
  <+++++++++++++
  +++.>----.<<+.
@alexindigo

This comment has been minimized.

Copy link

@alexindigo alexindigo commented Aug 5, 2013

@sgerrand re: first ruby example, I believe idea was to make parse/compile, not to output obscenities for some ad agency. :)

@olekukonko

This comment has been minimized.

Copy link

@olekukonko olekukonko commented Aug 5, 2013

PHP - Live Test 5.0.0 - 5.5.1

Issues

    try {
        if ($you = new Understand(new You())) {
            $you->get()->a()->girlFriend(new Her());
        }
    } catch ( NullBabeException $e ) {
        echo $e->getMessage();
    }
Classes
abstract class Person {
    abstract public function name();
    function __toString() {
        return $this->name();
    }
}

class Her extends Person {
    public function name() {
        return "girlFriend";
    }
}

class You extends Person {
    public function name() {
        return "you";
    }
}

class Understand {
    private $y, $i;
    function __construct(Person $y) {
        $this->y = $y;
        $this->i = "";
    }
    function a() {
        return new What($this->y, $this->i);
    }
    function get() {
        while ( $x = mt_rand(0, 5) ) {
            $this->i .= $x;
        }
        return $this;
    }
}

class What {
    private $i, $y;
    function __construct(Person $y, $i) {
        $this->i = $i;
        $this->y = $y;
    }
    function girlFriend(Person $her) {
        throw new NullBabeException(sprintf("%s is Needed ASAP Found %s issues with  %s ", 
                $her, number_format(( int ) $this->i), $this->y), E_CORE_WARNING);
    }
}
Exceptions
class NullBabeException extends Exception {
    function __construct($m) {
        parent::__construct(sprintf("<h1>%s</h1>", $m));
    }
}
@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Aug 5, 2013

#!/usr/bin/env python
import this

# ;_; http://www.youtube.com/watch?v=o9pEzgHorH0
class Person(object):
    def understand(self, concept):
        assert concept
        return concept

    def get(self):
        return self

you = Person()
girlfriend = Person()

if __name__ == '__main__':
    if you.understand(this):
        girlfriend.get()
@jplitza

This comment has been minimized.

Copy link

@jplitza jplitza commented Aug 5, 2013

orf's python doesn't reach the if block, thus my version:

class a: __cmp__ = lambda *a: 0
class b(object): __getattribute__ = lambda *a: b()

you = a()
understand = get = b()

if you == understand.this:
    get.a.girlfriend

Didn't actually read his before I wrote mine. That feeling when someone already had your idea... head → wall

And because I didn't like the mass definition of structs, here's my C version (for which I had to modify the syntax slightly):

int main() {
    union bar {
        void* this;
        union bar* a;
        void* girlfriend;
    } get;
    void* you = get.a = &get;
    union bar understand;
    understand.a = get.a;

    if (you == understand.this) {
        get.a->girlfriend;
    }
    return 0;
}
@vampirechicken

This comment has been minimized.

Copy link

@vampirechicken vampirechicken commented Aug 5, 2013

Only 8th grade boys like the smell of Axe. The irony is that 8th grade girls think the boys who like it are idiots. So if you want a girlfriend, you;re better off with Old Spice.

@YellowApple

This comment has been minimized.

Copy link

@YellowApple YellowApple commented Aug 5, 2013

#!/usr/bin/perl

=head1 NAME

douchebag.pl - douchebaggery implemented in Perl

=head1 SYNOPSIS

    $ perl douchebag.pl

=head1 DESCRIPTION

douchebag.pl is precisely what it says on the tin.

=head1 COPYRIGHT

Copyright (C) 2013 Apreten Tiousass Wipe

douchebag.pl may be used and/or redistributed under the same terms as Perl itself.

=cut

sub get_a {
    my ($object_to_get, @args) = @_;
    if ($object_to_get eq "girlfriend") {
        return 0;
    } else {
        return 1;
    }
}

sub you_understand {
    my $subject = shift;
    return 1;
}

my $this = "perl";

if (you_understand($this)) {
    get_a("girlfriend");
}
@sgerrand

This comment has been minimized.

Copy link

@sgerrand sgerrand commented Aug 5, 2013

@alexindigo:

re: first ruby example, I believe idea was to make parse/compile, not to output obscenities for some ad agency. :)

My point was that it didn't compile. 😉

@mwotton

This comment has been minimized.

Copy link
Owner Author

@mwotton mwotton commented Aug 5, 2013

jplitza: ooh, i like that one, but changing the Axe code to be less stupid is a definite no-no.

@sharpobject

This comment has been minimized.

Copy link

@sharpobject sharpobject commented Aug 5, 2013

@sgerrand:

It compiled and ran successfully, both on my machine and in the REPL output you posted.

@pranavrc

This comment has been minimized.

Copy link

@pranavrc pranavrc commented Aug 6, 2013

Common Lisp

* (let* ((you 1) (understand.this 1) (get.a.girlfriend "HODOR!"))
    (progn
      (defmacro custom-if (func if-form block-start result block-end)
        (list `,func `(,(cadr if-form) ,(car if-form) ,(caddr if-form)) result))
      (setf (symbol-function '==) (function =)))
    (custom-if
      if (you == understand.this) {
        get.a.girlfriend;
      }
  ))
"HODOR!"
@mwotton

This comment has been minimized.

Copy link
Owner Author

@mwotton mwotton commented Aug 6, 2013

@pranavrc All the props.

@rvagg

This comment has been minimized.

Copy link

@rvagg rvagg commented Aug 6, 2013

yes, I think @pranavrc wins this thread with that one, macro-to-the-max!

@seler

This comment has been minimized.

Copy link

@seler seler commented Dec 21, 2015

Instead of trying to defend original code I'll propose how it should actually look to make sense:

if (you.understand(this)){
    you.get_a_girlfriend();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment