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

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

    +124

    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
    ##### curl #####
    
    GET /api/4dabd7b3816......97 HTTP/1.1
    User-Agent: curl/7.21.0 (i686-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18
    Host: deepbit.net
    Accept: */*
    
    HTTP/1.1 302 Found
    Cache-Control: no-cache
    Content-length: 0
    Location: /api/4dabd7b3816......97
    Set-Cookie: *********pRd; path=/;
    
    Connection: close
    
    ##### curl #####
    
    ##### wget #####
    
    GET /api/4dabd7b3816......97 HTTP/1.0
    User-Agent: Wget/1.12 (linux-gnu)
    Accept: */*
    Host: deepbit.net
    Connection: Keep-Alive
    
    HTTP/1.1 200 OK
    Server: nginx/1.0.0
    Date: Mon, 30 May 2011 06:45:14 GMT
    Content-Type: application/json; charset=utf-8
    Connection: keep-alive
    Cache-Control: no-cache, must-revalidate
    Last-Modified: Mon, 30 May 2011 06:45:14 GMT
    Expires: Mon, 30 May 2011 06:46:14 GMT
    Content-Length: 413
    
    {data data data}
    ##### wget #####

    Lis, 30 Мая 2011

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

    +124

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    map.put(Byte.valueOf(String.valueOf((int)rs.getBytes(1)[0])), rs.getString(2).trim());
    ....
    //чуть ниже
    ....
    icon = map.get(Byte.valueOf(String.valueOf((int)line[days])));

    3.14159265, 24 Мая 2011

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

    +124

    1. 1
    litFreeMinets.Text = FreeMinutes.Count;

    uassya, 06 Мая 2011

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

    +124

    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
    75. 75
    if (command == "help") ShowHelp();
                else if (command == "") Error(1);
                else
                {
                    string[] pcmd = command.Split(' ');
                    string[] args = { "0,0", "0,0" };
                    string argv = "Black";
                    if (pcmd[0] != "setColor" &&
                        pcmd[0] != "save" &&
                        pcmd[0] != "fill" &&
                        pcmd[0] != "saveCMD" &&
                        pcmd[0] != "close" &&
                        pcmd[0] != "if" &&
                        pcmd[0] != "from" &&
                        pcmd[0] != "setVar" &&
                        pcmd[0] != "getVar" &&
                        pcmd[0] != "setRGB" &&
                        pcmd[0] != "fillFRGB" &&
                        pcmd[0] != "fillRGB" &&
                        pcmd[0] != "setPenSize" &&
                        pcmd[0] != "fillF" &&
                        pcmd[1] != "#?") args = pcmd[1].Split('|');
                    else if (pcmd[0] == "setVar") argv = pcmd[1] + " " + pcmd[3];
                    else if (pcmd[1] == "#?")
                    {
                        Help4command(pcmd[0]);
                        return;
                    }
                    else argv = pcmd[1];
                    switch (pcmd[0])
                    {
                        case "save":
                            try { bmp.Save(argv + "\\" + Name + ".png",ImageFormat.Png); }
                            catch { Error(2); }
                            break;
                        case "line":
                            {
                                string[] xy0 = args[0].Split(',');
                                string[] xy1 = args[1].Split(',');
                                int x0 = 0, y0 = 0, x1 = 0, y1 = 0;
                                if (xy0[0] == "w" || xy0[0] == "W") x0 = W;
                                if (xy0[1] == "h" || xy0[1] == "H") y0 = H;
                                if (xy1[0] == "w" || xy1[0] == "W") x1 = W;
                                if (xy1[1] == "h" || xy1[1] == "H") y1 = H;
                                if (VL.isExistVar(xy0[0])) x0 = int.Parse(VL.Get(xy0[0]));
                                if (VL.isExistVar(xy0[1])) y0 = int.Parse(VL.Get(xy0[1]));
                                if (VL.isExistVar(xy1[0])) x1 = int.Parse(VL.Get(xy1[0]));
                                if (VL.isExistVar(xy1[1])) y1 = int.Parse(VL.Get(xy1[1]));
                                try
                                {
                                    x0 = int.Parse(xy0[0]);
                                    y0 = int.Parse(xy0[1]);
                                    x1 = int.Parse(xy1[0]);
                                    y1 = int.Parse(xy1[1]);
                                }
                                finally { }
                                graph.DrawLine(new Pen(usesCol, penSize), new Point(x0, y0), new Point(x1, y1));
                            }
                            break;
                        case "rect":
                            {
                                if (fiilF == false)
                                {
                                    string[] xy0 = args[0].Split(',');
                                    string[] xy1 = args[1].Split(',');
                                    int x0 = 0, y0 = 0, x1 = 0, y1 = 0;
                                    if (xy0[0] == "w" || xy0[0] == "W") x0 = W;
                                    if (xy0[1] == "h" || xy0[1] == "H") y0 = H;
                                    if (xy1[0] == "w" || xy1[0] == "W") x1 = W;
                                    if (xy1[1] == "h" || xy1[1] == "H") y1 = H;
                                    if (VL.isExistVar(xy0[0])) x0 = int.Parse(VL.Get(xy0[0]));
                                    if (VL.isExistVar(xy0[1])) y0 = int.Parse(VL.Get(xy0[1]));
                                    if (VL.isExistVar(xy1[0])) x1 = int.Parse(VL.Get(xy1[0]));
                                    if (VL.isExistVar(xy1[1])) y1 = int.Parse(VL.Get(xy1[1]));
                                   //еще +100500 строк говнокода

    Только что копался в старых проектах и наткнулся на это. Это была попытка сделать что-то вреде ЯП для рисования, своево рода черепашья графика, но со своими свистелками и сами знаете чем.

    psina-from-ua, 05 Мая 2011

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

    +124

    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
    private void TextBox_KeyDown(object sender, KeyEventArgs e)
            {
                if (e.Key == Key.Space)
                {
                    TextBox box = sender as TextBox;
    
                    int start = box.SelectionStart;
                    int length = box.SelectionLength;
    
                    if (length == 0)
                    {
                        box.Text = box.Text.Insert(start + length, " ");
                        box.SelectionStart = start + 1;
                    }
                    else
                    {
                        string str1 = box.Text.Substring(0, start);
                        string str2 = box.Text.Substring(start + length);
    
                        box.Text = str1 + " " + str2;
                        box.SelectionStart = start + 1;
                    }
    
                    e.Handled = true;
                }
            }

    Отборный говнокод выращенный на территории Индии.
    Видимо им зарплату действительно за строчки кода платят.

    strato, 26 Апреля 2011

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

    +124

    1. 1
    while (!Pr.HasExited) System.Threading.Thread.Sleep(250);

    Ожидание завершения запущенного процесса

    Мартин, 02 Марта 2011

    Комментарии (11)
  8. C# / Говнокод #5727

    +124

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    private void image_hide_show(object sender, EventArgs e)
            {
                for(int i = 0; i < Controls.Count; i++)
                    if ((sender as PictureBox).Name + "_img" == Controls[i].Name) Controls[i].Visible = !Controls[i].Visible;
            }

    Мартин, 20 Февраля 2011

    Комментарии (2)
  9. Куча / Говнокод #5627

    +124

    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
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    99. 99
    ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
    
    ;;; Copyright (C) 2011, Dmitry Ignatiev <[email protected]>
    
    ;;; Permission is hereby granted, free of charge, to any person
    ;;; obtaining a copy of this software and associated documentation
    ;;; files (the "Software"), to deal in the Software without
    ;;; restriction, including without limitation the rights to use, copy,
    ;;; modify, merge, publish, distribute, sublicense, and/or sell copies
    ;;; of the Software, and to permit persons to whom the Software is
    ;;; furnished to do so, subject to the following conditions:
    
    ;;; The above copyright notice and this permission notice shall be
    ;;; included in all copies or substantial portions of the Software.
    
    ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    ;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    ;;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    ;;; NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
    ;;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
    ;;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    ;;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    ;;; DEALINGS IN THE SOFTWARE
    
    (in-package #:neural-flow)
    
    ;; Stolen from `trivial-garbage'
    
    #+openmcl
    (defvar *weak-pointers* (cl:make-hash-table :test 'eq :weak :value))
    
    #+(or allegro openmcl lispworks)
    (defstruct (weak-pointer (:constructor %make-weak-pointer))
      #-openmcl pointer)
    
    (declaim (inline make-weak-pointer))
    (defun make-weak-pointer (object)
      #+sbcl (sb-ext:make-weak-pointer object)
      #+(or cmu scl) (ext:make-weak-pointer object)
      #+clisp (ext:make-weak-pointer object)
      #+ecl (ext:make-weak-pointer object)
      #+allegro
      (let ((wv (excl:weak-vector 1)))
        (setf (svref wv 0) object)
        (%make-weak-pointer :pointer wv))
      #+openmcl
      (let ((wp (%make-weak-pointer)))
        (setf (gethash wp *weak-pointers*) object)
        wp)
      #+corman (ccl:make-weak-pointer object)
      #+lispworks
      (let ((array (make-array 1)))
        (hcl:set-array-weak array t)
        (setf (svref array 0) object)
        (%make-weak-pointer :pointer array)))
    
    (declaim (inline weak-pointer-value))
    (defun weak-pointer-value (weak-pointer)
      "If WEAK-POINTER is valid, returns its value. Otherwise, returns NIL."
      #+sbcl (values (sb-ext:weak-pointer-value weak-pointer))
      #+(or cmu scl) (values (ext:weak-pointer-value weak-pointer))
      #+clisp (values (ext:weak-pointer-value weak-pointer))
      #+ecl (values (ext:weak-pointer-value weak-pointer))
      #+allegro (svref (weak-pointer-pointer weak-pointer) 0)
      #+openmcl (values (gethash weak-pointer *weak-pointers*))
      #+corman (ccl:weak-pointer-obj weak-pointer)
      #+lispworks (svref (weak-pointer-pointer weak-pointer) 0))
    
    ;;Red-black tree
    
    (declaim (inline %node %nleft %nright %nparent %nred %ndata %ncode
                     (setf %nleft) (setf %nright) (setf %nparent)
                     (setf %nred) (setf %ndata) (setf %ncode)))
    (defstruct (%node (:constructor %node (data code parent red))
                      (:conc-name %n))
      (left nil :type (or null %node))
      (right nil :type (or null %node))
      (parent nil :type (or null %node))
      (red nil)
      data
      (code 0 :type (integer 0 #.most-positive-fixnum)))
    
    (declaim (inline %tree %tree-root (setf %tree-root)))
    (defstruct (%tree (:constructor %tree ())
                      (:copier %copy-tree))
      (root nil :type (or null %node)))
    
    (declaim (inline rotate-left))
    (defun %rotate-left (tree node)
      (declare (type %tree tree) (type %node node)
               (optimize (speed 3) (safety 0)))
      (let ((right (%nright node)))
        (when (setf (%nright node) (%nleft right))
          (setf (%nparent (%nleft right)) node))
        (if (setf (%nparent right) (%nparent node))
          (if (eq node (%nleft (%nparent node)))
            (setf (%nleft (%nparent node)) right)
            (setf (%nright (%nparent node)) right))
          (setf (%tree-root tree) right))

    Вылезли глаза! Как на этом можно писать?

    vertexua, 10 Февраля 2011

    Комментарии (68)
  10. C# / Говнокод #5071

    +124

    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
    /// <summary>
            /// Return "Yes" for true and "No" for false
            /// </summary>
            public static string GetYesNoString(this bool val) 
            {
                return val ? "Yes" : "No";
            }
    
            /// <summary>
            /// Return "N/A" if no value, "Yes" for true and "No" for false
            /// </summary>
            public static string GetYesNoString(this object val)
            {            
                if(val is bool)
                    return ((bool)val).GetYesNoString();
    
                return "N/A";
            }

    Extension of the object class :) Very stupid because it make sense only for bool type, but it can be selected for every type in intellisense :)

    bugotrep, 27 Декабря 2010

    Комментарии (76)
  11. Куча / Говнокод #4517

    +124

    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
    СLS
    DEFLNG M-N,P,S
    
    INPUT "N=";N
    IF N>9.999999999999999D+48 THEN END
    M=N
    S=0
    WHILE M<> 0
    
    P=M MOD 10
    S=S+P
    M=M\10
    PRINT "S=";S;
    WEND
    PRINT"P="; "S=";S;
    PRINT
    
    ЗДЕСЬ ВСЕ ВЕРНО ! СУММА ПОДСЧИТЫВАЕТСЯ ПРАВИЛЬНО. Часть 2 ЭТОЙ ЗАДАЧИ
    
    WHILE S<>10
    M=S: P=0
    S1=0
    
    WHILE M<>0
    
    P=M MOD 10
    
    S1=S1+P
    M=M\10
    PRINT S1
    
    PRINT S1
    WEND
    PRINT"SUMMA=";S1
    WEND
    END

    Это QBasic. Для числа подсчитываются сумма его цифр. Если результат превышает 9, то для результата снова подсчитывается сумма цифр и так далее, пока результат не станет меньше 10. Например, если исходное число 3247598, то результат 2. Взято отсюда: http://otvet.mail.ru/question/47598848/

    Govnocoder#0xFF, 02 Ноября 2010

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