www.webdeveloper.com
Results 1 to 6 of 6

Thread: Do you ever sneak jokes into your code?

  1. #1
    Join Date
    Sep 2004
    Location
    At the corner of WALK and DONT WALK
    Posts
    1,714

    Do you ever sneak jokes into your code?

    I did in one tutorial. If you look at the code of the chapter on comments and the head element of my online tutorial, you'd see that one of the ID attributes has the value "HTML-Head_Body-OnwardsAndForwards-Code-Indiana_Jones_and_the_Template_Of_Doom"

  2. #2
    Join Date
    May 2014
    Posts
    893
    color:#00E0E0; /* I think I wanna know ya, know ya */

    /* it's not that the kid has ADD it's that his mom and his dad are... */
    background:#DDD;

    <!-- old macdonald had a computer -->
    <h2>IDE I/O</h2>
    Java is to JavaScript as Ham is to Hamburger.

  3. #3
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,313
    Generally, I just try to keep the code readable for whoever might have to maintain it later (including myself). However, I've been known to add some snarky, satirical, or whatever comments -- especially after a long day of trying to maintain someone else's code.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,313
    Or, this one I wrote a day or two ago right here in the PHP forum gave me an inner chuckle, even though it didn't originate with the idea of looking silly:
    PHP Code:
    $string = (string) $string
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  5. #5
    Join Date
    May 2014
    Posts
    893
    Yeah, PHP's lack of true typecasting can result in some funny constructs like that.

    One I use a lot that looks REALLY stupid:

    Code:
    function safeInclude($file) { include($file); }
    Now why would you do that? Simple -- if you include a file from inside a function or class, the code is run from the scope of that function or class...

    So if you had say...

    Code:
    class dbHandler {
      private $test = ;
      public function test() {
        include('somedamnedfile.php');
      }
    }
    or

    Code:
    function test() {
      $test = 'whiskey tango foxtrot';
      include('somedamnedfile.php');
    }
    somedamnedfile.php would have scope access to $this->test in the first one and $test in the second one... wrapping the include in a new function prevents passing scope.

    Which is REALLY jacktarded on PHP's part; but then there's a reason there's a whole slew of changes I'm tempted to dig in and make to PHP myself... like getting rid of php tags (<?php ?>) altogether, only allowing functions or classes in includes, preventing includes from including non .php files, blocking readfile from reading the content of files with the .php extension...

    Though at that point I might go back to working on my own language (which is still in the planning stages) or my Pascal pre-processor. (that would add white space neutral pchar strings and shorthand for type conversions)
    Java is to JavaScript as Ham is to Hamburger.

  6. #6
    Join Date
    Jun 2014
    Posts
    7
    hmmm nice well i am not use it....

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles