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

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

    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
    private String getStringDelimitedNullByte(Collection<String> stringList){
        byte delimiter = (byte) 0;
        int numBytes = 0;
        int index = 0;
        List<Byte> byteList = new ArrayList<>();
        int stringListsize = stringList.size();
    
        for (String str : stringList) {
            numBytes += str.getBytes().length;
        }
    
        for (String str : stringList) {
            byte[] currentByteArr = str.getBytes();
            for (byte b : currentByteArr) {
                byteList.add(b);
            }
            index++;
            if (index < stringListsize) byteList.add(delimiter);
        }
        Byte[] byteArr = byteList.toArray(new Byte[numBytes]);
        return new String(ArrayUtils.toPrimitive(byteArr));
    }

    qwerty123, 24 Апреля 2020

    Комментарии (1)
  3. Куча / Говнокод #26562

    −1

    1. 1
    https://pastebin.com/uu1YLnFD

    Я хотел бы запостить целиком, да страйко сжимает булыжники.

    nudop, 08 Апреля 2020

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

    +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
    private void MainDataGridCellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
    {
                if (e.Column == MainDataGrid.Columns[1])
                    return;
    
                if (CheckComplianceWithIndentation)
                    if ((NumberOfLeadingSpaces(Rows[e.Row.GetIndex()].OriginalText) != NumberOfLeadingSpaces(Rows[e.Row.GetIndex()].Translation)) && !Rows[e.Row.GetIndex()].Tags.Contains("I"))
                        Rows[e.Row.GetIndex()].Tags += "I";
                    else if (NumberOfLeadingSpaces(Rows[e.Row.GetIndex()].OriginalText) == NumberOfLeadingSpaces(Rows[e.Row.GetIndex()].Translation))
                        Rows[e.Row.GetIndex()].Tags = Rows[e.Row.GetIndex()].Tags.Replace("I", "");
    
                if ((Rows[e.Row.GetIndex()].Translation.Trim() == "") && !Rows[e.Row.GetIndex()].Tags.Contains("N"))
                    Rows[e.Row.GetIndex()].Tags += "N";
                else if (Rows[e.Row.GetIndex()].Translation.Trim() != "")
                    Rows[e.Row.GetIndex()].Tags = Rows[e.Row.GetIndex()].Tags.Replace("N", "");
    
                //...
    }
    
    public void TagsInit()
    {
                if (CheckComplianceWithIndentation)
                    foreach (var hRow in Rows.Where(hRow => NumberOfLeadingSpaces(hRow.OriginalText) != NumberOfLeadingSpaces(hRow.Translation)))
                    {
                        hRow.Tags += "I";
                    }
    
                foreach (var row in Rows.Where(hRow => hRow.Translation == ""))
                {
                    row.Tags += "N";
                }
    }

    Дано: C#, WPF, DataGrid, таблица.
    Надо сделать: таблица имеет поля, в том числе и поле Tags, которое определяется полями Translation и OriginalText, а также настройками пользователя (CheckComplianceWithIndentation), нет бы его вынести в класс строки как геттер:
    public string Tags => f(Translation, Original);

    вместо:
    private string _tags;
    public string Tags
    {
    get => _tags;
    set
    {
    _tags = value;
    RaisePropertyChanged("Tags");
    }
    }

    Так нет же, будем отлавливать изменения ячеек таблицы (MainDataGridCellEditEnding) и пересчитывать Tags. MainDataGrid.Columns[1] - это колонка с ними, прибито гвоздями в xaml: CanUserReorderColumns="False"

    Эх, а еще и Trim вместо String.IsNullOrWhiteSpace.

    А еще немного венгерской говнонотации (hRow).

    Так я писал где-то лет 7 назад. Да, тогда стрелок не было, но они приведены в описании тупо для сокращения строк кода.

    Janycz, 08 Марта 2020

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

    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
    $('#search-map').on('click', '.v-card-prev', function () {
                var v_next = $(this)
                    .parent()
                    .find('.v-card-img-block .v-card-img-hidden.active')
                    .prev();
                if ($(v_next).length == 0) {
                    $(this)
                        .parent()
                        .find('.v-card-img-hidden.active')
                        .removeClass('active');
                    $(this)
                        .parent()
                        .find('.v-card-img-hidden:last')
                        .addClass('active');
                } else {
                    $(this)
                        .parent()
                        .find('.v-card-img-hidden.active')
                        .removeClass('active');
                    $(this)
                        .parent()
                        .find(v_next)
                        .addClass('active');
                }
                $(this)
                    .parent()
                    .find('.v-card-img-hidden.active')
                    .click();
            });
    
            $('#search-map').on('click', '.offers-favorite', function () {
                var favorID = $(this)
                    .closest('.js__product')
                    .attr('data-item');
                if ($(this).hasClass('active')) var doAction = 'delete';
                else var doAction = 'add';
                updateFavorite(favorID, doAction);
                return false;
            });

    phpBidlokoder2, 18 Февраля 2020

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

    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
    ебучая ссала
    
            case AccountStatuses.Blocked if acc.properties.get(GamStopService.GamStopVerification)
              .map(_.extract[String](DefaultFormats, implicitly[Manifest[String]]))
              .contains(GamStopStatus.NotPassed.toString) =>
              \/.left(AuthenticationError(ErrorCodes.GamStopUnauthorized, s"GamStop validation failed"))
    
    почему ты сука молдавская не можешь добавить метод блять а аккаунт сук ачтобы было 
    
            case AccountStatuses.Blocked if acc.contains(GamStopStatus.NotPassed) =>
              \/.left(AuthenticationError(ErrorCodes.GamStopUnauthorized, s"GamStop validation failed"))
    
    почему хуиа?

    говно блять

    levxxx, 21 Января 2020

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

    0

    1. 1
    Еб твою мать! Еб твою мать! Еб твою мать!

    Konardyan, 18 Января 2020

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

    −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
    var dockStation = new Vue({
      el: '#dock',
      data: {
        enable: false,
        text1: 'one',
        text2: 'two',
        text3: 'three',
        concat: ''
      },
      watch: {
        text1: function(v) {
          this.concat = 'You listen:' + v + ' ' + this.text2+' '+this.text3;
        },
        text2: function(v) {
          this.concat = 'You listen:' + this.text1+' '+v+' '+this.text3;
        },
        text3: function(v) {
          this.concat = 'You listen:' + this.text1+' '+this.text2+' '+v;
        },
      }
    });

    когда ебашил нахуй в далеком 2015 году ахуенном получал за такой код 100 кусков в месяц
    ебаать врмеена были

    codershitter, 05 Января 2020

    Комментарии (1)
  9. Си / Говнокод #26293

    −2

    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
    int month, print_client, records_printed = 0;
    int distinc[LENGTH];
    // получение month, создание файла и что-то ещё...
    for (int ci = 0; ci < clen; ci++)
    {
        print_client = 0;
        for (int i = 0; i < LENGTH; i++)
            if (distinc[i])
                distinc[i] = 0;
            else break;
        for (int ri = 0; ri < rlen; ri++) {
            if (clients[ci].number == records[ri].number && records[ri].cdate.month == month)
            {
                if (!print_client)
                    fprintf(file, "%s, %lli:\n", clients[ci].fullname, clients[ci].number);
                ++print_client;
                int service = records[ri].service;
                for (int i = 0; i < LENGTH; i++)
                {
                    if (distinc[i])
                    {
                        if (distinc[i] == service)
                            service = 0;
                    }
                    else
                    {
                        distinc[i] = service;
                        break;
                    }
                }
                if (service)
                {
                    for (int si = 0; si < slen; si++)
                    {
                        if (service == services[si].code)
                        {
                            fprintf(file, "\t%s\n", services[si].name);
                            ++records_printed;
                            break;
                        }
                    }
                }
            }
        }
    }

    Имитация СУБД и запроса с исключением повторений

    groser, 30 Декабря 2019

    Комментарии (1)
  10. Куча / Говнокод #26281

    −3

    1. 1
    Пидарас, ты забанил много моих учеток, в т.ч. Барака Обаму, при этом в упор не увидев шпану, вроде петухов и борманда.

    Никогда тебе этого не прощу!

    Bad_Wolf, 27 Декабря 2019

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

    −3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    https://govnokod.ru/26202
    https://govnokod.ru/26076
    https://govnokod.ru/26089
    
    проблема решена)
    Всем спасибо, все свободны

    TTcuxonam, 12 Декабря 2019

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