Skip to content

Instantly share code, notes, and snippets.

@mwotton
Created August 3, 2013 23:45
Show Gist options
  • Select an option

  • Save mwotton/6148426 to your computer and use it in GitHub Desktop.

Select an option

Save mwotton/6148426 to your computer and use it in GitHub Desktop.
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;
}
@vampirechicken

Copy link
Copy Markdown

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

Copy link
Copy Markdown
#!/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

sgerrand commented Aug 5, 2013

Copy link
Copy Markdown

@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

mwotton commented Aug 5, 2013

Copy link
Copy Markdown
Author

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

@sharpobject

Copy link
Copy Markdown

@sgerrand:

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

@pranavrc

pranavrc commented Aug 6, 2013

Copy link
Copy Markdown

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

mwotton commented Aug 6, 2013

Copy link
Copy Markdown
Author

@pranavrc All the props.

@rvagg

rvagg commented Aug 6, 2013

Copy link
Copy Markdown

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

@seler

seler commented Dec 21, 2015

Copy link
Copy Markdown

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