1. Python / Говнокод #26719

    +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
    enchufar Chamuyo
    
    un Árbol de a es
       bien Hoja a
       bien Nodo a (Árbol de a) (Árbol de a)
    
    el máximo
       dados n m
          si n > m da n
          si no    da m
    
    la altura de Árbol de a en Numerito
      dado (Hoja _)     da 1
      dado (Nodo _ a b) da 1 + máximo (altura a)
                                      (altura b)
    
    el programa es escupir . mostrar . altura $
       Nodo 'a'
            (Nodo 'b'
                  (Hoja 'c')
                  (Hoja 'd'))
            (Nodo 'e'
                  (Hoja 'f')
                  (Hoja 'g'))

    Отсюда:
    https://qriollo.github.io/

    TEH3OPHblu_nemyx, 01 Июня 2020

    Комментарии (1)
  2. PHP / Говнокод #26718

    +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
    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
    if ($arItem['OFFERS_PROPS_DISPLAY']) {
                                    foreach ($arItem['JS_OFFERS'] as $keyOffer => $arJSOffer) {
                                        $strProps = '';
                                        if (!empty($arJSOffer['DISPLAY_PROPERTIES'])) {
                                            foreach ($arJSOffer['DISPLAY_PROPERTIES'] as $arOneProp) {
                                                $strProps .= '<br>'.$arOneProp['NAME'].' <strong>'.(
                                                    is_array($arOneProp['VALUE'])
                                                    ? implode(' / ', $arOneProp['VALUE'])
                                                    : $arOneProp['VALUE']
                                                ).'</strong>';
                                            }
                                        }
                                        $arItem['JS_OFFERS'][$keyOffer]['DISPLAY_PROPERTIES'] = $strProps;
                                    }
                                }
                                foreach ($arItem['JS_OFFERS'] as $keyOffer => $arJSOffer) {
                                    if ($arItem['PROPERTIES']['OLD_PRICE']['VALUE'] > 0 && 
                                        $arItem['PROPERTIES']['OLD_PRICE']['ACTIVE'] == 'Y' &&
                                        ($arItem['PROPERTIES']['OLD_PRICE']['VALUE'] * $arItem['OFFERS'][$keyOffer]['CATALOG_MEASURE_RATIO']) > $arItem['JS_OFFERS'][$keyOffer]['PRICE']['VALUE']) {
                                        $arItem['JS_OFFERS'][$keyOffer]['PRICE']['VALUE'] = $arItem['PROPERTIES']['OLD_PRICE']['VALUE'] * $arItem['OFFERS'][$keyOffer]['CATALOG_MEASURE_RATIO'];
                                        $arItem['JS_OFFERS'][$keyOffer]['PRICE']['PRINT_VALUE'] = CCurrencyLang::CurrencyFormat($arItem['JS_OFFERS'][$keyOffer]['PRICE']['VALUE'], $arItem['JS_OFFERS'][$keyOffer]['PRICE']['CURRENCY']);
                                    }
                                    $maxItemPriceValue = ($arItem['JS_OFFERS'][$keyOffer]['PRICE']['VALUE'] > $maxBasisPriceValue) ? $arItem['JS_OFFERS'][$keyOffer]['PRICE']['VALUE'] : $maxBasisPriceValue;
                                    $discount = $maxItemPriceValue - $arItem['JS_OFFERS'][$keyOffer]['PRICE']['DISCOUNT_VALUE'];
                                    $arItem['JS_OFFERS'][$keyOffer]['PRICE']['VALUE'] = $maxItemPriceValue;
                                    $arItem['JS_OFFERS'][$keyOffer]['PRICE']['ECONOMY'] = $discount;
                                    $arItem['JS_OFFERS'][$keyOffer]['BASIS_PRICE']['VALUE'] = $maxItemPriceValue / $arItem['OFFERS'][$keyOffer]['CATALOG_MEASURE_RATIO'];
                                    $arItem['JS_OFFERS'][$keyOffer]['BASIS_PRICE']['ECONOMY'] = $discount / $arItem['OFFERS'][$keyOffer]['CATALOG_MEASURE_RATIO'];
                                    $arItem['JS_OFFERS'][$keyOffer]['BASIS_PRICE']['CATALOG_MEASURE_RATIO'] = $arItem['OFFERS'][$keyOffer]['CATALOG_MEASURE_RATIO'];
                                    if ($isPriceMulty && count($arItem['OFFERS'][$keyOffer]['PRICES']) > 1 && (!$arParams['TAB_TYPE'] || ($arResult['IS_SHOW_LARGE_PREVIEW'] && !in_array('prodday', $itemType) && !in_array('action', $itemType)))) {
                                        $iPrice = 0;
                                        $maxBasisItemPriceValue = $maxBasisPriceValue / $arItem['OFFERS'][$keyOffer]['CATALOG_MEASURE_RATIO'];
                                        foreach($arItem['OFFERS'][$keyOffer]['PRICES'] as $arPrice) {
                                            $maxItemPriceValue = ($arPrice['VALUE'] > $maxBasisItemPriceValue) ? $arPrice['VALUE'] : $maxBasisItemPriceValue;
                                            $arItem['JS_OFFERS'][$keyOffer]['PRICE']['PRICES'][$iPrice]['TITLE'] = $arItem['OFFERS'][$keyOffer]['CATALOG_GROUP_NAME_' . $arPrice['PRICE_ID']];
                                            $arItem['JS_OFFERS'][$keyOffer]['PRICE']['PRICES'][$iPrice]['DISCOUNT_VALUE'] = $arPrice['DISCOUNT_VALUE'];
                                            $arItem['JS_OFFERS'][$keyOffer]['PRICE']['PRICES'][$iPrice]['VALUE'] = $maxItemPriceValue;
                                            $arItem['JS_OFFERS'][$keyOffer]['PRICE']['PRICES'][$iPrice]['ECONOMY'] = $maxItemPriceValue - $arPrice['DISCOUNT_VALUE'];
                                            $arItem['JS_OFFERS'][$keyOffer]['PRICE']['PRICES'][$iPrice]['CURRENCY'] = $arPrice['CURRENCY'];
                                            $arItem['JS_OFFERS'][$keyOffer]['PRICE']['PRICES'][$iPrice]['CATALOG_MEASURE_RATIO'] = $arItem['OFFERS'][$keyOffer]['CATALOG_MEASURE_RATIO'];
                                            $arItem['JS_OFFERS'][$keyOffer]['BASIS_PRICE']['PRICES'][$iPrice]['TITLE'] = $arItem['OFFERS'][$keyOffer]['CATALOG_GROUP_NAME_' . $arPrice['PRICE_ID']];
                                            $arItem['JS_OFFERS'][$keyOffer]['BASIS_PRICE']['PRICES'][$iPrice]['DISCOUNT_VALUE'] = $arPrice['DISCOUNT_VALUE'];
                                            $arItem['JS_OFFERS'][$keyOffer]['BASIS_PRICE']['PRICES'][$iPrice]['VALUE'] = $maxItemPriceValue;
                                            $arItem['JS_OFFERS'][$keyOffer]['BASIS_PRICE']['PRICES'][$iPrice]['ECONOMY'] = $maxItemPriceValue - $arPrice['DISCOUNT_VALUE'];
                                            $arItem['JS_OFFERS'][$keyOffer]['BASIS_PRICE']['PRICES'][$iPrice]['CURRENCY'] = $arPrice['CURRENCY'];
                                            $arItem['JS_OFFERS'][$keyOffer]['BASIS_PRICE']['PRICES'][$iPrice]['CATALOG_MEASURE_RATIO'] = $arItem['OFFERS'][$keyOffer]['CATALOG_MEASURE_RATIO'];
                                            $iPrice++;
                                        }
                                    }
                                }

    js прайс ?

    phpBidlokoder2, 01 Июня 2020

    Комментарии (0)
  3. Go / Говнокод #26717

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    func GetUser() *User {
        defer func() {
            time.Sleep(100 * time.Millisecond)
        }()
        return &User{}
    }

    Паттерн: поработал - отдохни.

    Pattern: worked hard - have a rest

    anon007, 01 Июня 2020

    Комментарии (6)
  4. Go / Говнокод #26716

    +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
    func (svc *UserSvc) isEmptyName(name model.User_Name) bool {
      if name.First.RU == "" {
        if name.First.EN == "" {
          if name.First.TR == "" {
            if name.First.IT == "" {
              if name.Last.RU == "" {
                if name.Last.EN == "" {
                  if name.Last.TR == "" {
                    if name.Last.IT == "" {
                      return true
                    }
                  }
                }
              }
            }
          }
        }
      }
      return false
    }

    Проверка заполненности имени пользователя хотя - бы на одном из языков.

    anon007, 01 Июня 2020

    Комментарии (54)
  5. Python / Говнокод #26715

    −4

    1. 1
    Принт хелло ворлд

    Oleg4260, 01 Июня 2020

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    http://lhohq.info/
    http://www.lhohq.info/lhohq_android.html
    http://octagon.lhohq.info/exploit-nomophobia.html
    http://phonograph.lhohq.info/

    Безумбреции / шизофреции с легким оттенком конардио

    Давненько не появлялось хорошего соперника DBУNOГUM

    Fike, 31 Мая 2020

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

    +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
    class Values<T> {
       T data;
       Values() {}
       Values(T data) {this.setData(data);}
       public void setData(T data) {this.data = data;}
       public T getData() {return this.data;}
    }
    
    public class Main {
       public static void main(String[] args) {
          Values[][] item = new Values[3][2];
          item[0][0] = new Values("grapes");
          item[0][1] = new Values(1);
    
          item[1][0] = new Values("apples");
          item[1][1] = new Values(1);
    
          item[2][0] = new Values("peaches");
          item[2][1] = new Values(1);
       }
    }

    >>> кто меня интервьюировал на позицию Staff Engineer? Junior?
    >>>

    1. Если покупатель купит больше одного яблока,
    то он получит скидку 20% на все яблоки в корзине;
    2. Если покупатель купит пакет винограда, то второй пакет
    он получит бесплатно.

    Итог: посчитать стоимость корзины покупателя при выходе из магазина,
    при то, что данные даны в следующем виде:
    [["grapes", 1],["apples", 0],["peaches", 1]] => 12
    [["grapes", 1],["apples", 1],["peaches", 1]] => 15 ...

    https://habr.com/post/504638

    Бля-я-я-я, это просто феерия! 1024--, зацени статью, ты оценишь!

    gost, 31 Мая 2020

    Комментарии (281)
  8. Python / Говнокод #26711

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    a1=[gg for gg in range( 1,  9+ 1   , 1) ]
    b1='';b2=""
    for a in a1:
        for A1 in a1:
            b1=b1 + str(a)+'*'  +  str(A1)+ '='  +'%s' %str(int( a )* int(A1 ) )+"  "
        b2+=b1+ '\n'
        del b1; b1=''
    print(f'{b2}' )

    ТаблицаУмножения

    mosni, 30 Мая 2020

    Комментарии (3)
  9. Python / Говнокод #26708

    +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
    def get_build_version():
        """Return the version of MSVC that was used to build Python.
    
        For Python 2.3 and up, the version number is included in
        sys.version.  For earlier versions, assume the compiler is MSVC 6.
        """
        prefix = "MSC v."
        i = sys.version.find(prefix)
        if i == -1:
            return 6
        i = i + len(prefix)
        s, rest = sys.version[i:].split(" ", 1)
        majorVersion = int(s[:-2]) - 6
        if majorVersion >= 13:
            # v13 was skipped and should be v14
            majorVersion += 1
        minorVersion = int(s[2:3]) / 10.0
        # I don't think paths are affected by minor version in version 6
        if majorVersion == 6:
            minorVersion = 0
        if majorVersion >= 6:
            return majorVersion + minorVersion
        # else we don't know what version of the compiler this is
        return None

    Определение версии конпелятора, которой был собран «CPython».

    TEH3OPHblu_nemyx, 30 Мая 2020

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

    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
    IT Оффтоп #48
    
    
    #1: https://govnokod.ru/18142 https://govnokod.xyz/_18142
    #2: https://govnokod.ru/18378 https://govnokod.xyz/_18378
    #3: https://govnokod.ru/19667 https://govnokod.xyz/_19667
    #4: https://govnokod.ru/21160 https://govnokod.xyz/_21160
    #5: https://govnokod.ru/21772 https://govnokod.xyz/_21772
    #6: (vanished) https://govnokod.xyz/_24063
    #7: https://govnokod.ru/24538 https://govnokod.xyz/_24538
    #8: (vanished) https://govnokod.xyz/_24815
    #9: https://govnokod.ru/24867 https://govnokod.xyz/_24867
    #10: https://govnokod.ru/25328 https://govnokod.xyz/_25328	
    #11: (vanished) https://govnokod.xyz/_25436
    #12: (vanished) https://govnokod.xyz/_25471
    #13: (vanished) https://govnokod.xyz/_25590
    #14: https://govnokod.ru/25684 https://govnokod.xyz/_25684
    #15: https://govnokod.ru/25694 https://govnokod.xyz/_25694
    #16: https://govnokod.ru/25725 https://govnokod.xyz/_25725
    #17: https://govnokod.ru/25731 https://govnokod.xyz/_25731
    #18: https://govnokod.ru/25762 https://govnokod.xyz/_25762
    #19: https://govnokod.ru/25767 https://govnokod.xyz/_25767
    #20: https://govnokod.ru/25776 https://govnokod.xyz/_25776
    #21: https://govnokod.ru/25798 https://govnokod.xyz/_25798
    #22: https://govnokod.ru/25811 https://govnokod.xyz/_25811
    #23: https://govnokod.ru/25863 https://govnokod.xyz/_25863

    #24: https://govnokod.ru/25941 https://govnokod.xyz/_25941
    #25: https://govnokod.ru/26026 https://govnokod.xyz/_26026
    #26: https://govnokod.ru/26050 https://govnokod.xyz/_26050
    #27: https://govnokod.ru/26340 https://govnokod.xyz/_26340
    #28: https://govnokod.ru/26372 https://govnokod.xyz/_26372
    #29: https://govnokod.ru/26385 https://govnokod.xyz/_26385
    #30: https://govnokod.ru/26413 https://govnokod.xyz/_26413
    #31: https://govnokod.ru/26423 https://govnokod.xyz/_26423
    #32: https://govnokod.ru/26440 https://govnokod.xyz/_26440
    #33: https://govnokod.ru/26449 https://govnokod.xyz/_26449
    #34: https://govnokod.ru/26456 https://govnokod.xyz/_26456
    #35: https://govnokod.ru/26463 https://govnokod.xyz/_26463
    #36: https://govnokod.ru/26508 https://govnokod.xyz/_26508
    #37: https://govnokod.ru/26524 https://govnokod.xyz/_26524
    #38: https://govnokod.ru/26539 https://govnokod.xyz/_26539
    #39: https://govnokod.ru/26556 https://govnokod.xyz/_26556
    #40: https://govnokod.ru/26568 https://govnokod.xyz/_26568
    #41: https://govnokod.ru/26589 https://govnokod.xyz/_26589
    #42: https://govnokod.ru/26600 https://govnokod.xyz/_26600
    #43: https://govnokod.ru/26604 https://govnokod.xyz/_26604
    #44: https://govnokod.ru/26627 https://govnokod.xyz/_26627
    #45: https://govnokod.ru/26635 https://govnokod.xyz/_26635
    #46: (vanished) https://govnokod.xyz/_26646
    #46: (vanished) https://govnokod.xyz/_26654
    #47: https://govnokod.ru/26671 https://govnokod.xyz/_26671

    baropinho, 30 Мая 2020

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