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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    $np = new NP();
        //Проверяю пользователя на модератора
        $arResult["showModerInfo"] = ($np->checkUserAccess([6]));
        $fil = $arResult['FILTER']; // Ради сокращения длины строк
        $req = $np->getRequest()->toArray()['filter'];
        ?>
        <div class="col-xs-12">
            <div class="b-shadow-wrapper b-filter" <?=($arResult['FILTER'])?'style="display:block"':''?>>

    сокращение строк

    hipachka, 17 Марта 2018

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

    −25

    1. 1
    Никто не заметил связи между уходами долбоёба-стертора, и внезапным появлением kegdan?

    Кого наебать решил, паскуда?

    _guestinho, 17 Марта 2018

    Комментарии (3)
  3. Pascal / Говнокод #23945

    +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
    program bio;
    uses crt, graphABC;
    const y1=200; r1=20;
    var
    x2,x3,r:real;
    
    procedure del (x1,x11:integer);
    begin
    circle (x1,y1,r1); 
    sleep(1000); 
    ClearWindow();
    r:=r1/2;
    x2:=x1-(r);
    circle (Trunc(x2),y1,Trunc(r));
    x3:=x11+(r);
    circle (Trunc(x3),y1,Trunc(r));
    sleep(1000); 
    r:=r*2;
    x2:=x1-(r);
    circle (Trunc(x2),y1,Trunc(r));
    x3:=x11+(r);
    circle (Trunc(x3),y1,Trunc(r));
    del(Trunc(x2),Trunc(x3));
    end;
    
    
    begin
    SetWindowSize(600,400);
    setBrushColor(clGreen);
    del(300,300);
    end.

    Симулятор деления клеток на паскале, который не работает.

    SewerSurfer, 17 Марта 2018

    Комментарии (2)
  4. Ruby / Говнокод #23944

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    @requests  = Request.where(instrument_id: 1).where("state_id not in (12,3,5,8,13,15,4)").where(id: current_user.arr_request_services).order(priority_id: :desc, updated_at: :desc, id: :desc) #.page(params[:page]).per_page(20)
            @requests1 = Request.where(instrument_id: 1).where(locked_by: current_user).where("state_id not in (12,3,5,8,13,15,4)").order(priority_id: :desc, updated_at: :desc, id: :desc)
            @requests2 = Request.where(instrument_id: 1).where(author_id: current_user.id).where("state_id not in (12,3,5,8,13,15,4)").order(priority_id: :desc, updated_at: :desc, id: :desc)
            @requests3 = Request.where(instrument_id: 1).where(owner_id: current_user.id).where("state_id not in (12,3,5,8,13,15,4)").order(priority_id: :desc, updated_at: :desc, id: :desc)
            @requests  = (@requests + @requests1 + @requests2 + @requests3).uniq

    Что это ?

    eggshke, 17 Марта 2018

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

    −27

    1. 1
    2. 2
    3. 3
    Политота.
    
    Ребята, девчонки и петухи. Завтра будем голосовать, выбирать себе хозяина еще на 4 года. У кого какие соображение на этот счет?

    kegdan, 17 Марта 2018

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

    −4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    if ($memberInfo['member_profile_image'] != ''):
                                                $memberInfo['photoCount'] = $memberInfo['photoCount'] ;
                                            else:
                                            	$memberInfo['photoCount'] = $memberInfo['photoCount'];
                                                
                                            endif;

    6 строчек кода, а этот код не делает ничего. От слова совсем

    gorsash, 16 Марта 2018

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

    −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
    public function syncStock() {
            $locked = file_exists(__DIR__ . '/lock/gk_sync_stock');
    
            if ($locked) {
                $this->logger->log("Attempt to sync locked stock");
                return;
            }
    
            file_put_contents(__DIR__ . '/lock/gk_sync_stock', current_time('mysql'));
    
            $changed = $this->_syncStock();
    
            unlink(__DIR__ . '/lock/gk_sync_stock');
    
            $this->logger->log("Sync stock complete, $changed changed");
        }

    Тут может произойти дедлок, или ни один из синхронных запросов не выполнится?

    inho, 16 Марта 2018

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

    −2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    assert exec("from my_runtime_analyze_lib import do_amazing_magic") or True
    
    
    if __name__ == '__main__':
        do_smth()
        assert do_amazing_magic()
        do_smth_else()

    Как вхерачить в код любую ересь для dev окружения, а потом отключить на продакшене. Только не забыть бы на проде при запуске флаг оптимизации.

    intestinalbrain, 16 Марта 2018

    Комментарии (5)
  9. C++ / Говнокод #23938

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    Antony Polukhin
     in 
    pro.cxx
    Кстати, в EWG одобрили constexpr контейнеры http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p0784r1.html
    так что есть все шансы к С++20 писать:
    constexpr std::string result = foo();
    t.me/ProCxx
    /184343
    Mar 16 at 10:47

    Library pragmatism

    Current implementations of standard libraries sometimes perform various raw storage operations through interfaces other than the standard allocator and allocator traits. That may make it difficult to make the associated components usable in constexpr components. Based on a cursory examination of current practices, we therefore propose to start only with the requirement that the container templates in the [containers] clause be usable in constexpr evaluation, when instantiated over literal types and the default allocator. In particular, this excludes std::string, std::variant, and various other allocating components. Again, it is our hope we will be able to extend support to more components in the future.

    With regards to the default allocator and allocator traits implementation, the majority of the work is envisioned in the constexpr evaluator: It will recognize those specific components and implement their members directly (without necessarily regarding the library definition).
    We might, however, consider decorating the class members with the constexpr keyword. Also, some implementations provide extra members in these class templates (such as libc++'s allocator_traits<A>::__construct_forward ) that perform non-constexpr-friendly operations (memcpy, in particular). Lifting such members to standard status would help interoperability between library and compiler implementations.

    j123123, 16 Марта 2018

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

    −5

    1. 1
    2. 2
    3. 3
    Внимание!
    Сегодня день числа Пи.
    Давайте все дружно поздравим 3.14159265дара 14 марта в 1:59:27

    inho, 14 Марта 2018

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