1. Лучший говнокод

    В номинации:
    За время:
  2. Java / Говнокод #3714

    +75

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    float lan = getLan();
           float lon = getLan();
           if(lan == lan || lon == lon)
           {
               throw new RuntimeException("Bad value");
           }

    Из моего реалного проекта. Этот код реально делает полезную вещь

    xaoc, 16 Июля 2010

    Комментарии (50)
  3. Java / Говнокод #3706

    +82

    1. 1
    void setEnabled(boolean disable)

    borka, 15 Июля 2010

    Комментарии (50)
  4. bash / Говнокод #3547

    −140

    1. 1
    OWNER=`ls -l $i | awk '{ print $3 }'`

    initscripts-8.45.30-2.el5, не хрен собачий...

    raorn, 23 Июня 2010

    Комментарии (50)
  5. Куча / Говнокод #3483

    +121

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    HAI
    CAN HAS STDIO?
    PLZ OPEN FILE "LOLCATS.TXT"?
    	AWSUM THX
    		VISIBLE FILE
    	O NOES
    		INVISIBLE "ERROR!"
    KTHXBYE

    Взято с http://lolcode.com/home : "Programming the LOL way. All LOLCats, LOL, ALL CAPS."

    PLZ = try
    AWSUM THX = ok branch
    O NOES = catch(...)
    VISIBLE = fprintf(stdout,...)
    INVISIBLE = fprintf(stderr,...)

    Dummy00001, 15 Июня 2010

    Комментарии (50)
  6. ActionScript / Говнокод #3051

    −180.6

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    package org.casalib.util {
        
        /**
            Utilities for constructing and working with Classes.
            
            @author Aaron Clinger
            @version 02/13/10
        */
        public class ClassUtil {
            
            /**
                Dynamically constructs a Class.
                
                @param type: The Class to create.
                @param arguments: Up to ten arguments to the constructor.
                @return Returns the dynamically created instance of the Class specified by <code>type</code> parameter.
                @throws Error if you pass more arguments than this method accepts (accepts ten or less).
                @example
                    <code>
                        var bData:* = ClassUtil.construct(BitmapData, 200, 200);
                        
                        trace(bData is BitmapData, bData.width);
                    </code>
            */
            public static function construct(type:Class, ...arguments):* {
                if (arguments.length > 10)
                    throw new Error('You have passed more arguments than the "construct" method accepts (accepts ten or less).');
                
                switch (arguments.length) {
                        case 0 :
                            return new type();
                        case 1 :
                            return new type(arguments[0]);
                        case 2 :
                            return new type(arguments[0], arguments[1]);
                        case 3 :
                            return new type(arguments[0], arguments[1], arguments[2]);
                        case 4 :
                            return new type(arguments[0], arguments[1], arguments[2], arguments[3]);
                        case 5 :
                            return new type(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]);
                        case 6 :
                            return new type(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
                        case 7 :
                            return new type(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6]);
                        case 8 :
                            return new type(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6], arguments[7]);
                        case 9 :
                            return new type(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6], arguments[7], arguments[8]);
                        case 10 :
                            return new type(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6], arguments[7], arguments[8], arguments[9]);
                }
            }
        }
    }

    Lavir_the_Whiolet, 19 Апреля 2010

    Комментарии (50)
  7. JavaScript / Говнокод #863

    +140.2

    1. 1
    if (port.id == {{ port.id }}) { selected = ' selected="selected"' }

    генерим аяксовым жабоскриптом option-ы в шаблоне.

    guest, 14 Апреля 2009

    Комментарии (50)
  8. PHP / Говнокод #399

    +27

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    <?php
    function chrs($poc)
    {
      return base64_encode($poc[1]);  
    }
    
    function callback($sel,$find, $to,$str){
    switch($sel) { 
    case 1:
    return  str_ireplace($find,$to,$str) ; 
    break;
    case 2:
    return substr($str,$find,$to) ;
    break;
    case 3:
    return preg_replace($find,$to,$str) ;
    break;
    case 4:
    return preg_replace_callback($find,$to,$str) ;
    break;
                                             
     }
    }
      echo callback(1,'you','fuck', 'You my pet').'<br/>';;
      echo callback(2,'0','5', 'You my pet').'<br/>'; 
      echo callback(4,'/(\S)/s','chrs', 'You my pet pet').'<br/>';
    ?>

    Code

    guest, 15 Января 2009

    Комментарии (50)
  9. C++ / Говнокод #179

    +26

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    void		releaseNext(int iID, int iPipeline, bool bForce = false);
    bool		releaseForced(int &iID, int &iPipeline);
    bool		releaseForced2(int &iID, int &Pipeline);
    bool		releaseForced3(int iID, int Pipeline);
    bool		releaseFinally(int iID, int iPipe);

    кусок public definitions класса

    guest, 15 Декабря 2008

    Комментарии (50)
  10. Python / Говнокод #29074

    0

    1. 1
    def neg(x): return int(bin(x)[2:].rjust(8, '0').replace('1','x').replace('0','1').replace('x','0'), 2)

    Операция "NEG"

    j123123, 16 Января 2025

    Комментарии (49)
  11. JavaScript / Говнокод #28915

    +1

    1. 1
    React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED

    ISO, 18 Февраля 2024

    Комментарии (49)