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

    −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
    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
    public function index()
        {
            $items = CartManager::getAllItems();
    
            $couponCode = Coupon::getFromSession()->implode('code', ', ');
    
            $address = auth()->user()->address;
    
            $user = auth()->user();
            $userDetails = auth()->user() ? auth()->user()->fields : null;
    
            $fields = [
                'promo_code' => $couponCode,
                'email' => $user->email,
                'first_name' => $userDetails->firstname,
                'last_name' => $userDetails->lastname,
                'phone' => $userDetails->phone,
            ];
    
            if ($address) {
                $field = [
                    'value' => $address->city->title
                ];
                if ($address->city->type === \App\Address::TYPE_CITY) {
                    $field ['data']['city_fias_id'] = $address->city->id;
                    $field ['data']['city'] = $address->city->title;
                } elseif ($address->city->type === \App\Address::TYPE_SETTLEMENT) {
                    $field ['data']['settlement_fias_id'] = $address->city->id;
                    $field ['data']['settlement'] = $address->city->title;
                }
                $fields ['delivery_city'] = $field;
            }
    
            if ($address->street) {
                $fields ['delivery_street'] = [
                    'value' => $address->street->title,
                    'data' => [
                        'street_fias_id' => $address->street->id,
                    ]
                ];
            }
    
            if ($address->street_number) {
                $fields ['delivery_house_number'] = [
                    'value' => $address->street_number,
                ];
            }
    
            if ($address->flat) {
                $fields ['delivery_flat_number'] = $address->flat;
            }
    
            $fields = (object)$fields;
    
            $actions = [
                'remove' => route('shop.cart.remove'),
                'remove_gift_card' => route('shop.cart.gift-cards.remove'),
                'change' => route('shop.cart.update'),
                'promo' => route('shop.coupon.apply'),
                'checkout' => route('orders.store'),
                'get_pickups' => route('delivery_points.index'),
                'check_email' => route('check_email'),
            ];
    
            return view('shop.cart.index', compact(
                'items',
                'address',
                'couponCode',
                'fields',
                'actions'
            ));
        }

    this is MVC, baby !

    hrustbb2, 31 Августа 2020

    Комментарии (0)
  2. Python / Говнокод #26898

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    while True:
        print("И снова...")
        dopamin_up()
        adrenalin_up()
        ne_brezrazlichen = True
        vlublena = False
        if vturilas:
            vtreskalas = True
        vkrashilas = True

    Теперь ясно почему дора дура.
    Код взят с https://vk.com/wall-91010741_75007

    TeQuiero, 29 Августа 2020

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

    +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
    The authenticity of host 'ololo.fike.nemyx (<ip address>)' can't be established.
    fingerprint is SHA256:ololo.
    
    Are you sure you want to continue connecting
    ? (Y/N) Y
    I have no idea what to do with 'Y'
    Just say Y or N, please.
    The authenticity of host 'ololo.fike.nemyx (<ip address>)' can't be established.
    fingerprint is SHA256:ololo.
    
    Are you sure you want to continue connecting
    ? (Y/N) y
    Connecting to ololo.fike.nemyx

    Chef

    Fike, 29 Августа 2020

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

    +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
    Хрюкни #4
                 ._     __,
                  |\,../'\
                ,'. .     `.
               .--         '`.
              ( `' ,          ;
              ,`--' _,       ,'\
             ,`.____            `.
            /              `,    |
           '                \,   '
           |                /   /`,
           `,  .           ,` ./  |
           ' `.  ,'        |;,'   ,@
     ______|     |      _________,_____jv______
            `.   `.   ,'
             ,'_,','_,
             `'   `'

    #1: https://govnokod.ru/26863 https://govnokod.xyz/_26863
    #2: https://govnokod.ru/26868 https://govnokod.xyz/_26868
    #3: https://govnokod.ru/26881 https://govnokod.xyz/_26881

    nepeKamHblu_nemyx, 28 Августа 2020

    Комментарии (2556)
  5. Си / Говнокод #26895

    +3

    1. 1
    2. 2
    https://habr.com/ru/company/ruvds/blog/516266/
    https://github.com/asz/icmpshell/blob/main/main.c

    codemonkey, 28 Августа 2020

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

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    Definition idx_compl_r {i : Fin.t N} (j : Fin.t i) : Fin.t N.
          remember (fin_to_nat i) as i'.
          assert (Hlt : i' < N).
          { rewrite Heqi'. eapply fin_to_nat_lt. }
          assert (Heq : i' + (N - i') = N) by lia.
          set (j' := Fin.L (N - i') j).
          rewrite Heq in j'.
          exact j'.
        Defined.

    Ещё один говношедевр. Как кастовать значения типа Fin.t (число в интервале от 1 до N) друг в друга. Разворачивается в 12000 строк кода. "Тому, кто это придумал, надо в голову гвоздь забить".

    CHayT, 27 Августа 2020

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

    +5

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

    #1: https://govnokod.ru/26692 https://govnokod.xyz/_26692
    #2: https://govnokod.ru/26891 https://govnokod.xyz/_26891

    nepeKamHblu_nemyx, 27 Августа 2020

    Комментарии (2641)
  8. Java / Говнокод #26892

    0

    1. 1
    2. 2
    @Test
    public void getTestcases_OffsetEqTwoAndLomitEqTen_ReturnTwoTestcasesInResponse()

    Йажа - это не язык программирования, это состояние сознания

    roflannister, 27 Августа 2020

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

    +1

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

    #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
    #48: https://govnokod.ru/26707 https://govnokod.xyz/_26707
    #49: https://govnokod.ru/26750 https://govnokod.xyz/_26750
    #49: https://govnokod.ru/26776 https://govnokod.xyz/_26776
    #50: https://govnokod.ru/26804 https://govnokod.xyz/_26804
    #51: https://govnokod.ru/26809 https://govnokod.xyz/_26809
    #52: https://govnokod.ru/26817 https://govnokod.xyz/_26817
    #53: https://govnokod.ru/26833 https://govnokod.xyz/_26833
    #54: https://govnokod.ru/26840 https://govnokod.xyz/_26840
    #55: https://govnokod.ru/26844 https://govnokod.xyz/_26844
    #56: https://govnokod.ru/26862 https://govnokod.xyz/_26862

    nepeKamHblu_nemyx, 25 Августа 2020

    Комментарии (2876)
  10. Python / Говнокод #26889

    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
    # TODO: fix this shit
    def publish(self, session: requests.Session, auth_cookie: str, max_retries: int, retry_time: float) -> bool:
        for i in range(max_retries):
            L.info(f'PostForm.publish(), loading attempt #{i + 1}')
            if self.load_new(session, auth_cookie):
                break
            time.sleep(retry_time)
        else:  # No break
            L.error('PostForm.publish(): could not load the form')
            return False
        
        for i in range(max_retries):
            L.info(f'PostForm.publish(), posting attempt #{i + 1}')
            if not self.try_recognize_captcha(session):
                time.sleep(retry_time)
                continue  # Load an another captcha with the same csrf/captcha_id
            if self.try_post(session, auth_cookie) == PostForm.Status.POST_DONE:
                return True
            time.sleep(retry_time)
        L.error(f'PostForm.publish() failed, max_retries exceeded')
        return False

    Блять, отвратительно.

    gost, 24 Августа 2020

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