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

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

    +161

    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
    // START MY FOR MENU
    $list_pages = preg_replace('/<li([^>]*)>/is', ' ', $output);
    $list_pages = str_replace('</li>', '', $list_pages);
    $list_pages = preg_replace('/<a/is', '</td><td class="menu"> <a$1', $list_pages);
    
    if (isset($_GET['page_id']) AND !is_numeric($_GET['page_id'])) { exit("ERROR!"); }
    $pd = mysql_real_escape_string($_GET['page_id']);
    if(strstr($_SERVER['REQUEST_URI'], 'page_id='.$pd) == TRUE) {
    $list_pages = preg_replace('/<\/td><td class=\"menu\"\> <a href=\"(http:\/\/'.$_SERVER["HTTP_HOST"].'\/\?page_id='.$pd.')/is', '</td><td class="menu_click"><a href="$1', $list_pages);
    }
    
    for($i=0; $i<sizeof($pages); $i++) {
    $link = $pages[$i]->guid;
    $lol = '';
    if(strstr($_SERVER['REQUEST_URI'], '?') == TRUE) {
    if ($link == 'http://'.$_SERVER['HTTP_HOST'].'/?'.$_SERVER['QUERY_STRING']) {
    $list_pages = preg_replace('/<\/td><td class=\"menu\"\> <a href=\"(http:\/\/'.$_SERVER["HTTP_HOST"].'\/\?'.$_SERVER["QUERY_STRING"].')/is', '</td><td class="menu_click2"><a href="$1', $list_pages);
    }
     } else {
    if ($link == 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']) {
    $list_pages = preg_replace('/<\/td><td class=\"menu\"\> <a href=\"(http:\/\/'.$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"].')/is', '</td><td class="menu_click2"><a href="$1', $list_pages);   
    }
       }
    }
    
    
         $output = $list_pages;
         $str = preg_split("/<\/a\>/i", $output);
         $moar = '';
       for ($i=0; $i<sizeof($pages); $i++)
       {
         $moar .= preg_replace('/<\/td><td class=\"menu\"\> <a href=\"(.*)\" title=\"(.*)\">/is', 
         '</td><td class="menu" onclick="linkgo(\'$1\');" id="moar'.$i.'" onmouseover="menu1(\'moar'.$i.'\');" onmouseout="menu2(\'moar'.$i.'\');"> <a href="$1" title="$2">', $str[$i]);
         $moar .= "</a>";
         }
        $output = $moar;
        
    // END MY FOR MENU

    None ;)

    Furry, 18 Января 2011

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

    +155

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    <?php
    $url = $_GET['url'];
    $url = str_replace('http://', '', $url);
    echo '<a href="http://$url">123</a>';
    ?>

    Мартин, 03 Сентября 2010

    Комментарии (68)
  4. C# / Говнокод #4156

    +145

    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
    public double FindMax(double num1, double num2, double num3)
        {
            double max = num1;
            if (num2 > max)
            {
                max = num2;
            }
            if (num3 > max)
            {
                max = num3;
            }
            return max;
        }

    KamaZz, 02 Сентября 2010

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

    +161

    1. 1
    2. 2
    width ? width-- : width;
    height ? height-- : height;

    Ахуй нехуевый. Не говнокод, наверно, но всё же.

    Altravert, 23 Июля 2010

    Комментарии (68)
  6. Куча / Говнокод #29285

    0

    1. 1
    IT Оффтоп #240

    #210: https://govnokod.ru/29079 https://govnokod.xyz/_29079
    #211: https://govnokod.ru/29092 https://govnokod.xyz/_29092
    #212: https://govnokod.ru/29093 https://govnokod.xyz/_29093
    #213: https://govnokod.ru/29104 https://govnokod.xyz/_29104
    #214: https://govnokod.ru/29114 https://govnokod.xyz/_29114
    #215: https://govnokod.ru/29125 https://govnokod.xyz/_29125
    #216: https://govnokod.ru/29132 https://govnokod.xyz/_29132
    #217: https://govnokod.ru/29147 https://govnokod.xyz/_29147
    #218: https://govnokod.ru/29156 https://govnokod.xyz/_29156
    #219: https://govnokod.ru/29166 https://govnokod.xyz/_29166
    #220: https://govnokod.ru/29181 https://govnokod.xyz/_29181
    #221: https://govnokod.ru/29185 https://govnokod.xyz/_29185
    #222: https://govnokod.ru/29190 https://govnokod.xyz/_29190
    #223: https://govnokod.ru/29203 https://govnokod.xyz/_29203
    #224: https://govnokod.ru/29211 https://govnokod.xyz/_29211
    #225: https://govnokod.ru/29212 https://govnokod.xyz/_29212
    #226: https://govnokod.ru/29218 https://govnokod.xyz/_29218
    #227: https://govnokod.ru/29220 https://govnokod.xyz/_29220
    #228: https://govnokod.ru/29230 https://govnokod.xyz/_29230
    #229: https://govnokod.ru/29235 https://govnokod.xyz/_29235
    #230: https://govnokod.ru/29241 https://govnokod.xyz/_29241
    #231: https://govnokod.ru/29246 https://govnokod.xyz/_29246
    #232: https://govnokod.ru/29249 https://govnokod.xyz/_29249
    #233: https://govnokod.ru/29253 https://govnokod.xyz/_29253
    #234: https://govnokod.ru/29259 https://govnokod.xyz/_29259
    #235: https://govnokod.ru/29262 https://govnokod.xyz/_29262
    #236: https://govnokod.ru/29267 https://govnokod.xyz/_29267
    #237: https://govnokod.ru/29271 https://govnokod.xyz/_29271
    #238: https://govnokod.ru/29274 https://govnokod.xyz/_29274
    #239: https://govnokod.ru/29281 https://govnokod.xyz/_29281

    nepeKamHblu_nemyx, 29 Сентября 2026

    Комментарии (67)
  7. Python / Говнокод #27426

    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
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    from colorama import init, Fore, Back, Style
    init()
    print(Back.BLACK)
    print(Fore.RED)
    print(Style.NORMAL)
    print("Script mamoeba/Скрипт сделан")
    print("┌────────────────────────────────────┐")
    print("│Author : GovnoCode user                  │")
    print("│Github : https://:/│")
    print("└────────────────────────────────────┘")
    print("YouTube: utube")
    print("▄▀▄ █▄░▄█ ▀ █▄░█ ▄▀▄ ▄▀▄ █▀▄ ▐▌░▐▌ █▀▄ ▄▀▄")
    print("█▀█ █░█░█ █ █░▀█ █░█ █▀█ █░█ ░▀▄▀░ █▀█ █░█")
    print("▀░▀ ▀░░░▀ ▀ ▀░░▀ ░▀░ ▀░▀ ▀▀░ ░░▀░░ ▀▀░ ░▀░")
    print("Advertise Bot Amino")
    lz = []
    from concurrent.futures import ThreadPoolExecutor
    import concurrent.futures
    import amino
    def advertise(data):
        listusers = []
        for userId in data.profile.userId:
            listusers.append(userId)
        return listusers
        
    email = input("Email/Почта: ")
    password = input("Password/Пароль: ")
    msg = input("Message/Сообщение: ")
    client = amino.Client()
    client.login(email=email, password=password)
    clients = client.sub_clients(start=0, size=1000)
    for x, name in enumerate(clients.name, 1):
        print(f"{x}.{name}")
    communityid = clients.comId[int(input("Выберите сообщество/Select the community: "))-1]
    sub_client = amino.SubClient(comId=communityid, profile=client.profile)
    users = sub_client.get_online_users(size=1000)
    user = advertise(users)
    for i in lz:
            if i in user:
                user.remove(i)
         
            
    print("Sending Advertise")
    for _ in range(4000):
        with concurrent.futures.ThreadPoolExecutor(max_workers=40000) as executor:
            _ = [executor.submit(sub_client.start_chat, user, msg) for userId in user]
    
    print("Sending Advertise 2")
    for _ in range(4000):
        with concurrent.futures.ThreadPoolExecutor(max_workers=40000) as executor:

    Flow, 13 Мая 2021

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

    −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
    #include <iostream>
    #include <string>
    
    using namespace std;
    
    struct A
    {
        uint16_t    n;
    
        uint8_t     a1:1;
        uint8_t     a2:1;
        uint8_t     a3:1;
        uint8_t     a4:1;
        uint8_t     a5:4;
    
        uint8_t     b;
    } __attribute__((packed));
    
    int main()
    {
        char v[] = { 0x1, 0x1, 0b01010011, 0x9 };
        A *p = (A*)v;
        
        cout << (uint16_t)p->a1 << endl;
        cout << (uint16_t)p->a2 << endl;
        cout << (uint16_t)p->a3 << endl;
        cout << (uint16_t)p->a4 << endl;
        cout << (uint16_t)p->a5 << endl;
        cout << (uint16_t)p->b << endl;
    }

    http://cpp.sh/6e5myf

    Битовые поля неправильно считываются.

    YpaHeLI_, 12 Октября 2020

    Комментарии (67)
  9. Куча / Говнокод #26937

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    > https://habr.com/ru/post/518308/
    > Мне надоело, что индустрия зависит от прихоти создателей языков программирования. Сообществу нужно больше власти
    
    > В языках вечно не хватает чего-то простого — лямбда-функций,
    > именованных объединений, кастомных примитивных типов. Я лезу
    > в обсуждения на Stack Overflow, в Github и вижу, как разрабы жалуются
    > — им не хватает того же, чего и мне. Но обсуждения почти всегда
    > заканчиваются одинаково: нужная фича не появится, потому что
    > главный дизайнер языка и члены его команды нужной ее не считают.

    Именно поэтому я за Си. Хорошо что есть крестопарашная помойка, в которую дизайнеры языка добавляют всякую хуйню по желанию каждого встречного и поперечного. Если б такого не было, всю эту поебень пытались бы пропихнуть в Си. Так что от крестопараши определенно есть какая-то польза.

    j123123, 09 Сентября 2020

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

    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
    // sorry, I don't want to use any JS templater
    // so I'll concatenate html as strings, which is the worst practice
    // but my IntelliJ IDEA highlights html in strings well :)
    // and I write this code just4fun
    //
    // but to respect production I'll leave here something that will never be fixed
    // TODO: rewrite in Angular.js
    //
    // done!
    
    // ...
    
    // u still read this spaghetti?
    
    let evaluate = (s) => {
        completion = [];
        hist = [];
    
        let tokens = s.split(' ').filter((s) => s !== '');
    
        if (!tokens[0]) return;
        histfile.push(s);
    
        if (tokens[0] === 'clear') clear();
        else if (tokens[0] === 'aplay') aplay();
        else if (tokens[0] === 'man') try {
            template(tokens.slice(0, 2).join('_'))();
        } catch {
            stdout('No manual entry for <span class="red">' + tokens[1] + '</span>')
        }

    Сайт-визитка на plain js для подкаста в виде эмулятора терминала с пасхалками
    https://deveeps.prost.host/

    vistefan, 19 Февраля 2020

    Комментарии (67)
  11. Pascal / Говнокод #26325

    −3

    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
    1)
    const
      OUT_OF_BOUNDS:TPoint=(X:-1; Y:-1);
    var
      INT_OUT_OF_BOUNDS:Integer absolute OUT_OF_BOUNDS;
    
    TargetForm.Perform(WM_LBUTTONUP,0,INT_OUT_OF_BOUNDS);
    
    2)
    const
      ZERO_ZERO:TPoint=(X:0; Y:0);
    var
      INT_ZERO_ZERO:Integer absolute ZERO_ZERO;
    
    TargetForm.Perform(WM_LBUTTONUP,0,INT_ZERO_ZERO);
    
    3)
    TargetForm.Perform(WM_LBUTTONUP,0,0);

    Болею. Стояла задача воспроизвести системное меню. Но оказалось, что при клике на элемент фейкового системного меню, форме не посылается WM_LBUTTONUP и кнопка-иконка не перекрашивается в ненажатый вид. Решил перформить WM_LBUTTONUP прямо при клике, но туда нужно передавать координаты мышки куда был совершён клик в High(lParam) и Low(lParam). Сначала хотел передавать -1;-1 но подумал что передавать туда $FFFFFFFF как-то некрасиво, а прямое приведение типов а-ля Integer(Point(-1,-1)) оно у меня хавать не захотело, и поэтому красоты ради наговнокодил первый вариант кода. Потом подумал, а что если там только положительные значения, будет же 65535;65535 непорядок, лучше буду передавать нули. Впихнуть туда просто 0 сразу в голову не пришло (болею же, башка квадратная) и наговнокодил второй вариант.

    Потом, конечно же, написал всё по нормальному.

    KOTOM, 07 Января 2020

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