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

    +150

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    $duration_date = date(
        'Y-m-d H:i:s',
        strtotime(
            date(
                'Y-m-d H:i:s',
                strtotime($_REQUEST['task_start_date'])) . ' + ' . $_REQUEST['task_frequency'] . '  ' . $freq_type . ''
        )
    );

    Кто-то может это упростить ? Я уже устал

    __proto__, 01 Октября 2013

    Комментарии (2)
  2. C# / Говнокод #13880

    +129

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    private List<Ball> _balls;
    private Interaction GetInteraction(Ball ball) {
      foreach (var b2 in _balls.SkipWhile(b => b != ball).Skip(1)) {
          /* ... */
      }
    }
    
    var table = _balls.Select(GetInteraction);

    Откопал в своей проге.
    нужно было определить, какой шарик с кем взаимодействует раньше всего, притом если уже рассчитано взаимодействие 1 и 2 шарика (при рассчёте взаимодействий 1 и 2, 1 и 3, 1 и 4, ... и выделено самое раннее взяимодействие шарика 1), то взимодействие 2 и 1 рассчитываеть не надо. Таким образом, нужно было пройти все пары шариков так, чтоб первый встретился в списке раньше второго.
    Массивы, индексы и циклы? Не, не знаем такого. Только Select, только ФП, только колдовство со SkipWhile(b => b!=ball).Skip(1).

    Jean-Esther, 01 Октября 2013

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

    +149

    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
    <?php
    
        if ($update_flag == '1') {
    
            $updat_finished_task = $db->update(
                'tbl_user_task',
                array(
                    'is_finished'               => '0',
                    'user_task_update_datetime' => date('Y-m-d H:i:s')
                ),
                '1=1'
            );
        }
    
        ?>

    UPDATE
    tbl_user
    SET
    is_finished = [is_finished],
    user_task_update_datetime = [data_time]
    WHERE 1 = 1

    MySQL 5

    __proto__, 01 Октября 2013

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

    +151

    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
    for($j = 0; $j < count($_REQUEST['option_question']); $j++)
                    {
                            $max_id = $db->max_field("tbl_task_option","option_question_id","1=1");
                            $max_id = $max_id+1;
                            
                            $tbl_option_insert=array(
                                    'task_id' => $_REQUEST['task_id'],
                                    'subtask_id' => $subtask_id,
                                    'option_question_id' => $max_id,
                                    'option_question' => $_REQUEST['option_question'][$j],
                                    'option_answer' => $_REQUEST['option_ans'][$j][0],
                                    'option_insert_datetime' => date('Y-m-d H:i:s')
                            );
                            $task_option_id = $db->insert($tbl_option_insert,"tbl_task_option");
                            $i = $i + 1;
                    }

    option_question_id INT NOT NULL AUTO_INCREMENT

    __proto__, 01 Октября 2013

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

    +149

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    public function fetchEmployees()
        {
            global $result, $check_u_id, $second_check_u_id, $query123;
    
            ....

    __proto__, 30 Сентября 2013

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

    +116

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    "create": "form[name=save]",
         "edit": "form[name=save]",
         "delete": "form[name=delete]",
    -    "select": "select[name=^employees]"
    +    "select": "select[name^=employees]"
       };
     
       var actionTable = {

    git commit

    __proto__, 30 Сентября 2013

    Комментарии (1)
  7. Си / Говнокод #13875

    +139

    1. 1
    for (normalize(); n > 0; scanf("%d", &temp, n--)){...}

    Но ведь работает!

    Nex, 30 Сентября 2013

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

    +126

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    <link rel="stylesheet" href="/libraries/mediaelement/mediaelementplayer.min.css">
    <link href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" rel="stylesheet">
    <script type="text/javascript" src="/js/jquery/jquery-latest.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
    <script type="text/javascript" src="/libraries/mediaelement/andplayer.min.js"></script>
    <script type="text/javascript" src="/js/jquery_tools.js"></script>

    Все это, пара десятков строк мутного джаваскрипта и столько же HTMLя и PHP потребовалось опытному филиппинскому сотруднику, чтобы добавить видеоролик на страницу.

    quall, 30 Сентября 2013

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

    +12

    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
    #include <string>
    #include <sstream>
    #include <iostream>
    
    int main() {
        std::string str;
        std::stringstream s("");
        std::getline(s, str, '|');
        std::cout << "good=" << s.good() <<
            " bad=" << s.bad() <<
            " fail=" << s.fail() <<
            " eof=" << s.eof() << std::endl;
        return 0;
    }

    good=0 bad=0 fail=1 eof=1

    http://ideone.com/0Ceg8z

    У меня один вопрос: нахуй так жить?

    bormand, 30 Сентября 2013

    Комментарии (245)
  10. C# / Говнокод #13872

    +109

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    BusinessLogic.Entity_InheritanceSetting.Save(
                        Session.SessionSettings.Settings.ContactID.Value,
                        Session.SessionSettings.Settings.SessionID.Value, copyID.Value,
                        true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
                        true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
                        true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
                        true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
                        true, true, true, true, true, true, true, true, true, true, true, true, true, true, true);

    kore_sar, 30 Сентября 2013

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