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

    В номинации:
    За время:
  2. Куча / Говнокод #5029

    +133

    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
    <form action="/admin.php?action=edit_category&name=razdel1" method="post">
    <table>
    <tr>
        <td>
            <input type="image" src="views/admin/i/save.png" value="Сохранить" />
        </td>
    </tr>
    <tr>
        <td>
            Название раздела: 
            <input type="text" name="name" value="Раздел1" size="41" maxlength="128" />
        </td>
    </tr>
    </table>
    </form>

    "Имею большой опыт в области веб-программирования" говорите? Вот кусок творения нашего прославившегося клована Мишустика. Пруф для лулзов будет ниже в комменте.

    Викинул лишнее и отформатировал для простоты понимания.
    Как можно догадаться, редактирование раздела производится по идентификатору в параметре name, передаваемому методом GET. Название же раздела передается в одноименном параметре, только методом POST. Оригинально, да?

    А как же задается идентификатор раздела? Обычным транслитом из названия!
    Изменяем название с "Раздел1" на "Раздел2" - Сохранить - "Название раздела изменено!" Ок. Остаемся в этой же форме и пробуем изменить название обратно, сохраняем... А хрен вам - "Раздела не существует!"
    Ну правильно, че! Идентификатор раздела в базе изменился на "razdel2", а форма по прежнему работает с "razdel1".

    Вот такая вот реализация ЧПУ. Из этих идентификаторов потом строится адрес страницы а-ля http://test.soft-oskol.ru/razdel1/index.html

    Uchkuma, 23 Декабря 2010

    Комментарии (97)
  3. Java / Говнокод #3535

    +89

    1. 1
    pp = pp++;

    Что хотел сказать автор?...

    tinynick, 22 Июня 2010

    Комментарии (97)
  4. Pascal / Говнокод #27689

    +1

    1. 1
    2. 2
    3. 3
    Ой, девачьки, я 5 лет не заходило. Почему нет говнокодов на Дульфи? Я десять страниц промотал! Неужели все дульфисты впали 
    в старческий маразм и не могут больше срать на этом недоязыке? Почему? Он же изначально создавался для даунов.
    Что стало с Тарасом? Что стало с поняшей-ассемблеристом?

    Только одфаги меня вспомнят.

    DelphiGovno, 28 Сентября 2021

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

    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
    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
    using System;
     
    namespace MainNamespace
    {
        class SelectionSort
        {
            private static int FindSmallest(int[] arr)
            {
                int smallest = arr[0];
                int smallestIndex = 0;
                for (int i = 1; i < arr.Length; i++)
                {
                    if (arr[i] < smallest)
                    {
                        smallest = arr[i];
                        smallestIndex = i;
                    }
                }
                return smallestIndex;
            }
            public static int[] ArraySort(int[] arr)
            {
                int[] newArr = new int[arr.Length];
                for (int i = 0; i < arr.Length; i++)
                {
                    int smallestIndex = FindSmallest(arr);
                    int arrayBeginningIndex = i;
                    newArr[arrayBeginningIndex] = arr[smallestIndex];
                    arr[smallestIndex] = Int32.MaxValue;
                }
                return newArr;
            }
        }
        class MainClass
        {
            const int sizeOfArr = 7;
            static int FindMaxProduct(int[] arr)
            {
                int maxProduct = 1;
                int firstIndex = 0;
                int secondIndex = 1;
                int lastIndex = sizeOfArr - 1;
                int beforeLastIndex = sizeOfArr - 1 - 1;
                int beforeBeforeLastIndex = sizeOfArr - 1 - 2;
     
                if (arr[firstIndex] * arr[secondIndex] * arr[lastIndex] > arr[beforeLastIndex] * arr[beforeBeforeLastIndex] * arr[lastIndex])
                {
                    maxProduct = arr[firstIndex] * arr[secondIndex] * arr[lastIndex];
                }
                else
                    for (int i = 0; i < 3; i++)
                        maxProduct *= arr[lastIndex - i];
     
                return maxProduct;
            }
            static void Main()
            {
                int[] arr = new int[sizeOfArr] {-31, 54, -39, -34, 0, 56, 92};
                arr = SelectionSort.ArraySort(arr);
                Console.WriteLine( FindMaxProduct(arr) );
                Console.ReadKey();
            }
        }
    }

    Есть массив с целыми числами. Найти в этом массиве самое большое произведение 3 чисел и вывести в консоль.

    BelCodeMonkey, 18 Июля 2021

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

    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 math import sqrt
    
    # Пояснение
    print('Это калькулятор полных линейных неравенств')
    print('Эти неравенства выглядят так: a*x^2 +- b*x +- c = 0')
    print('a, b и c - коэффиценты.\n')
    
    # Ввод коэффицентов
    a = int(input('Введите коэффицент a:'))
    b = int(input('Введите коэффицент b:'))
    c = int(input('Введите коэффицент c:'))
    r = 0
    D = 0
    # Решение: вид неравенства
    if b >= 0: 
        g = '+ '
    else:
        g = ''
    if c >= 0: 
        f = '+ '
    else:
        f = ''
    print('Так выглядит уравнение: ' + str(a) + 'x^2 ' + str(g) + str(b) + '*x ' + str(f) + str(c) + ' = 0')
    
    # Решение: коэффиценты и дискриминант
    print('Дискриминант(D) равен b^2 - 4 * a * c')
    print('Значит D = ' + str(b) + '^2 - 4 * ' + str(a) + ' * ' + str(c))
    b = int(b)
    a = int(a)
    c = int(c)
    D = b**2 - 4 * a * c
    print('D = ' + str(D))
    drt = sqrt(D)
    # Решение: ответ
    if D < 0:
        print('Ответ: Уравнение не имеет корней, так как дискриминант меньше нуля')
    elif D == 0:
        print('Уравнение имеет один корень: ')
        x = -b/(2*a)
        print('Корень уравнения: x = ' + str(x))
    elif D > 0: 
        print('Уравнение имеет два корня: ')
        x1 = (-b - drt)/2*a
        x2 = (-b + drt)/2*a
        print("Корни уравнения: x1 = " + str(x1) + ', x2 = ' + str(x2))
    else:
        r = 0

    Вот это чудо Я(гуманитарий) состряпал за 15 минут на второй день изучения питона. Ну как? Так ли худо?

    ni2kta, 31 Мая 2021

    Комментарии (96)
  7. Куча / Говнокод #27287

    −5

    1. 1
    С праздником, девочки! ʕ ᵔᴥᵔ ʔ

    moderat0r, 08 Марта 2021

    Комментарии (96)
  8. JavaScript / Говнокод #26387

    −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
    (function(){
      const panel = document.querySelector('.pane-content > ul');
      function appendLink(text, href) {
        const li = document.createElement('li');
        const a = document.createElement('a');
        li.appendChild(a);
        a.setAttribute('href', href);
        a.innerText = text;
        panel.appendChild(li);
      }
      appendLink("Перелогиниться", 'https://govnokod.ru/user/exit/?url=https://govnokod.ru/user/login');
      appendLink("Регистрация", 'https://govnokod.ru/user/exit/?url=https://govnokod.ru/user/register');
    })();

    Кокококое у гк удобне апи )))

    KpunoBblu_nemyx, 28 Января 2020

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

    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
    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
    <vistefan> In recently installed Manjaro i have this (https://imgur.com/a/e0Prjez) instead of proper AwesomeWM menu called by Super button. Any Ideas? Tried to install additional fonts. Locales are correct.
    <HEX0> !give vistefan manjaro
    <phrik> vistefan: manjaro does things differently from arch, so we can't really support it. ask in #manjaro or ##linux
    <SGOrava> vistefan: you would be fine as long as you do not mention other distributions and pretend to be using Arch, is it that hard ? Even I do that :D
    <SGOrava> vistefan: My idea is that you are missing some fonts or locale...
    <vistefan> SGOrava, :D
    <Scimmia> !give SGOrava notarch
    <phrik> SGOrava: This channel is for Arch Linux support only. Also see https://wiki.archlinux.org/index.php/Code_of_conduct#Arch_Linux_distribution_support_.2Aonly.2A
    <thingfish> you're better off being up front, from the beginning about what you're running.
    <Scimmia> seriously, we don't want you here if you're going to act like a total piece of shit
    <SGOrava> Scimmia: I know sure, but as long as one knows what one can ask here than it is fine
    <Scimmia> no, it's not
    <Scimmia> at all
    <SGOrava> how is it not ?
    <Scimmia> If you're not on Arch, it's not OK, end of story
    <SGOrava> what is wrong with that when one wants to ask a question 
    <Namarrgon> lying about your distro? ban
    <Scimmia> and asking here implies it's Arch, so knowing the rules and asking anyway is lying
    <SGOrava> why be so pedantic ?
    <Namarrgon> we don't like liars
    <SGOrava> that is why I said one needs to know what belongs here and what does not
    <thingfish> people who help in here have a hard enough time supporting actual Arch users.  They don't need to be wasting their time chasing down some issue for other distros, which should have their own support channels.
    <Namarrgon> support for other distros does not belong here
    <SGOrava> Namarrgon: peopúle lie everyday just to survive
    <Namarrgon> that's a shitty excuse
    <cyveris> That's a shitty person.
    <SGOrava> why are you so hostile ?
    <Namarrgon> if you don't like our rules then you there are plenty of other channels that you can join
    <thingfish> because you don't seem to have a clue, dude.
    <Namarrgon> SGOrava: because you are telling other people to lie to the community just to get support
    <SGOrava> I am not, I am telling them to distinguish where the problem is and ask at the source
    <demonicmaniac3> 21:14 < SGOrava> vistefan: you would be fine as long as you do not mention other distributions and pretend to be using Arch, is it that hard ?
    <Scimmia> and if it's not Arch, the problem is not here
    <demonicmaniac3> you are telling them to pretend to use arch when they ask questions
    <Scimmia> SGOrava: sounds like you aren't running arch...
    <SGOrava> I am running Arch, half of the packages comes from Arch repos, so I run Arch
    <Scimmia> So that's a no
    <thingfish> aargh
    <HEX0> !roulette
    * phrik has kicked HEX0 from #archlinux (BANG!)
    <Scimmia> !give SGOrava notarch
    <cyveris> Bold move, cotton.
    * phrik reloads and spins the chambers.
    <phrik> SGOrava: This channel is for Arch Linux support only. Also see https://wiki.archlinux.org/index.php/Code_of_conduct#Arch_Linux_distribution_support_.2Aonly.2A
    <SGOrava> how is it a no ?
    <Scimmia> SGOrava: where do the other half come from?
    <SGOrava> Scimmia: you still would not care
    <Scimmia> yep, not Arch
    <SGOrava> I know what to ask where (mostly)
    <Scimmia> if you're asking here about anything at all, you obviously don't
    <SGOrava> ??
    <Namarrgon> SGOrava: https://wiki.archlinux.org/index.php/Code_of_conduct#Arch_Linux_distribution_support_*only*
    <phrik> Title: Code of conduct - ArchWiki (at wiki.archlinux.org)
    * HEX0 (~HEX0@unaffiliated/hex0) has joined
    <Namarrgon> you can use whatever distro you want but that doesn't mean that we have to put up with your nonsense
    <cyveris> SGOrava: You're not using Arch Linux. You're using some derivative. Hence, this is not the channel for you, and now that everyone here knows you advocate for lying about it to get help, no one will help you.
    <SGOrava> Namarrgon: sorry, it is too long
    <Namarrgon> alright
    <SGOrava> cyveris: nope, it is channel for me when I have problems which are sourced from Arch
    <Scimmia> SGOrava: and now that you know the rules, ask here and get banned
    <SGOrava> Scimmia: what should I ask ?
    <cyveris> And here we go.
    <SGOrava> cyveris: you said I should ask something, so think about it
    <HEX0> stop talking and install arch linux while you can

    vistefan, 29 Декабря 2019

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

    +2

    1. 1
    2. 2
    3. 3
    https://tjournal.ru/analysis/128216-moshenniki-3-0-kak-ne-popastsya-na-udochku-novogo-pokoleniya-prestupnikov-v-sfere-it
    
    https://leonardo.osnova.io/0234cd39-a2ef-c6d8-d8df-87df562f9997/-/scale_crop/600x398/center/

    booratihno, 30 Ноября 2019

    Комментарии (96)
  11. Си / Говнокод #25899

    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
    #include <ncurses.h>
    
    #if defined(_WIN32) || defined(_WIN64) 
        #include <windows.h>
        #define msleep(msec) Sleep(msec)
    #else
        #include <unistd.h>
        #define msleep(msec) usleep(msec*1000)
    #endif
    
    int main()
    {
        initscr();
    
        char str[100];
        addstr("Enter string: ");
        getstr(str); //Считваем строку
        curs_set(0); //"Убиваем" курсор, чтобы не мешался
        while ( true )
        {
        //Перемещаем х-координату как можно дальше вправо, и будем уменьшать её, пока она != 0
            for ( unsigned x = getmaxx(stdscr); x; x-- ) 
            {
                clear();
                mvaddstr(getmaxy(stdscr) / 2, x, str);
                refresh();
                msleep(200);
            }
        }
    
        endwin();
        return 0;
    }

    https://code-live.ru/post/ncurses-input-output/#getstr-
    Сколько хуйни вы можете найти в этом примере?

    j123123, 04 Октября 2019

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