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

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

    +10

    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
    int getNextCode(int &currentByte, int codeLen)
    {
        int nextCode = 0, mask;
        mask = (int)pow(2, codeLen) - 1;
        if (rest >= codeLen) {
            nextCode = currentByte & mask;
            currentByte >>= codeLen;
            rest -= codeLen;
        } else {
            int nextByte, temp;
            encoded >> std::hex >> nextByte;
            if (codeLen <= rest + 8) {
                temp = nextByte;
                temp <<= rest;
                temp += currentByte;
                rest = 8 + rest - codeLen;
                currentByte = nextByte >> (8 - rest);
            } else {
                int secondByte;
                encoded >> std::hex >> secondByte;
                temp = secondByte << (rest + 8);
                temp += nextByte + currentByte;
                rest = 16 + rest - codeLen;
                currentByte = secondByte >> (8 - rest);
            }
            nextCode = temp & mask;
        }
        return nextCode;
    }

    Функция, для декодера *gif . Считывает несколько бит из файла.

    Juksare, 26 Июня 2014

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

    +155

    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
    /* $res = array ('res_count' => 15,   кол-во результатов
                               '...' => прочее,
    )*/
    
    {if ($res) && (($res['res_count']%10) == 1)&& ((($res['res_count']/10)%10) != 1)}  
    	нашёлся <b>{$res['res_count']}</b> результат
    {else} 
    	нашлось <b>{$res['res_count']}</b> 
    	{if ($res) && ((($res['res_count']/10)%10) != 1) && (($res['res_count']%10)>1) && (($res['res_count']%10)<5)}
    		результата
    	{else}
    		результатов
    	{/if}
    {/if}

    нашёл функцию под SMARTY для склонения слов, которая используется при выводе результатов поиска... она была записана в 1-у строчку для "лучшего понимания" (напишу в комменте )

    govnokoder2, 25 Июня 2014

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

    +156

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    if ($end < $start) {
    	$errorLimit = '<p><u><b>End limit</b></u> should be bigger number than <u><b>Start limit</b></u></p>';
    	//echo $errorLimit;
    	throw new \grdprc\Exception(strip_tags($errorLimit));
    	return;
    }

    <p><u><b> тоже ок.

    quall, 25 Июня 2014

    Комментарии (2)
  5. Java / Говнокод #16212

    +78

    1. 1
    public static final String TimeoutInMilliseconds = "timeoutInSeconds";

    Нашел в константах нашего проекта. Существовало и ежедневно использовалось в течение 8 месяцев. Глянул историю - создано и редактировалось только мной. Фейспалм.

    mdcool, 23 Июня 2014

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

    +154

    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
    $this->db->from("admin_sidebar");
            $this->db->where("folder", 1);
            $this->db->order_by("sort", "asc");
            $query = $this->db->get();
            $data[0] = $query->result();
            $this->db->from("admin_sidebar");
            $this->db->where("folder", 2);
            $this->db->order_by("sort", "asc");
            $query = $this->db->get();
            $data[1] = $query->result();
            $this->db->from("admin_sidebar");
            $this->db->where("folder", 3);
            $this->db->order_by("sort", "asc");
            $query = $this->db->get();
            $data[2] = $query->result();
            $this->db->from("admin_sidebar");
            $this->db->where("folder", 4);
            $this->db->order_by("sort", "asc");
            $query = $this->db->get();
            $data[3] = $query->result();
            $this->db->from("admin_sidebar");
            $this->db->where("folder", 5);
            $this->db->order_by("sort", "asc");
            $query = $this->db->get();
            $data[4] = $query->result();

    asdozzz, 19 Июня 2014

    Комментарии (2)
  7. SQL / Говнокод #16099

    −169

    1. 1
    SELECT Status_ID FROM User,UserStatus,Status WHERE User_ID=UserStatus_UserID AND UserStatus_StatusID=Status_ID GROUP BY Status_ID

    dafuq, 03 Июня 2014

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

    +5

    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 <iostream>
    using namespace std;
    struct ko{
    	int r;
    } f;
    const ko& taras=f;
    int main() {
    	cout<<
    	is_same<decltype(taras.r), int>::value
    	<<" "<<
    	is_same<decltype((taras.r)), const int &>::value
    	<<endl;
    	return 0;
    }

    What is output you expect? You should answer without looking at ideone link and without using compiler.
    http://ideone.com/5O9vtZ

    LispGovno, 30 Мая 2014

    Комментарии (2)
  9. PHP / Говнокод #16036

    +157

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    echo '
    <font class="phonetop">
      +7 (495) 
      <font style="font-size:28px">
        99-888-77
      </font>
    </font>
    ';

    ну как так можно?
    использовать в теге font class, и в то же время, умудриться непонятно для чего изменять размер шрифта в теге font через style?
    даже если нравится тег font, так у него есть атрибут size=""
    ...

    govnokoder2, 22 Мая 2014

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

    +126

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    2.2.14   Empty text box                                                Why there is an option to add an empty text box
    3.2.14   Presentation on the left side                                 The paper that the narrow on him (that playing right now), should be enlarge (like magnifying glass).
    3.2.14   Player- time scale                                            Should be an option to move the narrow on the scale and "jump" forward\backwards
    3.2.14   Slide- changing pages                                         Should be an option to move between pages while the presentation is playing\the caption appearing
    3.2.14   Slide's tooltips invisible                                    Slide's tooltips invisible because the arror is hide them
    3.2.14   Delete a slide - Are you sure message                         When a user deleting a slide, should be a message: "Are you sure?"
    5.2.14   Slide- "Play presentation" button, should call "Full screen"  It's not clear enough that this button is Full screen
    5.2.14   Slide- Minimize button- should have tooltip                   It's not clear enough that this button is Minimize button
    5.2.14   Picture Editing                                               Its not clear enough that the small button in corner is the "Edit button", when clicking on the picture to
                                                                           edit, its go back to the library

    English as she is spoke.

    Сегодня получил списог багов обнаруженый нашим КуЭй. Это только малая толика (всего их там около сотни).

    wvxvw, 20 Мая 2014

    Комментарии (2)
  11. JavaScript / Говнокод #16020

    +162

    1. 1
    var errorIsShown = false; // если уже показана ошибка, то зачем опять показывать сообщение об ошибке (ведь если чего то не так.. то логично, что ошибки ещё будут...)

    |Mesi

    И еще больше замечательных комментариев: http://study.mesi.ru/_layouts/elrportal/assessment/JScript/Other.js

    alyxbit, 19 Мая 2014

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