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

    В номинации:
    За время:
  2. Куча / Говнокод #7509

    +134

    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
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    <style type="text/css">
      p, div, ol, ul {
        margin: 0;
        padding: 0;
        border: 0;
        vertical-align: baseline;
        background: transparent;
      }
      .exception {
        width: 700px;
        border: 1px solid #D6D6D6;
        background-color: #FAFAFA;
        font-family: arial, tahoma, verdana;
        font-size: 75%;
        padding: 10px;
        line-height: 140%;
      }
      .exception img {
        float: left;
        margin-right: 7px;
      }
      .exceptionTitle {
        padding-top: 2px;
        color: #AA0000;
        font-size: 120%;
        font-weight: bold;
      }
      .exceptionMessage {
        background-color: white;
        border: 1px solid #E1E1E1;
        padding: 5px;
        font-size: 110%;
        margin: 10px 0;
      }
      .exception a {
        cursor: pointer;
        padding: 1px;
        border-bottom: 1px dotted #555;
        color: #000;
      }
      .exceptionTraceContainer {
        font-size: 95%;
        line-height: 150%;
        font-family: verdana, tahoma, arial;
        margin: 10px 0;
      }
      .exceptionTraceContainer ol {
        padding-left: 25px;
      }
      .exceptionTraceContainer li {
        padding-top: 5px;
      }
      .exceptionSystemInfo {
        font-size: 90%;
        border-top: 1px solid #E1E1E1;
        padding: 10px 5px;
        color: #666;
      }
    </style>
    <!--[if IE]>
    <style type="text/css">
    img { display: none; }
    </style>
    <![endif]-->
    <script type="text/javascript">
    function _showAllTrace() {
        var trace = document.getElementById('exceptionTrace');
        trace.style.display = (trace.style.display == 'none') ? '' : 'none';
    }
    </script>
    <div class="exception">
        <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAxMi8wMi8wOOE6tm4AAAAYdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3Jrc0+zH04AAAHsSURBVDiNlZDNahNhFIaf+clkkknSNNHUohSRYlyIyxYRXLhVL8B7qCIKigUR3IobewOC0EWgdyCIf4sstLSRlopasQhxmkyTSTIZJ/PjIiZlzJTEB87iO3w8vO8RHMcJiOBX+Qad6iu0E1eYWVyN+jJEjFoalfvYtTKZmUXsepnqu+v/J3Gam5g/SqSOXyCuFZiavchvcwujcm9yiVFZJqZOo6g5CDwkSSGVP09j9wVd/eV4idPcwDI+oGXnIfCGo6hZEuk59tdvj5cYlQfEEwUkSQlJCDy0qTP4PRNj8+7REs+uYtXXSWbnABdwyS+UyC+UABdBDEjlzmLureE0N6IlB5+WkZUUsqweJhjw9x1PTBNT0tQ+LkVLOvprkpmT4Rr/SPq1TuF0vtPZWw1LWl+fEfg94onMsEp/BhzuJDmGqhU42HkSljR3n6Nq+ZFjRiUh8EikjuF292lsPwJAaOvl4Ofba+QK5xCl2Mjlj6LbqWG1DU5f/Ybc2H6MomiIogCBG/qYv/QGgPr7yyOSRDJLt6XT2HqI8HmtEKSzsyhqauIUA2yrSdvUkQUxhu854RtMiO/3EMUYYq64RNvU6XbqBL7TrzRmfNfGatWw2nVyxZsIjuMErS9PMXZW8Fx74hSSrJIr3iI9f4c/ZwP51LVnSksAAAAASUVORK5CYII=" alt="exception" />
        <div class="exceptionTitle">Application was halted by an exception.</div>
        <p>Debug-mode is off.</p></div>

    Это что-то новенькое на говнокоде. Вылезло при попытке открыть один говнокод на отдельной странице (после другого сбоя, неудачи голосования). Кстати, это весь код страницы, никаких <html>, <head> и <body> не было.

    gegMOPO4, 10 Августа 2011

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

    +160

    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
    public function isValidModule($module)
        {
            if (!is_string($module)) {
                return false;
            }
    
            $module        = strtolower($module);
            $controllerDir = $this->getControllerDirectory();
            foreach (array_keys($controllerDir) as $moduleName) {
                if ($module == strtolower($moduleName)) {
                    return true;
                }
            }
    
            return false;
        }

    Великий и могучий Zend Framework в очередной раз очаровывает своих адептов изяществом и простотой(((

    hacpaka, 21 Апреля 2011

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

    +146

    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
    package gargoyle.xenox.game;
    
    import gargoyle.util.log.Log;
    
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.io.Serializable;
    
    @SuppressWarnings("rawtypes")
    public abstract class Persistent<T extends Persistent> implements Serializable {
      private static final long serialVersionUID = 1L;
    
      private File file(final Class<? extends Persistent> clazz) {
        return new File(System.getProperty("user.home"), clazz.getName() + ".dat");
      }
    
      @SuppressWarnings("unchecked")
      final protected T load(final Class<T> clazz) {
        ObjectInputStream in;
        try {
          in = new ObjectInputStream(new FileInputStream(this.file(clazz)));
          return (T) in.readObject();
        } catch (final IOException e) {
          Log.error(e);
        } catch (final ClassNotFoundException e) {
          Log.error(e);
        }
        return null;
      }
    
      final protected void save(final T o) {
        ObjectOutputStream os = null;
        try {
          os = new ObjectOutputStream(new FileOutputStream(this.file(o.getClass())));
          os.writeObject(this);
          os.flush();
        } catch (final IOException e) {
          Log.error(e);
        } finally {
          try {
            if (os != null) {
              os.close();
            }
          } catch (final IOException e) {
            Log.error(e);
          }
        }
      }
    }

    такой вот забавный сериализатор получился
    причина - запутался в генериках

    Lure Of Chaos, 21 Февраля 2011

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

    +171

    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
    if (a == 0 && b == 0 && c == 0 && d == 0) n = 0;
        if (a == 0 && b == 0 && c == 0 && d != 0) n = 0;
        if (a == 0 && b == 0 && c != 0 && d == 0) n = 0;
        if (a == 0 && b != 0 && c == 0 && d == 0) n = 0;
        if (a != 0 && b == 0 && c == 0 && d == 0) n = 0;
        if (a == 0 && b == 0 && c != 0 && d != 0 && c == d) m += 1;
        if (a == 0 && b != 0 && c != 0 && d == 0 && b == c) m += 1;
        if (a == 0 && b != 0 && c == 0 && d != 0 && b == d) m += 1;
        if (a != 0 && b == 0 && c == 0 && d != 0 && a == d) m += 1;
        if (a != 0 && b == 0 && c != 0 && d != 0 && a == c) m += 1;
        if (a != 0 && b != 0 && c == 0 && d == 0 && a == b) m += 1;////
        if (a == 0 && b != 0 && c != 0 && d != 0 && b == c) m += 1;
        if (a == 0 && b != 0 && c != 0 && d != 0 && b == d) m += 1;
        if (a == 0 && b != 0 && c != 0 && d != 0 && c == d) m += 1;//
        if (a != 0 && b == 0 && c != 0 && d != 0 && a == c) m += 1;
        if (a != 0 && b == 0 && c != 0 && d != 0 && a == d) m += 1;
        if (a != 0 && b == 0 && c != 0 && d != 0 && d == c) m += 1;//
        if (a != 0 && b != 0 && c == 0 && d != 0 && a == b) m += 1;
        if (a != 0 && b != 0 && c == 0 && d != 0 && a == d) m += 1;
        if (a != 0 && b != 0 && c == 0 && d != 0 && b == d) m += 1;//
        if (a != 0 && b != 0 && c != 0 && d == 0 && a == b) m += 1;
        if (a != 0 && b != 0 && c != 0 && d == 0 && a == c) m += 1;
        if (a != 0 && b != 0 && c != 0 && d == 0 && c == b) m += 1;////
        m--;
        if (a != 0 && b != 0 && c != 0 && d != 0 && a == b) k += 1;
        if (a != 0 && b != 0 && c != 0 && d != 0 && a == c) k += 1;
        if (a != 0 && b != 0 && c != 0 && d != 0 && a == d) k += 1;
        if (a != 0 && b != 0 && c != 0 && d != 0 && b == c) k += 1;
        if (a != 0 && b != 0 && c != 0 && d != 0 && b == d) k += 1;
        if (a != 0 && b != 0 && c != 0 && d != 0 && c == d) k += 1;
        k -= 3;
        if (m <= 0) m = 0;
        if (k <= 0) k = 0;
        n = k + m;*/

    Как на второй день после начала изучения С стал решать задачу "Сколько чисел повторяются"

    slushkov, 24 Декабря 2010

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

    +173

    1. 1
    AX=pow(A[i].r.get_x()*A[i].r.get_x(),0.5);

    Берем модуль числа.

    Taus, 17 Декабря 2010

    Комментарии (50)
  7. 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)
  8. Java / Говнокод #3706

    +82

    1. 1
    void setEnabled(boolean disable)

    borka, 15 Июля 2010

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

    −140

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

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

    raorn, 23 Июня 2010

    Комментарии (50)
  10. Куча / Говнокод #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)
  11. 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)