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

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

    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
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    // https://github.com/WebKit/WebKit/blob/31b77296cf6d85c40313812d9f65a003cf41f440/Source/WebCore/page/Quirks.cpp#L330
    
    bool Quirks::isGoogleMaps() const
    {
        auto& url = m_document->topDocument().url();
        return topPrivatelyControlledDomain(url.host().toString()).startsWith("google.") && url.path().startsWithIgnoringASCIICase("/maps/");
    }
    
    bool Quirks::shouldDispatchSimulatedMouseEvents() const
    {
        if (RuntimeEnabledFeatures::sharedFeatures().mouseEventsSimulationEnabled())
            return true;
    
        if (!needsQuirks())
            return false;
    
        auto doShouldDispatchChecks = [this] () -> bool {
            auto* loader = m_document->loader();
            if (!loader || loader->simulatedMouseEventsDispatchPolicy() != SimulatedMouseEventsDispatchPolicy::Allow)
                return false;
    
            if (isAmazon())
                return true;
            if (isGoogleMaps())
                return true;
    
            auto& url = m_document->topDocument().url();
            auto host = url.host().convertToASCIILowercase();
    
            if (host == "wix.com" || host.endsWith(".wix.com")) {
                // Disable simulated mouse dispatching for template selection.
                return !url.path().startsWithIgnoringASCIICase("/website/templates/");
            }
    
            if ((host == "desmos.com" || host.endsWith(".desmos.com")) && url.path().startsWithIgnoringASCIICase("/calculator/"))
                return true;
            if (host == "figma.com" || host.endsWith(".figma.com"))
                return true;
            if (host == "trello.com" || host.endsWith(".trello.com"))
                return true;
            if (host == "airtable.com" || host.endsWith(".airtable.com"))
                return true;
            if (host == "msn.com" || host.endsWith(".msn.com"))
                return true;
            if (host == "flipkart.com" || host.endsWith(".flipkart.com"))
                return true;
            if (host == "iqiyi.com" || host.endsWith(".iqiyi.com"))
                return true;
            if (host == "trailers.apple.com")
                return true;
            if (host == "soundcloud.com")
                return true;
            if (host == "naver.com")
                return true;
            if (host == "nba.com" || host.endsWith(".nba.com"))
                return true;
            if (host.endsWith(".naver.com")) {
                // Disable the quirk for tv.naver.com subdomain to be able to simulate hover on videos.
                if (host == "tv.naver.com")
                    return false;
                // Disable the quirk for mail.naver.com subdomain to be able to tap on mail subjects.
                if (host == "mail.naver.com")
                    return false;
                // Disable the quirk on the mobile site.
                // FIXME: Maybe this quirk should be disabled for "m." subdomains on all sites? These are generally mobile sites that don't need mouse events.
                if (host == "m.naver.com")
                    return false;
                return true;
            }
            return false;
        };
    
        if (!m_shouldDispatchSimulatedMouseEventsQuirk)
            m_shouldDispatchSimulatedMouseEventsQuirk = doShouldDispatchChecks();
        return *m_shouldDispatchSimulatedMouseEventsQuirk;
    }

    Дааа блядь, давайте в движке браузера захардкодим какие-то говнодомены, что типа вот для них какая-то там блядь симуляция событий мыши работала каким-то таким образом. Охуенно!

    j123123, 04 Февраля 2021

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

    −1

    1. 1
    https://habr.com/post/417047/

    Гвидо уходит напитон из питона

    guestinxo, 13 Июля 2018

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

    +3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    Оффтоп
    
    Пишу либу для гуя в консоли. Столкнулся с проблемой медленного вывода в консоль на линуксе.
    На винде есть няшный WriteConsoleOutput, который может вывести буфер разом на консоль, в линупсе ничего подобного не нашел.
    Если использовать Console.WriteLine или libc-шный puts, все лагает неимоверно
    
    Есть идеи?

    cykablyad, 24 Июня 2016

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

    +192

    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
    <शैली श्रेणी>
    #समावेश <मानकपन.स>
    
    श्रेणी जानवर
    {
    खुला:
    	भव व्योम लिखो()
    	{
    		म_लिखो("यह एक जानवर है।\n");
    	}
    };
    
    श्रेणी शेर : खुला जानवर
    {
    खुला:
    	व्योम लिखो()
    	{
    		म_लिखो("शेर एक जानवर है।\n");
    	}
    };
    
    श्रेणी चीता : खुला जानवर
    {
    खुला:
    	व्योम लिखो()
    	{
    		म_लिखो("चीता एक जानवर है।\n");
    	}
    };
    
    पूर्णांक मुख्य()
    {
    	जानवर ज, *ज१;
    	शेर श;
    	चीता च;
    
    	ज.लिखो();
    	श.लिखो();
    	च.लिखो();
    
    	ज१=&ज;
    	ज१->लिखो();
    	ज१=&श;
    	ज१->लिखो();
    	ज१=&च;
    	ज१->लिखो();
    
    	वापस 0;
    }

    Вот вы все говорите про индусский код, а он на самом деле вот такой! Мне кажется, простой и логичный!

    (Дистрибутив на http://hindawi.in/en_US/download.php)

    nil, 06 Июня 2010

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

    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
    template<typename T>
    class SharedPtr {
        T* value;
        int* ref_count;
    
    public:
        SharedPtr(T* value) : value(value) {
            ref_count = new int;
            *ref_count = 1;
        }
    
        SharedPtr(const SharedPtr& other) {
            value = other.value;
            ref_count = other.ref_count;
            (*ref_count)++;
        }
    
        SharedPtr(SharedPtr&& other) {
            value = other.value;
            ref_count = other.ref_count;
            other.ref_count = nullptr;
        }
    
        ~SharedPtr() {
            if (ref_count == nullptr) {
                return;
            }
    
            if (*ref_count == 1) {
                delete value;
                delete ref_count;
            } else {
                (*ref_count)--;
            }
        }
    
        T& operator *() const {
            return *value;
        }
    
        T* operator ->() const {
            return value;
        }
    };

    Реалейзовал минимальную версию shared_ptr. Есть ошибки/замечания?

    https://ideone.com/g7gqBM

    3_dar, 04 Мая 2021

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

    +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
    &НаКлиенте
    Процедура ИмяФайла_ПроизводственнаяПрограммаНачалоВыбора(Элемент, ДанныеВыбора, СтандартнаяОбработка)
    	ДиалогВыборФайла = Новый ДиалогВыбораФайла(РежимДиалогаВыбораФайла.Открытие);
    	ДиалогВыборФайла.Фильтр = "Файлы Microsoft Excel (*.xls, *.xlsx, *.xlsm)|*.xls; *.xlsx; *.xlsm|Все файлы (*.*)|*.*";
    	ДиалогВыборФайла.Показать(Новый ОписаниеОповещения("ИмяФайла_ПроизводственнаяПрограммаНачалоВыбораЗавершение", ЭтотОбъект, Новый Структура("ДиалогВыборФайла,ИмяФайла", ДиалогВыборФайла, Элемент.Имя)));
    КонецПроцедуры
    
    &НаКлиенте
    Процедура ИмяФайла_ПроизводственнаяПрограммаНачалоВыбораЗавершение(ВыбранныеФайлы, ДополнительныеПараметры) Экспорт
        
        ДиалогВыборФайла = ДополнительныеПараметры.ДиалогВыборФайла;
        
        Если (ВыбранныеФайлы <> Неопределено) Тогда
            ЭтаФорма[ДополнительныеПараметры.ИмяФайла] = ДиалогВыборФайла.ПолноеИмяФайла;
        КонецЕсли;
    
    КонецПроцедуры

    Асинхронные вызовы??? Нее.... Не слышал...

    nytlenc, 15 Декабря 2020

    Комментарии (167)
  8. Куча / Говнокод #25685

    −4

    1. 1
    Андроидотред #3

    #1: https://govnokod.xyz/_19062
    #2: https://govnokod.xyz/_25537 (стерла пидорва сракер)

    syoma, 22 Июня 2019

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

    0

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

    #209: https://govnokod.ru/29070 https://govnokod.xyz/_29070
    #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

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

    Комментарии (166)
  10. Си / Говнокод #25753

    −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
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    #include <stdio.h>
    #include <stdlib.h>
    
    int main ()
    {
    int a=120;
    printf("%i\n",*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&*&*&*&*&*&*&*&*&*&
    *&*&*&a);
    }

    killer1804, 08 Августа 2019

    Комментарии (166)
  11. C++ / Говнокод #14335

    +18

    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
    template <typename T>
      struct canref {
        struct yes { uint8_t bytes[1]; };
        struct no  { uint8_t bytes[2]; };
        template <typename U>    static yes test(U*p);
        template <typename U>    static no  test(...);
        static const bool value = sizeof(test<T>(NULL)) == sizeof(yes);
      };
      template <typename T, int N, bool CanRef=canref<T>::value>
      class array; 
      // class for all types
      template <typename T, int N>
      class array <T,N,true>
      {
        struct Bytes
        {
          uint8_t bytes[sizeof(T)];
        };
        struct TStruct
        {
          T t;
          TStruct(T t):t(t){}
        };
    
        Bytes elements[N];
        int count;
        void copy_ctor (int index, const T& t)
        {
          new (&((*this)[index])) T(t);      
        }
        void copy (int index, const T& t)
        {
          (*this)[index] = t;
        }
    
        void dtor (int index)
        {
          (*this)[index].~T();
        }
      public:
        array () : count(0) {}
    
        ~array () 
        {
          resize(0);
        }
        T& operator [] (int index) 
        {
          assert (index>=0 && index<count);      
          return ((TStruct*)(&elements[index]))->t;
        }
        const T& operator [] (int index) const 
        {
          assert (index>=0 && index<count);      
          return ((TStruct*)(&elements[index]))->t;
        }
        template <int M>
        array (const array<T,M> &a)
        {
          assert(a.count<=N);
          count = a.count;
          for (int i=0; i<count; ++i)
            copyctor(i, a[i]);
        }
        template <int M>
        array& operator = (const array<T,M> &a)
        {
          if (this != &a)
          {
            if (count>a.count)
            {
              for (int i=0;       i<a.count; ++i) copy(i, a[i]);
              for (int i=a.count; i<count;   ++i) dtor(i);
              count = a.count;
            } else
            {
              assert(a.count<=N);
              int ocount = count;
              count = a.count;
              for (int i=0;      i<ocount; ++i) copy(i, a[i]);
              for (int i=ocount; i<count;  ++i) copy_ctor(i, a[i]);
            }
          }
        }
        int size() 
        {
          return count;
        }

    Скоро даже сратору станет очевидно откуда это.

    LispGovno, 10 Января 2014

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