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

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

    −852

    1. 1
    SELECT * FROM users WHERE sex=1;

    Долго думал, sex=1 это мужики или дамы. Оказалось мужики.

    stillwaiting, 11 Июля 2011

    Комментарии (7)
  3. Pascal / Говнокод #7213

    +147

    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
    говно
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно
    
    
    говно

    говно


    говно


    говно

    maga_nanaev, 09 Июля 2011

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

    +162

    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
    if (!empty($login) & !empty($pass) & !empty($compIDS)) {
    
          if (($login != "admin") | ($pass != "qwe754wwQ")) {
    
    print <<<HERE
    	<script language="JavaScript">
    	<!--
    	    alert ("Имя пользователя и (или) пароль неверны!");
    	//-->
    	</script>
    HERE;
          }
          else {
    }
    }

    Враг не пройдет!

    De-Luxis, 06 Июля 2011

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

    +159

    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
    function setBlockStatus()
    {
    global $adminTpl, $core, $db;
    ..........
    }
    
    function setCommentStatus()
    {
    global $adminTpl, $core, $db;
    ..........
    }
    
    function deleteBlock()
    {
    global $adminTpl, $core, $db;
    ..........
    }

    И еще десятки других функций которые так любят глобальные переменные в Toogle CMS =)

    invision70, 05 Июля 2011

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

    +958

    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
    if (args.Cube == null)
    {
    	args.Cube = null;
    	stringBuilder.AppendLine(Properties.Resources.ErrorCubeEmpty);
    }
    else if(...)
    {
    ...
    }
    else if (...)
    {
    ...
    }
    else
    {
    ...
    }
    int num = args.Cube.NumSamplesIJK.K;

    redrick, 04 Июля 2011

    Комментарии (7)
  7. Ruby / Говнокод #7122

    −104

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    @hands_by_value.each do |hand|
    	if @hands_by_value.slice(@hands_by_value.index(hand)+1..@hands_by_value.index(@hands_by_value.last)).include?(hand)
    			@hands_by_value.delete_at(@hands_by_value.index(hand))			
    		end
    	end

    Рукотворный array.uniq! похоже :)

    lnk, 01 Июля 2011

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

    +113

    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
    public string GetNormalImage(int newWidth, int newHeight, string sufix = "normal") {
                String[] tmp = _originalImagePath.Split('.');
                String newImagePath = "";
                for (int i = 0; i < tmp.Length - 1; i++)
                {
                    newImagePath += tmp[i];
                    newImagePath += "_";
                }
                newImagePath += sufix + ".";
                newImagePath += tmp[tmp.Length - 1];
    
                
                Image oldImage = Image.FromFile(_originalImagePath);
                if (oldImage.Height >= oldImage.Width) {
                    Image newImage;
                    newImage = FixedSize(oldImage, newWidth, newHeight);
                    newImage.Save(newImagePath);
                } else {
    
                    float heightRatio = (float)newHeight / (float)oldImage.Height;
                    float widthRatio = (float)newWidth / (float)oldImage.Width;
    
                    float bestRatio = 1;
                    if (heightRatio < widthRatio) {
                        bestRatio = heightRatio;
                    } else {
                        bestRatio = widthRatio;
                    }
    
                    var result = new System.Drawing.Bitmap((int)Math.Round(oldImage.Width * bestRatio), (int)Math.Round(oldImage.Height * bestRatio));
                    using (var graphics = Graphics.FromImage(result))
                    {
                        graphics.CompositingQuality = CompositingQuality.HighQuality;
                        graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                        graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
                        graphics.SmoothingMode = SmoothingMode.HighQuality;
                        graphics.DrawImage(oldImage, new Rectangle(Point.Empty, new Size((int)Math.Round(oldImage.Width * bestRatio), (int)Math.Round(oldImage.Height * bestRatio))));
                    }
                    result.Save(newImagePath);
                }
    
                return newImagePath;
            }

    ресайз изображения

    tuxcod, 30 Июня 2011

    Комментарии (7)
  9. Ruby / Говнокод #7104

    −104

    1. 1
    <%= !!@case[:img] ? image_tag(@case[:img]) : "" %>

    pavel_so, 29 Июня 2011

    Комментарии (7)
  10. bash / Говнокод #7100

    −144

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    #! /bin/sh
    
    # some code
    
    daemon1="/usr/home/daemon1.sh"
    daemon2="/home/daemon2.sh"
    
    # some code with variables

    Скрипт на BSD. Хомяк находится в /usr/home, а /home симлинк на него

    Elvenfighter, 29 Июня 2011

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

    +147

    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
    int __fastcall TForm1::iscomm(AnsiString str)
    {
    int i=1;
    while (str[i]==' ')
     i++;
    if (str[i]=='#')
     {
      return 1;
     }
    else
     {
      return 0;
     };
    };

    yasosiska, 27 Июня 2011

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