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

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

    +3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    #include <windows.h>
    int main() {
    	HDC dc = CreateCompatibleDC (NULL);
    	SetLayout (dc, LAYOUT_RTL);
    	ScaleWindowExtEx (dc, -2147483647 - 1, -1, 1, 1, NULL);
    }

    bsod

    laMer007, 22 Июля 2016

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

    +8

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    public static class StringExtensions
        {
            public static bool IsNulldOrEmpty(this string str)
            {
                return string.IsNullOrEmpty(str);
            }
        }

    why

    antoanelenkov, 12 Декабря 2015

    Комментарии (47)
  4. Куча / Говнокод #19072

    +5

    1. 1
    2. 2
    WCT воскрес.
    http://habrahabr.ru/post/271519/

    Abbath, 24 Ноября 2015

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

    +142

    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
    void BloomPattern::process(GLuint rectangleVao, float blurRadius) const
    {
       sptrFrameBufferTwo->enable();
       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
       sptrBrightPassShaderProgram->enable();
       glActiveTexture(GL_TEXTURE0);
       glBindTexture(GL_TEXTURE_2D, sptrFrameBufferThree->getColorTexture().getTexture());
       sptrBrightPassShaderProgram->setUniform("colorTexture", 0);
       glBindVertexArray(rectangleVao);
       glViewport(0, 0, windowWidth >> 1, windowHeight >> 1);
       glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, nullptr);
       sptrFrameBufferOne->enable();
       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
       sptrBlurShaderProgram->enable();
       glBindTexture(GL_TEXTURE_2D, sptrFrameBufferTwo->getColorTexture().getTexture());
       sptrBlurShaderProgram->setUniform("defaultTexture", 0);
       sptrBlurShaderProgram->setUniform("blurRadius", 1.0F / (windowWidth >> 1), 0.0F, blurRadius);
       glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, nullptr);
       sptrFrameBufferTwo->enable();
       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
       glBindTexture(GL_TEXTURE_2D, sptrFrameBufferOne->getColorTexture().getTexture());
       sptrBlurShaderProgram->setUniform("defaultTexture", 0);
       sptrBlurShaderProgram->setUniform("blurRadius", 0.0F, 1.0F / (windowHeight >> 1), blurRadius);
       glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, nullptr);
       sptrFinalFrameBuffer->enable();
       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
       sptrBloomShaderProgram->enable();
       glBindTexture(GL_TEXTURE_2D, sptrFrameBufferThree->getColorTexture().getTexture());
       glActiveTexture(GL_TEXTURE1);
       glBindTexture(GL_TEXTURE_2D, sptrFrameBufferTwo->getColorTexture().getTexture());
       sptrBloomShaderProgram->setUniform("defaultTexture", 0);
       sptrBloomShaderProgram->setUniform("brightpassTexture", 1);
       glViewport(0, 0, windowWidth, windowHeight);
       glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, nullptr);
       glBindFramebuffer(GL_FRAMEBUFFER, 0);
    }

    jangolare, 07 Июля 2015

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

    +169

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    for (var i = 0; i < result.Results.length; i++) {
        data = result.Results;
        if (i == 0) {
            $calendarPins = jQuery.parseJSON(data[i].Markers);
            GoogleMapsInitialization();
        }
    }

    Аж за душу взяло...

    zloynightmare, 09 Января 2015

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

    +164

    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
    // В шаблоне вот так:
    <DIV  class="tel"><? include ("/home/***/www/inc/calend.php"); ?><BR>
    // А в файле вот так:
    <?
    
    $calend = array(
    "17.05.2014", 
    "18.05.2014", 
    "24.05.2014",
    "25.05.2014",
    "31.05.2014",
    "01.06.2014",
    "07.06.2014",
    "08.06.2014",
    "12.06.2014",
    "13.06.2014",
    "14.06.2014",
    "15.06.2014",
    "21.06.2014",
    "22.06.2014",
    "28.06.2014",
    "29.06.2014",
    "05.07.2014",
    "06.07.2014",
    "12.07.2014",
    "13.07.2014",
    "19.07.2014",
    "20.07.2014",
    "26.07.2014",
    "27.07.2014",
    "02.08.2014",
    "03.08.2014",
    "09.08.2014",
    "10.08.2014",
    "16.08.2014",
    "17.08.2014",
    "23.08.2014",
    "24.08.2014",
    "30.08.2014",
    "31.08.2014",
    "07.09.2014",
    "13.09.2014",
    "14.09.2014",
    "20.09.2014",
    "21.09.2014",
    "27.09.2014",
    "28.09.2014",
    "04.10.2014",
    "05.10.2014",
    "11.10.2014",
    "12.10.2014",
    "18.10.2014",
    "19.10.2014",
    "25.10.2014",
    "26.10.2014",
    "01.11.2014",
    "02.11.2014",
    "03.11.2014",
    "04.11.2014",
    "08.11.2014",
    "09.11.2014",
    "15.11.2014",
    "16.11.2014",
    "22.11.2014",
    "23.11.2014",
    "29.11.2014",
    "30.11.2014",
    "07.12.2014",
    "13.12.2014",
    "14.12.2014",
    "20.12.2014",
    "21.12.2014",
    "27.12.2014",
    "28.12.2014"
    );
    
    
    
    if (in_array(date("d.m.Y",time()), $calend)) {
    echo "(343) 266-30-54";
    }
    
    else echo '(343) 222-77-60';
    
    
    
    
    
    ?>

    Это так вот происходит подмена телефона в выходные дни, да.

    Shimmy, 19 Декабря 2014

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

    +61

    1. 1
    int len = dynamic_cast<GatewayRec *>(*Iter)->PrefixMatch(aliases, matchedalias, priority);

    gnugk

    bormand, 02 Сентября 2014

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    for (conn_vector::iterator i = m_connections.begin(); i != m_connections.end(); ++i) {
        if (*i == conn) {
            m_connections.erase(i);
            toDelete = *i;
            break;
        }
    }

    Да, С++98. Да, в std::find не умеем. Да, сегфолт. Да, моё.

    Elvenfighter, 27 Августа 2014

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

    +58

    1. 1
    #define CHK( x ) {do{if (x == MBRES_ERR){goto __gotoFAIL;}} while (FALSE);}

    Из SDK корейского сканера

    snw, 08 Августа 2014

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

    +19

    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
    template<class T>
    class smartest_ptr
    {
    std::unique_ptr<T> m_p;
    std::array<char, sizeof(T)> m_data; // массив размером с объект
    public:
    void New() {m_p = new(&m_data) T();}
    operator ->() {return m_p;}
    };
    
    // никакого выделения памяти из кучи!
    smartest_ptr<CFoo> pFoo; // типа nullptr
    // pFoo->Method(); - нельзя, nullptr
    pFoo.New();
    pFoo->FooMethod();
    pFoo->AnotherMeth();

    -- Чип и ДейлКрестовики спешат на помощь тем у кого медленная куча.
    -- Откуда спешат?
    -- Оттуда.

    LispGovno, 26 Января 2014

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