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

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

    +1

    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
    protocol Multi {
        associatedtype T
        associatedtype U
    
        func printSelf()
    }
    
    extension Multi where T == Int, U == Float {
        func printSelf() {
            print("Int & Float!")
        }
    }
    
    extension Multi where T == String, U == Int {
        func printSelf() {
            print("String & Int!")
        }
    }
    
    extension Multi {
        func printSelf() {
            print("Unknown")
        }
    }
    
    class MultiImplementationIntFloat: Multi {
        typealias T = Int
        typealias U = Float
    }
    
    class MultiImplementationStringInt: Multi {
        typealias T = String
        typealias U = Int
    }
    
    class MultiImplementationInvalid: Multi {
        typealias T = Float
        typealias U = String
    }
    
    let m1 = MultiImplementationIntFloat()
    m1.printSelf()
    
    let m2 = MultiImplementationStringInt()
    m2.printSelf()
    
    let m3 = MultiImplementationInvalid()
    m3.printSelf()

    Multimethods в Swift с проверкой в compile-time

    Desktop, 10 Марта 2018

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

    0

    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
    #include <stdio.h>
    #include <string.h>
    #include <math.h>
    
    char *questions[] = {
        "Answer these questions please.",
        "I am HACTEHbKA. Do you know about me?",
        "Do you like my love stories?",
        "By the way, what is your name?",
        "Do you like C++?",
        "Do you like bormand?",
        "bormand is cool, isn't he?",
        "Do you know what does it mean?",
        0,
    };
    
    int main () {
        char answer[10], **question = questions, z[30] = {0}, Z = questions[0x04][0x10];
        
        while (*++question) {
            float x = 1, y = 7;
            char* a = answer;
            puts(*question);
            gets(answer);
            while (*a) {
                x *= 10;
                x += *a / 90;
                a ++;
            }
            y = (9/x - 120)/x/x/x;
            if (y > 170/x - 1263 - 437/x/x) {
                int U = **questions;
                for (U = 1/(x+1); U < ' '; U += 0x10) {
                    float bormand = 9*y-6*x*sqrt(y)-6*sqrt(y)+1.0*x*x*x*x-5.2*x*x*x+11.14*x*x-6.788*x+6;
                    z[Z|U] = questions[5-U/5+1/(int)bormand][(int)(Z + questions[0x06][0x10] / 2.6)];
                    if ((Z|U|7) * (int)question[1] < 30) puts(z + U);
                }
                Z++;
            }
        }
        
        return answer == questions[1];
    }

    https://ideone.com/zDcuG2

    HACTEHbKA, 03 Февраля 2018

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

    0

    1. 1
    2. 2
    Признавайтесь
    http://bash.im/quote/448842

    Недавно насрал туда анекдотом http://bash.im/quote/448781, зашёл покармадрочить, смотрю -- в стоке гк.

    vistefan, 31 Января 2018

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

    −104

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    //-------------------------------------
    Процедура ПриНачалеРаботыСистемы()    
    
    	//Ограничиваем цикл на пользователей...
    	Если (СокрЛП(ИмяПользователя())="Вася") тогда
    		//Делаем вызов процедуры "Оповещение" раз в 3600 секунд (1 час)...
    		ОбработкаОжидания("Оповещение",3600); 
    	КонецЕсли;
    	
    КонецПроцедуры

    Когда надо сделать циклическое обращение к другой процедуре через определённое кол-во времени...

    Anonizmus, 01 Декабря 2016

    Комментарии (47)
  6. 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)
  7. 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)
  8. Куча / Говнокод #19072

    +5

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

    Abbath, 24 Ноября 2015

    Комментарии (47)
  9. 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)
  10. 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)
  11. 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)