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

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

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    $interval = $interval->m;
    
    switch ($interval){
        case 1: brake;
        case 3: brake;
    }

    от предыдущего тимлида

    Sm0_ker, 09 Декабря 2019

    Комментарии (18)
  3. PHP / Говнокод #26047

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    foreach ($cart = LaraCart::getItems() as $product) {         
        $product->id;      
           $product->name;      
           $product->title_slug;       
          $product->price;         
        $product->qty;      
           $product->photo;     
            $product->item_type;  
           }

    А не прогнать бы нам просто данные ммм?

    ARTWIN_PRO, 26 Ноября 2019

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

    +1

    1. 1
    2. 2
    3. 3
    size_t 	nChLen = it_ch_end - it_ch;
    
    до меня дошло не сразу.

    OlegUP, 03 Октября 2019

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

    +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
    There was once a programmer who was attached to the court of the
    warlord Wu.  The warlord asked the programmer: "Which is easier to design:
    an accounting package or an operating system?"
            "An operating system," replied the programmer.
            The warlord uttered an exclamation of disbelief. "Surely an
    accounting package is trivial next to the complexity of an operating
    system," he said.
            "Not so," said the programmer, "when designing an accounting package,
    the programmer operates as a mediator between people having different ideas:
    how it must operate, how its reports must appear, and how it must conform to
    tax laws.  By contrast, an operating system is not limited by outward
    appearances.  When designing an operating system, the programmer seeks the
    simplest harmony between machine and ideas.  This is why an operating system
    is easier to design."
            The warlord of Wu nodded and smiled. "That is all good and well,"
    he said, "but which is easier to debug?"
            The programmer made no reply.
                    -- Geoffrey James, "The Tao of Programming"

    друзья, а как думаете вы?
    что проще делать, а что дебажить?

    MAPTbIwKA, 26 Сентября 2019

    Комментарии (18)
  6. PHP / Говнокод #25800

    −2

    1. 1
    https://www.php.net/manual/en/migration70.deprecated.php

    > The salt option for the password_hash() function has been deprecated to prevent developers from generating their own (usually insecure) salts.
    Какой анскилл )))

    Stallman, 03 Сентября 2019

    Комментарии (18)
  7. PHP / Говнокод #25723

    +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
    $loop = React\EventLoop\Factory::create();
    
    $server = new React\Http\Server(function (Psr\Http\Message\ServerRequestInterface $request) {
        return new React\Http\Response(
            200,
            array('Content-Type' => 'text/plain'),
            "Hello World!\n"
        );
    });
    
    $socket = new React\Socket\Server(8080, $loop);
    $server->listen($socket);
    
    echo "Server running at http://127.0.0.1:8080\n";
    
    $loop->run();

    "ReactPHP".

    BoeHHblu_nemyx, 16 Июля 2019

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    rt_fold(#{}, Acc) ->
        Acc;
    rt_fold(Keys, Acc) ->
        maps:fold(<.... опущено ...>, Acc, Keys).

    CHayT, 14 Апреля 2019

    Комментарии (18)
  9. 1C / Говнокод #25465

    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
    Набор = РегистрыСведений.ЗначенияСвойствОбъектов.СоздатьНаборЗаписей();
    		Отбор = Набор.Отбор;
    		Отбор.Объект.Использование = Истина;
    		Отбор.Объект.ВидСравнения = ВидСравнения.Равно;
    		Отбор.Свойство.ВидСравнения = ВидСравнения.Равно;
    		Отбор.Объект.Значение = Грузополучатель;                
    		Отбор.Свойство.Значение = ПланыВидовХарактеристик.СвойстваОбъектов.НайтиПоНаименованию("GLN").Ссылка;
    		Набор.Прочитать();
    		GLN_получ = "";
    		Если Набор.Количество() > 0 Тогда
    			Для нумер = 0 по Набор.Количество()-1 Цикл
    				Свво = Набор.Получить(нумер).Свойство;
    				Если СокрЛП(Свво.Наименование) = "GLN" Тогда
    					GLN_получ = Набор.Получить(нумер).Значение;
    				КонецЕсли;
    			КонецЦикла;
    		КонецЕсли;
    
    		ОбластьМакета.Параметры.GLN_получ       = GLN_получ;

    cdpoma, 22 Марта 2019

    Комментарии (18)
  10. JavaScript / Говнокод #25361

    +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
    EventBus.$on('drag-element', (element) => {
                    if (element.type !== 'form') {
                        setTimeout(() => {
                            this.dragging = true
                        }, 1000)
                    }
                }),
                EventBus.$on('change-element-order', data => {
                    this.manageElementOrder(data, this.page.elements)
                });
                EventBus.$on('change-removed-powered-by', data => {
                    this.isRemovedPoweredBy = this.theme.isRemovedPoweredBy;
                });
                EventBus.$on('select-element', (element, flags = {}) => {
                    let isElExist = false;
    
                    if (isElExist) return;
    
                    if (element.type !== 'form' || flags.isFormCreated) {
    
                        EventBus.$emit('update-email-form', element);
    
                        if (flags.isFormCreated) {
                            EventBus.$emit('add-form')
                        }
    
                        setTimeout(() => {
                            this.dragging = true
                        }, 1000)
                    } else {
                        EventBus.$emit('open-modal');
                        EventBus.$emit('set-modal-data', 'email-providers');
                    }
                });
                EventBus.$on('remove-element', element => {
                    if (!this.page.elements) return;
    
                    if (element.type == 'form') {
                        EventBus.$emit('reset-email-provide-list-fields')
                    }
    
                });
                EventBus.$on('updateBackground', (data) => {
                    this.backgroundImage = data.image;
                });
                this.$root.$on('onSetPopupPosition', this.setPopupPosition);

    VueJS
    Центральное хранилище - не, не слышал!

    websbkinfo, 07 Февраля 2019

    Комментарии (18)
  11. PHP / Говнокод #25168

    +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
    <?php
    
    function array_rot(&$butterbrot) {
        $rosenrot = array_shift($butterbrot);
        array_push($butterbrot, $rosenrot);
    }
    
    function mutate($hydra, $head) {
        if (count($hydra) < 1) {
            yield [$head];
        }
        foreach($hydra as $branch) {
          $branch[] = $head;
          for ($i = 0; $i < count($branch); ++$i) {
            array_rot($branch);
            yield $branch;
          }
        }
    }
    
    class YOBAMaster {
        private $data = [];    
        public function __get($name) {
            $tmp = [];
            foreach (mutate($this->data, $name) as $variant) {
                $tmp[] = $variant;
            }
            $this->data = $tmp;
            return $this;
        }
        public function say() {
            foreach ($this->data as $item) {
                echo implode(' ', $item) . PHP_EOL;
            }
            $this->data = [];
        }
    }
    
    $master = new YOBAmaster();
    
    $master->ALLO->YOBA->ETO->TI->say();
    
    $master->YOBI->NET->DOMA->say();

    https://ideone.com/aoZ9PX

    YOBAMaster, 08 Декабря 2018

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