Page 2 of 6 FirstFirst 1234 ... LastLast
Results 11 to 20 of 58

Thread: Funny Code

  1. #11
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Well, walk then.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  2. #12
    Join Date
    Mar 2011
    Posts
    1,915
    Thanks
    59
    Thanked 105 Times in 103 Posts
    Blog Entries
    4

    Default

    Quote Originally Posted by jscheuer1 View Post
    Well, walk then.
    Huh?



    WOOT! 700th post!!!! (except not really cause we're in the lounge )
    Last edited by keyboard; 08-09-2012 at 05:39 AM.

  3. #13
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I have trouble explaining dirty jokes to my sister too.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #14
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    lol.

    This code is actually live on one of my sites. wasn't intentional.
    PHP Code:
    $action $_GET['lost']; 

  5. #15
    Join Date
    Mar 2011
    Posts
    1,915
    Thanks
    59
    Thanked 105 Times in 103 Posts
    Blog Entries
    4

    Default

    Quote Originally Posted by jscheuer1 View Post
    I have trouble explaining dirty jokes to my sister too.
    I got the joke... I was curious if you'd explain it ... so go on

    P.s. what about

    PHP Code:
    $randomvariableicantrememberthenameof $_POST['mail']; 
    Last edited by keyboard; 08-09-2012 at 05:40 AM.

  6. #16
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    My favorite ones to find in code tend to be those that tell me not to touch pieces of code:
    Code:
    /* seriously, don't touch this or people will die */
    Code:
    // magic do not touch
    Code:
    // don't change this or #%€& will hit the fan
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  7. #17
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by bernie1227 View Post
    Code:
    /* seriously, don't touch this or people will die */
    Code:
    // magic do not touch
    Code:
    // don't change this or #%& will hit the fan
    Code:
    // 'Hammer Time!' (U Can't Touch This)
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #18
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    Haha, I like it, personally I actually like to write these kind of comments to myself so that I don't screw my code up, I saw a funny comic once where there were two software engineers standing over a computer and one says:
    I don't get your code
    The other says:
    Neither do I, but it seems to work
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  9. #19
    Join Date
    Mar 2011
    Posts
    1,915
    Thanks
    59
    Thanked 105 Times in 103 Posts
    Blog Entries
    4

    Default

    Quote Originally Posted by jscheuer1 View Post
    Code:
    // 'Hammer Time!' (U Can't Touch This)
    Quote Originally Posted by keyboard1333 View Post
    Code:
    stop(); // Hammertime!
    I did it first!

  10. #20
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,865
    Thanks
    49
    Thanked 260 Times in 252 Posts
    Blog Entries
    56

    Default

    I have some code that may not be funny, but it surely is funnily strange. It's about how javascript handles and/or statements. An and/or statement is only false when both members of the statement are false (as opposed to either...or statements that are only false when the members are both true or both false).
    So this:
    Premise: x1=x2
    Conclusion: (since x1=x2), 'x1 is bigger than or equal to x2'

    is a true statement.

    Let's convert that to javascript. If we put:
    Code:
    <script>
    var x1, x2;
    x1=x2;
    if(x1==x2 || x1>x2){alert('CORRECT.\nWe have postulated that x1 is equal to x2, so x1 is equal to or bigger than x2 (inclusive or).')} else {alert('WRONG.\nWe have postulated that x1 is equal to x2, so x1 is equal to or bigger than x2 (inclusive or).\nWhy am I getting this "else" alert that says I`m wrong?')}
    </script>
    we get the expected result.
    But if we put
    Code:
    <script>
    var x1, x2;
    x1=x2;
    if(x1>=x2){alert('CORRECT.\nWe have postulated that x1 is equal to x2, so x1 is equal to or bigger than x2 (inclusive or)')} else {alert('WRONG.\nWe have postulated that x1 is equal to x2, so x1 is equal to or bigger than x2 (inclusive or).\nWhy am I getting this "else" alert that says I`m wrong?')}
    </script>
    we incorrectly get a non-expected result.
    So using '||' gives the expected outcome, whereas '>=' makes trouble.
    What makes things even more weird is that '>=' stops annoying us when we assign concrete values to x1 and x2, as in:
    Code:
    <script>
    var x1=1, x2=1;
    x1=x2;
    if(x1>=x2){alert('CORRECT.\nWe have postulated that x1 is equal to x2, so x1 is equal to or bigger than x2 (inclusive or)')} else {alert('WRONG.\nWe have postulated that x1 is equal to x2, so x1 is equal to or bigger than x2 (inclusive or).\nWhy am I getting this "else" alert that says I`m wrong?')}
    </script>
    What is going on here?
    ===
    Arie.

Bookmarks

Posting Permissions

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