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

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

    +144

    1. 1
    //Неплохо было бы добавить возможность удалять свои говнокоды...

    Tanger, 10 Июня 2010

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

    +80

    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
    private JMyForm frm;
    
    public void view() 
    {
        if (((JOurComponent) frm).getAction() == Actions.Action1 
        {
            viewList(Actions.Action1);
        } 
        else
        if (((JOurComponent) frm).getAction() == Actions.Action2
        {
            viewList(Actions.Action2);
        }
        ...
        else
        if (((JOurComponent) frm).getAction() == Actions.Action117
        {
            viewList(Actions.Action117);
        }
    }
    
    private void viewList(String action) {
        if (action == Actions.Action1)
        {
            //
        }
        ...
        if (action == Actions.Action117)
        {
            //
        }
    }

    Что тут может радовать? ООП отменяется. И паттерны туда же.

    lotik, 10 Июня 2010

    Комментарии (19)
  4. PHP / Говнокод #3379

    +158

    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
    /**
     * Метод проверяет права доступа на использование этого модуля, возвращает результат проверки.
     * Кроме этого, происходит запись в лог
     *
     * @return boolean
     */
    private function check_access() {
    	Logger::log_exception($_SERVER['REQUEST_URI'].'?'.$_SERVER['QUERY_STRING'], $this->log_file_name);
    	return true;
    }
    
    // [...]
    
    /**
     * Попытка переключить рабочую базу данных
     */
    public function actionChange_db() {
    	if (!$this->check_access()) {
    		echo strval($this->err_failure_access);
    		return;
    	}
    
    // [...]

    Вот такое иногда встречается в коде коллеги, про название метода "log_exception" я промолчу, т.к. это тоже его рук дело, а общий для всех метод Logger::log() ему почему-то не понравился? Я уже просто устал ругаться с ним...

    cr0t, 02 Июня 2010

    Комментарии (19)
  5. Pascal / Говнокод #3319

    +116

    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
    for m:=0 to 9 do
          mas[m]:=inttostr(m);
      if ((Form1.edit1.text='')or(Form1.Memo2.text='')) then    begin
          if Form1.Memo2.text='' then
              ShowMessage('Ошибка! Введите пожалуйста текст или подключите файл,который необходимо расшифровать!!!');
          if Form1.edit1.text='' then
              ShowMessage('Ошибка! Введите пожалуйста ключ,которым будет расшифрован текст!!!');
        end
      else    begin
          //проверка ключа
          key:=Form1.edit1.text;
          k:=length(key);
          c:=0;
          k_p:=true;
          for j:=1 to k do
          for m:=0 to 9 do begin
              if (key[j]=mas[m]) then  
                  inc(c)
              else Begin
                  if (m=9) then
                    if (c=0) then Begin
                        ShowMessage('Ошибка!!!Введите пожалуйста ключ,которым будет расшифрован текст-целые числа');
                        k_p:=false;
                      end
                    else
                      c:=0;
                end;
            end;
        end;

    говнокриптография...

    3.14159265, 26 Мая 2010

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

    +993

    1. 1
    2. 2
    // Randomize
    #define srand(x) srand(x + GetCurrentThreadId())

    Чтобы в разных тредах не выдавало одинаковые последовательности

    k06a, 14 Мая 2010

    Комментарии (19)
  7. PHP / Говнокод #3138

    +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
    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
    if(empty($name) or empty($text) or !preg_match("/[a-zа-я]/i",$name) or !preg_match("/[a-zа-я]/i",$text))
      {
      echo "<font color=\"#f00000\">";
    
        if(empty($name) or !preg_match("/[a-zа-я]/i",$name))
        {
          if(empty($name)) echo "" . $lang['10'] . "<br />";
    
            else {       echo "" . $lang['11'] . "<br />";}
    
        }
    
    
        if(empty($text) or !preg_match("/[a-zа-я]/i",$text) )
          if(empty($text)) echo "" . $lang['12'] . "<br />";
          else {
               echo "" . $lang['13'] . "<br />";
               }
      echo "</font><br /><a href='index.php?act=add'>" . $lang['14'] . "</a><br />";
    
      }
    
      else
      {
    $text=stripslashes(htmlspecialchars($text, ENT_QUOTES));
    $new_date=stripslashes(htmlspecialchars($new_date, ENT_QUOTES));
    $name=stripslashes(htmlspecialchars($name, ENT_QUOTES));
    
      $sms="$name:|:$new_date:|:$text
    ";
    $sms=antimat($sms);
    
      $fp=@fopen($file,"a+");
      @fwrite($fp,$sms);
      fclose($fp);
    
    
    
    if(@fwrite) echo "" . $lang['15'] . " <a href=\"index.php\">" . $lang['16'] . "</a>.<br />";
    else { echo "" . $lang['32'] . ""; }
    }

    )))

    lugaro, 30 Апреля 2010

    Комментарии (19)
  8. JavaScript / Говнокод #3105

    +188

    1. 1
    this.innerText = this.innerText.replace(this.innerText, 'Только для зарегистрированных');

    Суровые челябинские программисты не перестают удивлять.

    Infamous, 24 Апреля 2010

    Комментарии (19)
  9. VisualBasic / Говнокод #3078

    −106

    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
    public static DateTime tString2DateTime(String sDateTime)
    {
    //var
    Int32 iYear=DateTime.Now.Year;
    Int32 iMonth=DateTime.Now.Month;
    Int32 iDay=DateTime.Now.Day;
    Int32 iHour=DateTime.Now.Hour;
    Int32 iMinute=DateTime.Now.Minute;
    Int32 iSecond=DateTime.Now.Second;
    //end var
    try
    {
    iYear=Convert.ToInt32(sDateTime.Substring(0,4));
    try
    {
    iMonth=Convert.ToInt32(sDateTime.Substring(4,2));
    try
    {
    iDay=Convert.ToInt32(sDateTime.Substring(6,2));
    try
    {
    iHour=Convert.ToInt32(sDateTime.Substring(8,2));
    try
    {
    iMinute=Convert.ToInt32(sDateTime.Substring(10,2));
    try
    {
    iSecond=Convert.ToInt32(sDateTime.Substring(12,2));
    }
    catch
    {
    }
    }
    catch
    {
    }
    }
    catch
    {
    }
    }
    catch
    {
    }
    }
    catch
    {
    }
    }
    catch
    {
    }
    return new DateTime(iYear,iMonth,iDay,iHour,iMinute,iSecond);
    }

    а вам слабо?
    Функция имени Максима Прохорова

    ursus, 22 Апреля 2010

    Комментарии (19)
  10. Pascal / Говнокод #2988

    +110.2

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    function HexStrToint(S: String): Integer;
    begin
    if (s='$00000000') or (s='clBlack')then HexStrToint:=0
    else
    if s='$00010101' then HexStrToint:=1
    else
    if s='$00020202' then HexStrToint:=2
    else
    if s='$00030303' then HexStrToint:=3
    else
    if s='$00040404' then HexStrToint:=4
    else
    if s='$00050505' then HexStrToint:=5
    else
    if s='$00060606' then HexStrToint:=6
    else
    if s='$00070707' then HexStrToint:=7
    else
    if s='$00080808' then result:=8
    else
    if s='$00090909' then result:=9
    else
    if s='$000A0A0A' then result:=10
    else
    if s='$000B0B0B' then result:=11
    else
    if s='$000C0C0C' then result:=12
    else
    if s='$000D0D0D' then result:=13
    else
    if s='$000E0E0E' then result:=14
    else
    if s='$000F0F0F' then result:=15
    else
    if s='$00101010' then result:=16
    else
    if s='$00111111' then result:=17
    else
    if s='$00121212' then result:=18
    else
    if s='$00131313' then result:=19
    else
    if s='$00141414' then result:=20
    else
    if s='$00151515' then result:=21
    else
    if s='$00161616' then result:=22
    else
    if s='$00171717' then result:=23
    else
    if s='$00181818' then result:=24
    else
    if s='$00191919' then result:=25
    else
    if s='$001A1A1A' then result:=26
    else
    if s='$001B1B1B' then result:=27
    else
    if s='$001C1C1C' then result:=28
    else
    if s='$001D1D1D' then result:=29
    else
    if s='$001E1E1E' then result:=30
    else
    if s='$001F1F1F' then result:=31
    else
    if s='$00202020' then result:=32
    else
    if s='$001D1D1D' then result:=33
    else
    if s='$00222222' then result:=34
    else
    if s='$00232323' then result:=35
    else
    if s='$00242424' then result:=36
    else
    if s='$00252525' then result:=37
    else
    if s='$00262626' then result:=38
    else
    if s='$00272727' then result:=39
    else
    if s='$00282828' then result:=40
    else
    if s='$00292929' then result:=41
    else
    if s='$002A2A2A' then result:=42
    else
    if s='$002B2B2B' then result:=43
    else
    if s='$002C2C2C' then result:=44
    else
    if s='$002D2D2D' then result:=45
    else
    if s='$002E2E2E' then result:=46
    else
    if s='$002F2F2F' then result:=47
    else
    if s='$00303030' then result:=48
    else

    Наткнулся на проявление "гениальности"
    // про язык, на котором написано, вообще молчу

    Это перевод хексов оттенков серого в числа (там до 255 включительно, но здесь не влезает)
    Код, может, и сгенерирован, но все равно это говнокод ^_^

    m08pvv, 11 Апреля 2010

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

    +130.8

    1. 1
    ^.*rutor\.org\/(?:(?:torrent)|(?:download))\/(\d*)\/?.*

    govnoacc, 11 Апреля 2010

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