1. Комментарий к говнокоду #28938

    • https://pbs.twimg.com/media/GMG3Y8FWAAAFtkL?format=jpg&name=small
      Ответить
    Показать код ▼

    Куча / Говнокод #28938

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

    #168: https://govnokod.ru/28607 https://govnokod.xyz/_28607
    #169: https://govnokod.ru/28628 https://govnokod.xyz/_28628
    #170: https://govnokod.ru/28653 https://govnokod.xyz/_28653
    #171: (vanished) https://govnokod.xyz/_28665
    #172: https://govnokod.ru/28675 https://govnokod.xyz/_28675
    #173: https://govnokod.ru/28681 https://govnokod.xyz/_28681
    #174: https://govnokod.ru/28689 https://govnokod.xyz/_28689
    #175: https://govnokod.ru/28696 https://govnokod.xyz/_28696
    #176: https://govnokod.ru/28703 https://govnokod.xyz/_28703
    #177: https://govnokod.ru/28709 https://govnokod.xyz/_28709
    #178: https://govnokod.ru/28716 https://govnokod.xyz/_28716
    #179: https://govnokod.ru/28726 https://govnokod.xyz/_28726
    #180: https://govnokod.ru/28734 https://govnokod.xyz/_28734
    #181: https://govnokod.ru/28739 https://govnokod.xyz/_28739
    #182: https://govnokod.ru/28749 https://govnokod.xyz/_28749
    #183: https://govnokod.ru/28777 https://govnokod.xyz/_28777
    #184: https://govnokod.ru/28790 https://govnokod.xyz/_28790
    #185: https://govnokod.ru/28794 https://govnokod.xyz/_28794
    #186: https://govnokod.ru/28815 https://govnokod.xyz/_28815
    #187: https://govnokod.ru/28833 https://govnokod.xyz/_28833
    #188: https://govnokod.ru/28837 https://govnokod.xyz/_28837
    #189: https://govnokod.ru/28840 https://govnokod.xyz/_28840
    #190: https://govnokod.ru/28875 https://govnokod.xyz/_28875
    #191: https://govnokod.ru/28878 https://govnokod.xyz/_28878
    #192: https://govnokod.ru/28886 https://govnokod.xyz/_28886
    #193: https://govnokod.ru/28911 https://govnokod.xyz/_28911
    #194: https://govnokod.ru/28914 https://govnokod.xyz/_28914
    #195: https://govnokod.ru/28917 https://govnokod.xyz/_28917
    #196: https://govnokod.ru/28925 https://govnokod.xyz/_28925
    #197: https://govnokod.ru/28935 https://govnokod.xyz/_28935

    Запостил: nepeKamHblu_nemyx, 25 Апреля 2024

    Все комментарии (44)
  2. Комментарий к говнокоду #28936

    • Почему-то напомнило
      https://vk.com/video787545_138617426
      Ответить
    Показать код ▼

    Куча / Говнокод #28936

    1. 1
    Пиздец-оффтоп #99

    #69: (vanished) https://govnokod.xyz/_28660
    #70: (vanished) https://govnokod.xyz/_28667
    #71: https://govnokod.ru/28677 https://govnokod.xyz/_28677
    #72: https://govnokod.ru/28685 https://govnokod.xyz/_28685
    #73: https://govnokod.ru/28692 https://govnokod.xyz/_28692
    #74: https://govnokod.ru/28699 https://govnokod.xyz/_28699
    #75: https://govnokod.ru/28705 https://govnokod.xyz/_28705
    #76: https://govnokod.ru/28712 https://govnokod.xyz/_28712
    #77: https://govnokod.ru/28722 https://govnokod.xyz/_28722
    #78: https://govnokod.ru/28730 https://govnokod.xyz/_28730
    #79: https://govnokod.ru/28736 https://govnokod.xyz/_28736
    #80: https://govnokod.ru/28740 https://govnokod.xyz/_28740
    #81: https://govnokod.ru/28750 https://govnokod.xyz/_28750
    #82: https://govnokod.ru/28779 https://govnokod.xyz/_28779
    #83: https://govnokod.ru/28788 https://govnokod.xyz/_28788
    #84: https://govnokod.ru/28795 https://govnokod.xyz/_28795
    #85: https://govnokod.ru/28808 https://govnokod.xyz/_28808
    #86: (vanished) https://govnokod.xyz/_28814
    #87: https://govnokod.ru/28817 https://govnokod.xyz/_28817
    #88: https://govnokod.ru/28836 https://govnokod.xyz/_28836
    #89: https://govnokod.ru/28843 https://govnokod.xyz/_28843
    #90: https://govnokod.ru/28874 https://govnokod.xyz/_28874
    #91: https://govnokod.ru/28880 https://govnokod.xyz/_28880
    #92: https://govnokod.ru/28884 https://govnokod.xyz/_28884
    #93: https://govnokod.ru/28889 https://govnokod.xyz/_28889
    #94: https://govnokod.ru/28895 https://govnokod.xyz/_28895
    #95: https://govnokod.ru/28904 https://govnokod.xyz/_28904
    #96: https://govnokod.ru/28912 https://govnokod.xyz/_28912
    #97: https://govnokod.ru/28918 https://govnokod.xyz/_28918
    #98: https://govnokod.ru/28932 https://govnokod.xyz/_28932

    Запостил: nepeKamHblu_nemyx, 09 Апреля 2024

    Все комментарии (220)
  3. Комментарий к говнокоду #28878

    Показать код ▼

    Куча / Говнокод #28878

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

    #161: (vanished) https://govnokod.xyz/_28449
    #162: https://govnokod.ru/28477 https://govnokod.xyz/_28477
    #163: https://govnokod.ru/28501 https://govnokod.xyz/_28501
    #164: https://govnokod.ru/28527 https://govnokod.xyz/_28527
    #165: https://govnokod.ru/28557 https://govnokod.xyz/_28557
    #166: https://govnokod.ru/28574 https://govnokod.xyz/_28574
    #167: https://govnokod.ru/28588 https://govnokod.xyz/_28588
    #168: https://govnokod.ru/28607 https://govnokod.xyz/_28607
    #169: https://govnokod.ru/28628 https://govnokod.xyz/_28628
    #170: https://govnokod.ru/28653 https://govnokod.xyz/_28653
    #171: (vanished) https://govnokod.xyz/_28665
    #172: https://govnokod.ru/28675 https://govnokod.xyz/_28675
    #173: https://govnokod.ru/28681 https://govnokod.xyz/_28681
    #174: https://govnokod.ru/28689 https://govnokod.xyz/_28689
    #175: https://govnokod.ru/28696 https://govnokod.xyz/_28696
    #176: https://govnokod.ru/28703 https://govnokod.xyz/_28703
    #177: https://govnokod.ru/28709 https://govnokod.xyz/_28709
    #178: https://govnokod.ru/28716 https://govnokod.xyz/_28716
    #179: https://govnokod.ru/28726 https://govnokod.xyz/_28726
    #180: https://govnokod.ru/28734 https://govnokod.xyz/_28734
    #181: https://govnokod.ru/28739 https://govnokod.xyz/_28739
    #182: https://govnokod.ru/28749 https://govnokod.xyz/_28749
    #183: https://govnokod.ru/28777 https://govnokod.xyz/_28777
    #184: https://govnokod.ru/28790 https://govnokod.xyz/_28790
    #185: https://govnokod.ru/28794 https://govnokod.xyz/_28794
    #186: https://govnokod.ru/28815 https://govnokod.xyz/_28815
    #187: https://govnokod.ru/28833 https://govnokod.xyz/_28833
    #188: https://govnokod.ru/28837 https://govnokod.xyz/_28837
    #189: https://govnokod.ru/28840 https://govnokod.xyz/_28840
    #190: https://govnokod.ru/28875 https://govnokod.xyz/_28875

    Запостил: nepeKamHblu_nemyx, 04 Ноября 2023

    Все комментарии (479)
  4. Комментарий к говнокоду #28935

    Показать код ▼

    Куча / Говнокод #28935

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

    #167: https://govnokod.ru/28588 https://govnokod.xyz/_28588
    #168: https://govnokod.ru/28607 https://govnokod.xyz/_28607
    #169: https://govnokod.ru/28628 https://govnokod.xyz/_28628
    #170: https://govnokod.ru/28653 https://govnokod.xyz/_28653
    #171: (vanished) https://govnokod.xyz/_28665
    #172: https://govnokod.ru/28675 https://govnokod.xyz/_28675
    #173: https://govnokod.ru/28681 https://govnokod.xyz/_28681
    #174: https://govnokod.ru/28689 https://govnokod.xyz/_28689
    #175: https://govnokod.ru/28696 https://govnokod.xyz/_28696
    #176: https://govnokod.ru/28703 https://govnokod.xyz/_28703
    #177: https://govnokod.ru/28709 https://govnokod.xyz/_28709
    #178: https://govnokod.ru/28716 https://govnokod.xyz/_28716
    #179: https://govnokod.ru/28726 https://govnokod.xyz/_28726
    #180: https://govnokod.ru/28734 https://govnokod.xyz/_28734
    #181: https://govnokod.ru/28739 https://govnokod.xyz/_28739
    #182: https://govnokod.ru/28749 https://govnokod.xyz/_28749
    #183: https://govnokod.ru/28777 https://govnokod.xyz/_28777
    #184: https://govnokod.ru/28790 https://govnokod.xyz/_28790
    #185: https://govnokod.ru/28794 https://govnokod.xyz/_28794
    #186: https://govnokod.ru/28815 https://govnokod.xyz/_28815
    #187: https://govnokod.ru/28833 https://govnokod.xyz/_28833
    #188: https://govnokod.ru/28837 https://govnokod.xyz/_28837
    #189: https://govnokod.ru/28840 https://govnokod.xyz/_28840
    #190: https://govnokod.ru/28875 https://govnokod.xyz/_28875
    #191: https://govnokod.ru/28878 https://govnokod.xyz/_28878
    #192: https://govnokod.ru/28886 https://govnokod.xyz/_28886
    #193: https://govnokod.ru/28911 https://govnokod.xyz/_28911
    #194: https://govnokod.ru/28914 https://govnokod.xyz/_28914
    #195: https://govnokod.ru/28917 https://govnokod.xyz/_28917
    #196: https://govnokod.ru/28925 https://govnokod.xyz/_28925

    Запостил: nepeKamHblu_nemyx, 07 Апреля 2024

    Все комментарии (412)
  5. Комментарий к говнокоду #13597

    Показать код ▼

    JavaScript / Говнокод #13597

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    this.startAdLoading = function(callback) {
    this.adCallback = callback;
     
    Array.prototype.remove = function(from, to) {
      var rest = this.slice((to || from) + 1 || this.length);
      this.length = from < 0 ? this.length + from : from;
      return this.push.apply(this, rest);
    };
    ...
    }

    Очень полезный метод добавили массивам. Все тот же источник.

    Запостил: wvxvw, 12 Августа 2013

    Все комментарии (131)
  6. Комментарий к говнокоду #16482

    Показать код ▼

    C# / Говнокод #16482

    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
    Есть односвязный список. Каждый элемент списка содержит указатель на следующий элемент (next). 
    Нам известен указатель на первый элемент списка (root). Необходимо без использования каких-либо 
    дополнительных структур данных и без изменения структуры элементов списка определить зациклен ли данный список.
     
    Ответ
     
    public static boolean isCycleList(Item root){ 
            Item first = root;     
            while(first.getNext() != null){ 
                Item subFirst = root; 
                do { 
                    if (subFirst == first.getNext()) 
                        return true; 
                    subFirst = subFirst.getNext(); 
                } 
                while (subFirst != first.getNext());         
                first = first.getNext(); 
            } 
            return false; 
        }

    Запостил: kegdan, 05 Августа 2014

    Все комментарии (21)
  7. Комментарий к говнокоду #20301

    Показать код ▼

    Python / Говнокод #20301

    1. 1
    2. 2
    3. 3
    4. 4
    index = re.findall('%s([\s]*[\w\d-]+[\s]*[\w\d-]*)' % self.vendor, string)
    if not index:
        index = re.findall('([\s]*[\w\d-]+[\s]*[\w\d-]*[\s]*[\w\d-]*)', string)
    return filter(lambda x: len(x) > 3 and re.findall('\d', x), map(lambda x: x.replace(' ', '').replace('-', ''), index)) or [u'none']

    Сижу, перед уходом свой код документирую. В изумлении сижу, да.

    Запостил: kyzi007, 30 Июня 2016

    Все комментарии (12)
  8. Комментарий к говнокоду #26837

    Показать код ▼

    Python / Говнокод #26837

    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
    from numba import jit
     
     
    def mults_no_jit(start, end, step):
        min_i = min(start, end)
        for i in range(start, end, step):
            if i < min_i:
                return
            for j in range(i, end, step):
                x = i * j
                x_orig = x
                x_reverse = 0
                while x > 0:
                    x_reverse *= 10
                    x_reverse += x % 10
                    x //= 10
                if x_orig == x_reverse:
                    min_i = max(min_i, j)
                    yield x_orig
                    break
     
     
    @jit(nopython=True)
    def mults_jit(start, end, step):
        min_i = min(start, end)
        for i in range(start, end, step):
            if i < min_i:
                return
            for j in range(i, end, step):
                x = i * j
                x_orig = x
                x_reverse = 0
                while x > 0:
                    x_reverse *= 10
                    x_reverse += x % 10
                    x //= 10
                if x_orig == x_reverse:
                    min_i = max(min_i, j)
                    yield x_orig
                    break
     
     
    print(timeit.timeit('max(mults_no_jit(999, 99, -1))', globals=globals(), number=100))
    # 4.2907474 секунды
     
    print(timeit.timeit('max(mults_jit(999, 99, -1))', globals=globals(), number=100))
    # 0.1662201 секунд первый запуск, 0.0333973 последующие

    Теперь я за «Numba».

    Запостил: gost, 02 Августа 2020

    Все комментарии (233)
  9. Комментарий к говнокоду #27481

    Показать код ▼

    Куча / Говнокод #27481

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    На этом ресурсе неоднократно появляются "говнокоды" с кривым форматированием. 
    Не всё что криво отформатированно, является говнокодом с точки зрения самого кодирования.
    Отчасти такие коды - ето копипаст из лаб студентов,
    которых заставили скопипастнуть свой код в какой-нибудь отчет, а возиться с вордовской версткой мало кому охота ага).
    О том, что формат doc(x) для сорцов мало подходит, мало каких преподов волнует. Им отчет же нужно показать комиссии.
    Столкнулась с этим после неоднократных переделок лаб по предметам, связанным с программированием.

    Запостил: JaneBurt, 24 Июня 2021

    Все комментарии (1359)
  10. Комментарий к говнокоду #27234

    • сркн это если б книга была про то, как сталин на помойке нашёл 33 дивизии, которые помогли выиграть курскую битву
      Ответить
    Показать код ▼

    C++ / Говнокод #27234

    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

    Все комментарии (150)
  11. Комментарий к говнокоду #22798

    • > A standard is reviewed every 5 years

      Т. е. в следующем году могут новый подогнать. Или не подогнать.
      Ответить
    Показать код ▼

    C++ / Говнокод #22798

    1. 1
    Оффтоп

    Где можно найти нормальные, адекватные и свежие мануалы по C++?

    Запостил: cykablyad, 11 Апреля 2017

    Все комментарии (122)
  12. Комментарий к говнокоду #22587

    Показать код ▼

    Куча / Говнокод #22587

    1. 1
    cykablyad официально заявляет

    гк сдох

    Запостил: cykablyad, 15 Марта 2017

    Все комментарии (5)
  13. Комментарий к говнокоду #28909

    • И там, где светится река
      У тихой рощи,
      Соединяет берега
      Седой паромщик.

      Вы тоже подумали про Харона и Стикс?
      Ответить
    Показать код ▼

    Куча / Говнокод #28909

    1. 1
    Питушня #40

    #10: https://govnokod.ru/27045 https://govnokod.xyz/_27045
    #11: https://govnokod.ru/27058 https://govnokod.xyz/_27058
    #12: https://govnokod.ru/27182 https://govnokod.xyz/_27182
    #13: https://govnokod.ru/27260 https://govnokod.xyz/_27260
    #14: https://govnokod.ru/27343 https://govnokod.xyz/_27343
    #15: https://govnokod.ru/27353 https://govnokod.xyz/_27353
    #16: https://govnokod.ru/27384 https://govnokod.xyz/_27384
    #17: https://govnokod.ru/27482 https://govnokod.xyz/_27482
    #18: https://govnokod.ru/27514 https://govnokod.xyz/_27514
    #19: https://govnokod.ru/27620 https://govnokod.xyz/_27620
    #20: https://govnokod.ru/27816 https://govnokod.xyz/_27816
    #21: https://govnokod.ru/27956 https://govnokod.xyz/_27956
    #22: https://govnokod.ru/28143 https://govnokod.xyz/_28143
    #23: https://govnokod.ru/28315 https://govnokod.xyz/_28315
    #24: (vanished) https://govnokod.xyz/_28362
    #25: (vanished) https://govnokod.xyz/_28463
    #26: https://govnokod.ru/28481 https://govnokod.xyz/_28481
    #27: https://govnokod.ru/28537 https://govnokod.xyz/_28537
    #28: https://govnokod.ru/28619 https://govnokod.xyz/_28619
    #29: (vanished) https://govnokod.xyz/_28663
    #30: https://govnokod.ru/28673 https://govnokod.xyz/_28673
    #31: https://govnokod.ru/28679 https://govnokod.xyz/_28679
    #32: https://govnokod.ru/28687 https://govnokod.xyz/_28687
    #33: https://govnokod.ru/28694 https://govnokod.xyz/_28694
    #34: https://govnokod.ru/28701 https://govnokod.xyz/_28701
    #35: https://govnokod.ru/28707 https://govnokod.xyz/_28707
    #36: https://govnokod.ru/28714 https://govnokod.xyz/_28714
    #37: https://govnokod.ru/28724 https://govnokod.xyz/_28724
    #38: https://govnokod.ru/28732 https://govnokod.xyz/_28732
    #39: https://govnokod.ru/28839 https://govnokod.xyz/_28839

    Запостил: nepeKamHblu_nemyx, 28 Января 2024

    Все комментарии (204)
  14. Комментарий к говнокоду #1255

    • public boolean supportsNormalTermination() {
              throw new UnsupportedOperationException(this.getClass()
                      + ".supportsNormalTermination() not supported" );
          }
      Ответить
    Показать код ▼

    Ruby / Говнокод #1255

    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
    def properties_file2hash(_property_file, _link_hash=nil)
        r_hash = Hash.new
        if _property_file &&  FileTest::exist?(_property_file)
          f = File::open(_property_file,'r')
          begin
            _lines = f.readlines
            _lines.each{|_line|
              _strip_line = _line.strip
              if (_strip_line.length > 0)&&(_strip_line[0,1]!='#')
                var_plat = _line.split('::')
                if var_plat.length > 1
                  if (RUBY_PLATFORM.include?(var_plat[0]))
                    _line = var_plat[1]
                    var_plat[2..-1].collect{|x| _line=_line+'::'+x} if var_plat.length > 2
                  else
                    _line = ''
                  end
                end
                var = _line.split('=')
                if var.length > 1
                  _value = var[1].strip
                  var[2..-1].collect{|x| _value=_value+'='+x} if var.length > 2
                  if _link_hash 
                    _value = resolve_link(_value, _link_hash)
                  end
                  r_hash[var[0].strip]=_value
                end
              end
            }
          ensure
            f.close unless f.nil?
          end
          return r_hash      
        end

    Реальный кусок... Весь код проги(не моей)... ТАКОЙ.

    Запостил: guest, 25 Июня 2009

    Все комментарии (31)
  15. Комментарий к говнокоду #13464

    • Было даже так
      https://ic.pics.livejournal.com/serebryakovaa/21763421/435240/435240_original.jpg
      Ответить
    Показать код ▼

    Objective C / Говнокод #13464

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    @implementation NSString (toint)
    - (long long)toInt {
        if (self == nil) return 0;
        if (self.length == 0) return 0;
       return [self longLongValue];
    }
    @end

    В этом коде все прекрасно. Я просто оставлю это здесь. Джава головного мозга.

    Запостил: notxcain, 22 Июля 2013

    Все комментарии (18)
  16. Комментарий к говнокоду #27893

    • >а, я хуйню написал


      ну и зачем ты пишешь на темы, в которых не разбираешься?? Хочешь казать умнее, чем ты есть на самом деле?
      Ответить
    Показать код ▼

    Куча / Говнокод #27893

    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
    Новогодний оффтоп #2
    ░░░░░░░░░░░░░░░░░▐▌░░░░░░░░░░░░░░░░░
    ░░░░░░░░░░░░░░░▀████▀░░░░░░░░░░░░░░░
    ░░░░░░░░░░░░░░░▄█▀▀█▄░░░░░░░░░░░░░░░
    ░░░░░░░░░░░░░░░░░▄▄░░░░░░░░░░░░░░░░░
    ░░░░░░░░░░░░░░░▄████▄░░░░░░░░░░░░░░░
    ░░░░░░░░░░░▄▄██╬██╬████▄▄░░░░░░░░░░░
    ░░░░░░░░▀███████╬███╬██████▀░░░░░░░░
    ░░░░░░░░░░▄▄█╬████╬█████▄▄░░░░░░░░░░
    ░░░░▄▄▄▄██╬████╬█████╬███╬██▄▄▄▄░░░░
    ░░░░░░▀▀████╬█████╬█████████▀▀░░░░░░
    ░░░░░░░░░▄█████╬██████╬███▄░░░░░░░░░
    ░░▄▄▄▄██████╬█████╬███████╬███▄▄▄▄░░
    ░░▀▀▀████╬█████╬████╬███╬██████▀▀▀░░
    ░░░░░░░░████╬████████╬██████░░░░░░░░
    ░░▄▄▄█████╬██████╬█████╬███╬███▄▄▄░░
    ▀▀▀████╬█████╬█████╬████╬███╬████▀▀▀
    ░░░░░░▀▀▀██████████████████▀▀▀░░░░░░
    ░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░
    ░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░

    #1: https://govnokod.ru/27188 https://govnokod.xyz/_27188

    Запостил: bormandinho, 24 Декабря 2021

    Все комментарии (534)
  17. Комментарий к говнокоду #2422

    • пизда, скриптушня, по вербозности положившая на лопатки яжу и обжси вместе взятые. как такое возможно??
      Ответить
    Показать код ▼

    Ruby / Говнокод #2422

    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
    class FinancialEventObserver < ActiveRecord::Observer
      observe Payment, Invoice
      def before_save(model)
        event = nil        
        if model.class == Payment
          if model.new_record?        
            event = FinancialEvent.new(:event => FinancialEvent::Event::PAYMENT_INVOICE,
            :arguments => {:client_name => model.invoice.client.short_name, :invoice_number => model.invoice.invoice_number},
              :company_id=>model.invoice.client.company.id)
          end
        elsif model.class == Invoice
          i = Invoice.find_by_id model.id      
          if model.new_record? or i.status != model.status        
            if model.status == Invoice::Status::ESTIMATE
              event = FinancialEvent.new(:event => FinancialEvent::Event::ESTIMATE_SEND,
            :arguments => {:client_name => model.client.short_name, :invoice_number => model.invoice_number},
                :company_id=>model.client.company.id)
            elsif model.status == Invoice::Status::APPROVED
              event = FinancialEvent.new(:event => FinancialEvent::Event::ESTIMATE_APPROVED,
            :arguments => {:client_name => model.client.short_name, :invoice_number => model.invoice_number},
                :company_id=>model.client.company.id)
            elsif model.status == Invoice::Status::REJECTED
              event = FinancialEvent.new(:event => FinancialEvent::Event::ESTIMATE_REJECTED,
            :arguments => {:client_name => model.client.short_name, :invoice_number => model.invoice_number},
                :company_id=>model.client.company.id)
            elsif model.status == Invoice::Status::SEND
              event = FinancialEvent.new(:event => FinancialEvent::Event::INVOICE_SEND,
            :arguments => {:client_name => model.client.short_name, :invoice_number => model.invoice_number},
                :company_id=>model.client.company.id)            
            end
          elsif !model.new_record? and i.state != model.state
            if model.state == Invoice::State::DELETED
              event = FinancialEvent.new(:event => FinancialEvent::Event::INVOICE_DELETED,
            :arguments => {:invoice_number => model.invoice_number},
                :company_id=>model.client.company.id)
            end
          end    
        end
        event.eventable = model.requester unless event.blank? 
        event.save unless event.blank?
     
      end
      def before_destroy(model)
        if model.class == Payment
          event = FinancialEvent.new(:event => FinancialEvent::Event::PAYMENT_DELETED,
            :arguments => {:invoice_number => model.invoice.invoice_number},
          :company_id=>model.invoice.client.company.id)
          event.eventable = model.requester
          event.save
        end    
      end
    end

    о боже, зачем я открыл этот файл?

    Запостил: rakoth3d, 16 Января 2010

    Все комментарии (5)
  18. Комментарий к говнокоду #2582

    Показать код ▼

    Ruby / Говнокод #2582

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    def has_currency_rate?
      val = false
      if self.currency.id == self.client.company.currency.id or self.currency_rate.blank?
      else
        val = true
      end
      val
    end

    тяжело же жилось людям...

    Запостил: rakoth3d, 09 Февраля 2010

    Все комментарии (14)
  19. Комментарий к говнокоду #3394

    • ОП конечно мудоёб из палаты мер и весов
      Ответить
    Показать код ▼

    Ruby / Говнокод #3394

    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
    def get_next_line(max_level, current_level, current_line_items)
            next_line_items = []
            result_string = ''
     
            if current_level == 1
                    next_line_items.push(1)
                    result_string = "1\n"
            else
                    current_line_number = false
                    current_line_number_count = 0
                    current_index = 0
     
                    current_line_items.each do |line_number|
                            if current_index == 0
                                    current_line_number = line_number
                                    current_line_number_count = 1
                            else
                                    if line_number == current_line_number
                                            current_line_number_count = current_line_number_count + 1
                                    else
                                            next_line_items.push(current_line_number_count)
                                            next_line_items.push(current_line_number)
     
                                            current_line_number_count = 1
                                            current_line_number = line_number
                                    end
                            end
     
                            if current_index >= current_line_items.length - 1
                                    next_line_items.push(current_line_number_count)
                                    next_line_items.push(current_line_number)
                            end
     
                            current_index = current_index + 1
                    end
     
                    result_string = next_line_items.join(' ') + "\n"
            end
     
            if current_level < max_level
                    result_string = result_string + get_next_line(max_level, current_level + 1, next_line_items).to_s
            end
     
            # return result
            result_string
    end
     
    puts 'Input max level:'
    level = gets
     
    puts ''
    puts get_next_line(level.to_i, 1, [])

    реальное тестовое задание кандитата.
    задача - вывести несколько членов последовательности
    1
    11
    21
    1211
    ....

    Запостил: malleus, 04 Июня 2010

    Все комментарии (63)
  20. Комментарий к говнокоду #25669

    Показать код ▼

    Swift / Говнокод #25669

    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
    import SwiftUI
     
     
    struct LandmarkDetail: View {
        @EnvironmentObject var userData: UserData
        var landmark: Landmark
     
     
        var landmarkIndex: Int {
            userData.landmarks.firstIndex(where: { $0.id == landmark.id })!
        }
     
     
        var body: some View {
            VStack {
                MapView(landmark: landmark)
                    .frame(height: 300)
     
     
                CircleImage(image: landmark.image(forSize: 250))
                    .offset(y: -130)
                    .padding(.bottom, -130)
     
     
                VStack(alignment: .leading) {
                    HStack {
                        Text(landmark.name)
                            .font(.title)
     
     
                        Button(action: {
                            self.userData.landmarks[self.landmarkIndex].isFavorite.toggle()
                        }) {
                            if self.userData.landmarks[self.landmarkIndex].isFavorite {
                                Image(systemName: "star.fill")
                                    .foregroundColor(Color.yellow)
                            } else {
                                Image(systemName: "star")
                                    .foregroundColor(Color.gray)
                            }
                        }
                    }
     
     
                    HStack(alignment: .top) {
                        Text(landmark.park)
                            .font(caption)
                        Spacer()
                        Text(landmark.state)
                            .font(.caption)
                    }
                }
                .padding()
     
     
                Spacer()
            }
            .navigationBarTitle(Text(landmark.name), displayMode: .inline)
        }
    }

    https://developer.apple.com/tutorials/swiftui/handling-user-input

    Принципиально новый нескучный "декларативный" UI от компании Apple. В наличии:
    * магические константы
    * спагетти из замыканий
    * биндинги, страшные как атомная война
    * где-то внутри модная хипстерская реактивная либа

    На фоне этого кошмара qml кажется вершиной инженерной мысли

    Запостил: Desktop, 08 Июня 2019

    Все комментарии (42)