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

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

    +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
    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
    <?php
    var lastmsgid=$('.chat-msg:eq(0)',$(this).parent()).data('messageid');
    var lastmsg=$('#chat .chat-msg[data-messageid='+lastmsgid+']');
    var lastmsgscroll=lastmsg.offset().top;
    var lastscroll=$('#chat .messages').scrollTop();
    $(this).attr('disabled','disabled');var button=$(this);$.ajax({
    
              url: '<?=$baseHref;?>chat.php?more=1&user=<?=(int)$_GET['user'];?>&last=<?=(int)$last;?>',
    
              success: function(data) {
            if(data!='err'){
    data=JSON.parse(data);
    button.parent().prepend(data.messages);button.remove();fixdates();
    /*smiles*/$('#chat .messages .chat-msg div:not(.smilesadded)').each(function(){$(this).addClass('smilesadded').html(replacesmiles($(this).html()));});
    if($('#chat .messages').scrollTop()==0)$('#chat .messages').scrollTop(lastscroll-lastmsgscroll+lastmsg.offset().top);//prepend и так это делает. но не всегда
    
    } else {alert('Error');button.removeAttr('disabled');}
              },
              error:  function(xhr, str){
    	    alert('Error: ' + xhr.responseCode);
                   button.removeAttr('disabled');
              }
            });" class="btn-more button" style="margin-top:20px;margin-bottom:20px;"><?_e('Загрузить ещё');?></button><?}
    if(!isset($_GET['checknew']))$messages=array_reverse($messages);
    $user=mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT * FROM users WHERE `id`=".(int)$_GET['user']." LIMIT 1;"));
    foreach($messages as $data){
    if($yourdirection==$data['direction'])$userid=$account['id']; else $userid=(int)$_GET['user'];
    
    
    $fake=0;
    if(substr($data['text'],0,7)==':attach' && substr($data['text'],-1)==':'){$data['attachment']='../no-attach-premium.png?';if($premium)$data['attachment']=substr($data['text'],7,-1);$data['text']='';$fake=1;}
    ?>

    И сказал Господь: сойдем же и смешаем языки их, чтобы один не понимал речи другого.

    soxati, 05 Марта 2020

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

    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
    void main(void)
    {
    	int a1,a2,a3,a4,a5,a6,a7,a8,a9;
    	int b1,b2,b3,b4,b5,b6,b7,b8,b9;
    	int c1,c2,c3,c4,c5,c6,c7,c8,c9;
    	int d1,d2,d3,d4,d5,d6,d7,d8,d9;
    	int e1,e2,e3,e4,e5,e6,e7,e8,e9;
    	int f1,f2,f3,f4,f5,f6,f7,f8,f9;
    	int g1,g2,g3,g4,g5,g6,g7,g8,g9;
    	int h1,h2,h3,h4,h5,h6,h7,h8,h9;
    	int i1,i2,i3,i4,i5,i6,i7,i8,i9;
    
    ....
    
    }

    Когда-то когда я еще не знал о существовании массивов.... это начало программы для решения судоку.
    В продолжении этого были определены еще 729 переменных для вариантов решения.

    fomenokdima, 11 Января 2020

    Комментарии (18)
  4. 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)
  5. 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)
  6. C++ / Говнокод #25898

    +1

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

    OlegUP, 03 Октября 2019

    Комментарии (18)
  7. Куча / Говнокод #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)
  8. 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)
  9. 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)
  10. Куча / Говнокод #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)
  11. 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)