1. JavaScript / Говнокод #12926

    +155

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    <script type="text/javascript" language="javascript">
    function DeleteConfirmation()
    {
     if (confirm("Are you sure, 
         you want to delete selected records ?")==true)
     return true;
     else
     return false;
    }
    </script>

    http://csharpdotnetfreak.blogspot.com/2009/05/edit-multiple-records-gridview-checkbox.html

    Да так да, нет так нет

    denis90, 21 Апреля 2013

    Комментарии (3)
  2. C++ / Говнокод #12924

    +16

    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
    #define TYPE_INIT_(_Number, _Line, _Type,...) struct ln_##_Line##_number_##_Number : public _Type\
    {\
      ln_##_Line##_number_##_Number()\
        :_Type(__VA_ARGS__){}\
    \
      ln_##_Line##_number_##_Number(const _Type& _val)\
        :_Type(_val){}\
    \
      const _Type& operator=(const _Type& _val)\
      {\
        ((_Type)(*this)) = _val;\
        return (*this);\
      }\
    }
    #define TYPE_INIT(_Number, _Line, _Type,...)  TYPE_INIT_(_Number, _Line, _Type, __VA_ARGS__)
    #define INIT(_Type, ...) TYPE_INIT(__COUNTER__, __LINE__, _Type, __VA_ARGS__)
    
    // использование
    
    struct ABC
    {
      int A,B,C;
      
      ABC(int _A,int _B,int _C)
        :A(_A),
        B(_B),
        C(_C)
      {}
    };
    
    
    struct TestClass
    {
      INIT( string, "Ololo" ) lv_String;
      INIT( ABC, 1, 2, 3 ) lv_ABC;
    };

    Оттуда.

    LispGovno, 20 Апреля 2013

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

    +142

    1. 1
    var_dump( ((int) 0 == (string) "test") ); // TRUE

    Бляааа...

    deep, 20 Апреля 2013

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

    +148

    1. 1
    2. 2
    3. 3
    4. 4
    if($line['orderstatus']==0) echo '<td title="Статус" bgcolor="red"><a href="/admin/changeorderstatus2.php?id='.$line['id'].'&sortorder='.$sortorder.'&start='.$start.'" class="gallery4">в обработке</a></td>';
    if($line['orderstatus']==1) echo '<td title="Статус" bgcolor="yellow"><a href="/admin/changeorderstatus2.php?id='.$line['id'].'&sortorder='.$sortorder.'&start='.$start.'" class="gallery4">Не оплачен, отправлен</a></td>';
    if($line['orderstatus']==2) echo '<td title="Статус" bgcolor="cyan"><a href="/admin/changeorderstatus2.php?id='.$line['id'].'&sortorder='.$sortorder.'&start='.$start.'" class="gallery4">Оплачен, отправлен</a></td>';
    if($line['orderstatus']==3) echo '<td title="Статус" bgcolor="lightgreen"><a href="/admin/changeorderstatus2.php?id='.$line['id'].'&sortorder='.$sortorder.'&start='.$start.'" class="gallery4">Оплачен, получен</a></td>';

    rockstar, 20 Апреля 2013

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

    +136

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if (best == null)
                {
                    return null;
                }
                else
                {
                    return best;
                }

    Psilon, 19 Апреля 2013

    Комментарии (16)
  6. Python / Говнокод #12920

    −105

    1. 1
    2. 2
    3. 3
    Дана строка. Разрежьте ее на две равные части (если длина строки — четная, а если длина строки нечетная, то длина первой части должна быть на один символ больше). Переставьте эти две части местами, результат запишите в новую строку и выведите на экран.
    
    При решении этой задачи не стоит пользоваться инструкцией if.

    Вообще не разбираюсь в строках. Помогите пожалуйста.

    alexsid13, 19 Апреля 2013

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

    +151

    1. 1
    2. 2
    3. 3
    4. 4
    <?php
    // autoload.php generated by Composer
    require_once __DIR__ . '/composer' . '/autoload_real.php';
    return ComposerAutoloaderInite3f5acf96d9ae66df74c4805c906a9e2::getLoader();

    Господа, что-то вот не пойму, можно ли ругаться в таких случаях, когда код генерированный. Можно ли писать всякое говно в код, если при этом говорить: "ты не должен туда смотреть, это скрипт, написанный скриптом для скрипта." Я тут вижу говноконкатенацию строковой константы со строковой константой оператором '.' и говноимя, класса в последней строке. Лично моё мнение, что если бы я написал код, в котором вынужден был бы генерировать такие имена, я бы констатировал серьёзную ошибку проектирования на более ранних стадиях.

    zasedanie, 19 Апреля 2013

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

    +137

    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
    if (curMenu != null)
    {
      depth = curMenu.Depth;
      Menu menuG = null;
      if (depth == 1)
      {
        menuG = curMenu;
      }
      if (depth == 2)
      {
        menuG = curMenu.Menu2;
      }
      if (depth == 3)
      {
        menuG = curMenu.Menu2.Menu2;
      }
      if (depth == 4)
      {
        menuG = curMenu.Menu2.Menu2.Menu2;
      }
      if (depth == 5)
      {
        menuG = curMenu.Menu2.Menu2.Menu2.Menu2;
      }
      if (depth == 6)
      {
        menuG = curMenu.Menu2.Menu2.Menu2.Menu2.Menu2;
      }
      if (depth == 7)
      {
        menuG = curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2;
      }
      if (depth == 8)
      {
        menuG = curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2;
      }
    }

    Nested set для петухов!

    validol, 19 Апреля 2013

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

    +132

    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
    <div class="breadcrumbs">
      <ul>
        <li>
          @if (curMenu != null)
          {
            <a href="@Url.Action("index", "main")">Главная</a><span class="breadcrumbs__dash"> / </span>
            if (depth == 1)
            {
              <span>@(curMenu.Title)</span>
            }
            else if (depth == 2)
            {
              <a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a> <span class="breadcrumbs__dash"> / </span>
              <span>@(curMenu.Title)</span>
            }
            else if (depth == 3)
            {
              <a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <span>@(curMenu.Title)</span>
            }
            else if (depth == 4)
            {
              <a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <span>@(curMenu.Title)</span>
            }
            else if (depth == 5)
            {
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <span>@(curMenu.Title)</span>
            }
            else if (depth == 6)
            {
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <span>@(curMenu.Title)</span>
            }
            else if (depth == 7)
            {
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <span>@(curMenu.Title)</span>
            }
            else if (depth == 8)
            {
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Menu2.Url">@(curMenu.Menu2.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <a href="/@curMenu.Menu2.Url">@(curMenu.Menu2.Title)</a><span class="breadcrumbs__dash"> / </span>
              <span>@(curMenu.Title)</span>
            }                                  
          }
          else if (ViewBag.Title != null && url!="/")
          {
            <a href="@Url.Action("index", "main")">Главная</a><span class="breadcrumbs__dash"> / </span>
            <span>@ViewBag.Title</span>
          }
        </li>
      </ul>
    </div>

    Хлебные крошки в каталоге "неограниченной" вложенности.

    validol, 19 Апреля 2013

    Комментарии (6)
  10. JavaScript / Говнокод #12916

    +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
    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
    $("#menu44").click(function () {
      $("#menu111").hide();
      $("#menu222").hide();
      $("#menu333").hide();
      $("#menu444").show();
      $("#menu555").hide();
      $("#menu666").hide();
      $("#menu777").hide();
      $(".selMenu_group").removeClass("selMenu_group");
      $(this).children().addClass("selMenu_group");
    });
    $("#menu55").click(function () {
      $("#menu111").hide();
      $("#menu222").hide();
      $("#menu333").hide();
      $("#menu444").hide();
      $("#menu555").show();
      $("#menu666").hide();
      $("#menu777").hide();
      $(".selMenu_group").removeClass("selMenu_group");
      $(this).children().addClass("selMenu_group");
    });
    
    $("#menu66").click(function () {
      $("#menu111").hide();
      $("#menu222").hide();
      $("#menu333").hide();
      $("#menu444").hide();
      $("#menu555").hide();
      $("#menu666").show();
      $("#menu777").hide();
      $(".selMenu_group").removeClass("selMenu_group");
      $(this).children().addClass("selMenu_group");
    });
    
    $("#menu77").click(function () {
      $("#menu111").hide();
      $("#menu222").hide();
      $("#menu333").hide();
      $("#menu444").hide();
      $("#menu555").hide();
      $("#menu666").hide();
      $("#menu777").show();
      $(".selMenu_group").removeClass("selMenu_group");
      $(this).children().addClass("selMenu_group");
    });

    Творение самого коммерчески эффективного разработчика студии.

    validol, 19 Апреля 2013

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