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

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

    −20

    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
    void MainWindow::justDoIt(){
    ui->textEdit->clear();
    bool b[16];
    for (int i = 0; i < 16; ++i) {
        b[i] = false;
    }
        ui->textEdit->append("$$ \n \\begin{cases}");
        QString a;
        a += (ui->lineEdit->text().toDouble() == 0 ? "": (b[0] = true, ui->lineEdit->text().toDouble() == 1 && ui->checkBox->isChecked() ? "x_1" :ui->lineEdit->text().remove("+") + "x_1"));
        a += (ui->lineEdit_2->text().toDouble() == 0 ? "" : (b[1] = true,ui->lineEdit_2->text().toDouble() < 0 || (!b[0])? "":"+") +(ui->lineEdit_2->text().toDouble() == 1 && ui->checkBox->isChecked() ? "x_2" : ui->lineEdit_2->text().remove("+")+"x_2"));
        a += (ui->lineEdit_3->text().toDouble() == 0 ? "" : (b[2] = true,ui->lineEdit_3->text().toDouble() < 0 || (!b[0] && !b[1]) ? "":"+") +(ui->lineEdit_3->text().toDouble() == 1 && ui->checkBox->isChecked() ? "x_3" :ui->lineEdit_3->text().remove("+")+"x_3"));
        a += (ui->lineEdit_4->text().toDouble() == 0 ? "" : (b[3] = true,ui->lineEdit_4->text().toDouble() < 0 || (!b[0] && !b[1] && !b[2])? "":"+") +(ui->lineEdit_4->text().toDouble() == 1 && ui->checkBox->isChecked() ? "x_4" :ui->lineEdit_4->text().remove("+")+"x_4"));
        if(b[0] || b[1] || b[2] || b[3]){
            a += "=";
            a += ui->lineEdit_5->text();
            a += "\\\\\n";
        }
    /*еще такой же код*/ 
        a += (ui->lineEdit_24->text().toDouble() == 0 ? "" : (b[12] = true,ui->lineEdit_24->text().toDouble() == 1 && ui->checkBox->isChecked() ? "x_1" :ui->lineEdit_24->text()+"x_1"));
        a += (ui->lineEdit_21->text().toDouble() == 0 ? "" : (b[13] = true,ui->lineEdit_21->text().toDouble() < 0 || (!b[13])? "":"+") +(ui->lineEdit_21->text().toDouble() == 1 && ui->checkBox->isChecked() ? "x_2" :ui->lineEdit_21->text().remove("+")+"x_2"));
        a += (ui->lineEdit_23->text().toDouble() == 0 ? "" : (b[14] = true,ui->lineEdit_23->text().toDouble() < 0 || (!b[13]&&!b[14])? "":"+") +(ui->lineEdit_23->text().toDouble() == 1 && ui->checkBox->isChecked() ? "x_3" :ui->lineEdit_23->text().remove("+")+"x_3"));
        a += (ui->lineEdit_22->text().toDouble() == 0 ? "" : (b[15] = true,ui->lineEdit_22->text().toDouble() < 0 || (!b[13]&&!b[14]&&!b[15])? "":"+") +(ui->lineEdit_22->text().toDouble() == 1 && ui->checkBox->isChecked() ? "x_4" :ui->lineEdit_22->text().remove("+")+"x_4"));
        if(b[12] || b[13] || b[14] || b[15]){
            a += "=";
            a += ui->lineEdit_25->text();
        }
    
    ui->textEdit->append(a);
    ui->textEdit->append("\\end{cases} \n$$");
    }

    Превращает матрицу 4х5 в СЛАР на LaTeX

    Abbath, 01 Мая 2012

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

    +40

    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
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    У МЕНЯ БОЛЬШОЙ ХУЙ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    uiopqwertyasd, 01 Мая 2012

    Комментарии (10)
  4. Си / Говнокод #10123

    +130

    1. 1
    2. 2
    3. 3
    #define FOO     /* a macro with a multiline comment
                     * gets the linecount wrong
                     */

    Splint will miscalculate line numbers after multi-line comments in macro definitions. For example,

    rat4, 30 Апреля 2012

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

    +154

    1. 1
    2. 2
    this.ie = (name=="ie" && this.v>=4)
    this.activeX = ( this.ie ) ? true : false;

    Кусочек шедевра
    https://github.com/miketaylr/Snort/blob/master/snort.yml

    kindofbear, 30 Апреля 2012

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

    +75

    1. 1
    2. 2
    <input type="text" value="1" id="Count" size="1">
    <a href="<?=$arResult["ADD_URL"]?>" rel="nofollow" onclick="return addToCart(this, 'catalog_detail_image', 'detail', '<?=GetMessage("CATALOG_IN_BASKET")?>');" id="catalog_add2cart_link"><span><img src="/upload/cart.jpg"></span>

    o1eg, 29 Апреля 2012

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

    +90

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if ($value != 0) { // Если значение не равно нулю
    $this->koeff = $value * 0.01; // Коэффициенту этого экземляра класса присвоить одну сотую от цены
    $count++; // Счетчик увеличиваем на единицу
    } else { // Иначе
    $this->koeff=0; // Устанавливаем коэффициент этого экземпляра класса равным нулю
    // Счетчик не увиличиваем
    } // Конец условия

    Код боевой не мой, комментарии авторские.

    Tairesh, 26 Апреля 2012

    Комментарии (10)
  8. Java / Говнокод #10019

    +70

    1. 1
    if (sAttrName.equalsIgnoreCase("10")) {

    someone, 23 Апреля 2012

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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    foreach ($metrics as $m)
    		{
    		eval('$data["'.$a.'"]["'.$m.'"] = $result->get'.$m.'();');
    		}

    На одном из сайтов который объясняют как работать с гугл аналикс апи.
    Нафига выполнять столько раз евал???

    не легче и лучше
    $key = 'get' . $m;
    $data[$a][$m] = $result->{$key}();
    евалить стопицот рас???

    3xdimon, 19 Апреля 2012

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

    +1002

    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
    //pugiXML.cpp:
    template <bool _1, bool _2, bool _3, bool _4> struct opt4_to_type
    	{
    		static const bool o1;
    		static const bool o2;
    		static const bool o3;
    		static const bool o4;
    	};
    
    	template <bool _1, bool _2, bool _3, bool _4> const bool opt4_to_type<_1, _2, _3, _4>::o1 = _1;
    	template <bool _1, bool _2, bool _3, bool _4> const bool opt4_to_type<_1, _2, _3, _4>::o2 = _2;
    	template <bool _1, bool _2, bool _3, bool _4> const bool opt4_to_type<_1, _2, _3, _4>::o3 = _3;
    	template <bool _1, bool _2, bool _3, bool _4> const bool opt4_to_type<_1, _2, _3, _4>::o4 = _4;
    //...
    case 0:  return strconv_attribute_t(s, end_quote, opt4_to_type<0, 0, 0, 0>());
    		case 1:  return strconv_attribute_t(s, end_quote, opt4_to_type<0, 0, 0, 1>());
    		case 2:  return strconv_attribute_t(s, end_quote, opt4_to_type<0, 0, 1, 0>());
    		case 3:  return strconv_attribute_t(s, end_quote, opt4_to_type<0, 0, 1, 1>());
    		case 4:  return strconv_attribute_t(s, end_quote, opt4_to_type<0, 1, 0, 0>());
    		case 5:  return strconv_attribute_t(s, end_quote, opt4_to_type<0, 1, 0, 1>());
    //...
    		case 14: return strconv_attribute_t(s, end_quote, opt4_to_type<1, 1, 1, 0>());
    		case 15: return strconv_attribute_t(s, end_quote, opt4_to_type<1, 1, 1, 1>());
    //...
    inline xml_parse_result make_parse_result(xml_parse_status status, unsigned int offset, unsigned int line)
    	{
    		xml_parse_result result = {status, offset, line};
    		return result;
    	}
    
    //pugixpath.cpp:
    block = static_cast<memory_block*>(operator new(size + sizeof(memory_block) - xpath_memory_block_size));

    PugiXML

    Говногость, 16 Апреля 2012

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

    +1002

    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
    void TExternalIOBuffer::swap(TExternalIOBuffer& Buffer)
    {
    	ASSERT(typeid(Buffer)==typeid(TExternalIOBuffer));
    	const TExternalIOBuffer CurrentBuffer=*this;
    	const TExternalIOBuffer OtherBuffer=Buffer;
    	Buffer.~TExternalIOBuffer();
    	::new((void*)&Buffer) TExternalIOBuffer(CurrentBuffer);
    	this->~TExternalIOBuffer();
    	::new((void*)this) TExternalIOBuffer(OtherBuffer);
    };
    
    const TExternalIOBuffer& TExternalIOBuffer::operator=(const TAbstractIOBuffer& Buffer)
    {
    	this->~TExternalIOBuffer();
    	::new((void*)this)TExternalIOBuffer(Buffer);
    	return *this;
    };

    Большой проект, попало в релиз.

    Говногость, 16 Апреля 2012

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