1. PHP / Говнокод #27034

    0

    1. 1
    https://pbs.twimg.com/media/EjtRN4HX0AA6FPN.jpg

    MAPTbIwKA, 16 Октября 2020

    Комментарии (91)
  2. Haskell / Говнокод #27033

    −1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    zero :: Integer -> Bool
    zero = (==0)
    
    ieq :: Num p => Bool -> p
    ieq x = if x then 1 else 0
    
    elem' :: (Foldable t, Eq a) => t a -> a -> Bool
    elem' xs x = not $ zero func
                where 
                    func = foldl (\acc y -> acc + (ieq $ x == y)) 0 xs

    Петуху дали поиграть в Haskell.

    digitalEugene, 16 Октября 2020

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

    −1

    1. 1
    Get-NetTCPConnection -State Listen | %{[pscustomobject]@{Port=$_.LocalPort; Process=$(Get-Process -Id $_.OwningProcess)}} | sort {[int]$_.Port}

    Давайте течь от powershell.

    MAPTbIwKA, 15 Октября 2020

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

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    // добавляем новые ссылки
      for i := 0 to ATags.Count - 1 do
      begin
        // так мне кажется лучше
        Application.ProcessMessages;

    кому или чему лучше кроме тебя, автор ?

    xoodoo, 15 Октября 2020

    Комментарии (163)
  5. Kotlin / Говнокод #27030

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    object Cорок {
        infix fun тысяч(b: String) = this
        infix fun в(a: String) = this
        infix fun сунули(a: String) = this
    }
    
    fun main() {
        Cорок тысяч "обезъян" в "жопу" сунули "банан"
    }

    DypHuu_niBEHb, 15 Октября 2020

    Комментарии (57)
  6. C++ / Говнокод #27029

    +5

    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
    #include <iostream>
    #include <set>
    #include <unicode/brkiter.h>
    #include <unicode/unistr.h>
    #include <unicode/coll.h>
    #include <unicode/sortkey.h>
    
    bool hasRepeatingCharacters(const icu::UnicodeString &word)
    {
        icu::Locale locale = icu::Locale::getDefault();
        UErrorCode status = U_ZERO_ERROR;
        std::unique_ptr<icu::BreakIterator> it{icu::BreakIterator::createCharacterInstance(locale, status)};
        if (U_FAILURE(status)) throw 42;
        it->setText(word);
    
        std::unique_ptr<icu::Collator> collator{icu::Collator::createInstance(status)};
        if (U_FAILURE(status)) throw 42;
        collator->setStrength(icu::Collator::SECONDARY);
    
        auto less = [](const icu::CollationKey &k1, const icu::CollationKey &k2){
            UErrorCode status = U_ZERO_ERROR;
            bool isLess = k1.compareTo(k2, status) == UCOL_LESS;
            if (U_FAILURE(status)) throw 42;
            return isLess;
        };
        std::set<icu::CollationKey, decltype(less)> cache(less);
    
        int32_t p = it->first();
        while (p != icu::BreakIterator::DONE) {
            int32_t q = it->next();
            if (q == icu::BreakIterator::DONE)
                break;
    
            icu::CollationKey key;
            collator->getCollationKey(word.tempSubStringBetween(p, q), key, status);
            if (U_FAILURE(status)) throw 42;
    
            if (cache.find(key) != cache.end())
                return true;
    
            cache.insert(key);
            p = q;
        }
    
        return false;
    }
    
    int main()
    {
        icu::UnicodeString words(u8"Example english Боб мир כוכב 民主主義語こんにちは", "utf-8");
    
        icu::Locale locale = icu::Locale::getDefault();
        UErrorCode status = U_ZERO_ERROR;
        std::unique_ptr<icu::BreakIterator> it{icu::BreakIterator::createWordInstance(locale, status)};
        if (U_FAILURE(status)) throw 42;
        it->setText(words);
    
        int32_t p = it->first();
        while (p != icu::BreakIterator::DONE) {
            int32_t q = it->next();
            if (q == icu::BreakIterator::DONE)
                break;
    
            if (it->getRuleStatus() != UBRK_WORD_NONE)
            {
                icu::UnicodeString word{words.tempSubStringBetween(p, q)};
                bool hasRepeats = hasRepeatingCharacters(word);
    
                std::string wordUtf8;
                word.toUTF8String(wordUtf8);
                std::cout << (hasRepeats ? "Has repeats: " : "No repeats: ") << wordUtf8 << std::endl;
            }
    
            p = q;
        }
    
        return 0;
    }

    По мотивам https://govnokod.ru/27025

    Сформировать строку из слов исходной строки, содержащих повторяющиеся буквы.

    В 60 строк, к сожалению, не уложился :(

    bormand, 14 Октября 2020

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

    −1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    Lemma mint_head_eq CR1 CR2 (te : TE) l m r (t t' : list TE) :
        MInt CR1 (l, m, r) (te :: t) ->
        MInt CR2 (l, m, r) t' ->
        exists t'', t' = te :: t''.
      Proof.
        intros H1 H2.
        inversion_ H1; inversion_ H2; (* generates 25 goals *)
        match goal with
          |- (exists _, te :: ?T = te :: _) => now exists T
        end.
      Qed.

    Против метушни нет приёма.

    CHayT, 14 Октября 2020

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

    0

    1. 1
    jQuery( this ).parent().parent().parent().parent().parent().parent().parent().parent().find(".crate_bottle").html(product_crate_price_final);

    arkasha, 13 Октября 2020

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

    −1

    1. 1
    2. 2
    3. 3
    bool CheckRepeat(int cur, int i, char* word) {
    	return (word[cur] != '\0') ? ((word[i] != '\0') ? ((word[cur] == word[i] && cur != i) ? true : CheckRepeat(cur, i + 1, word)) : CheckRepeat(cur + 1, 0, word)) : false;
    }

    Функция проверки слова на повторение букв.
    Задали в институте лабу, в требование входили рекурсия и экономия строк, подпрограммы такого плана понравились преподавателю.

    G0_G4, 13 Октября 2020

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

    0

    1. 1
    2. 2
    3. 3
    Если Ложь Тогда
    	Объ = Документы.ПоступлениеТоваровУслуг.СоздатьДокумент();	
    КонецЕсли;

    Умиляет

    sandvich, 13 Октября 2020

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