1. C++ / Говнокод #17657

    +51

    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
    //Sets the color(background and foreground)
    void Console::SetColor(){
        #ifdef _WIN32
            SetConsoleTextAttribute(hConsole, FGColor | BGColor);
        #else
            string clr = "\033[";
            clr += BGColor;
            clr += ";";
            clr += FGColor;
            clr += "m";
            cout << clr;
        #endif
    }

    Изменение цвета текста и фона консоли

    govnokod3r, 17 Февраля 2015

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

    +160

    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
    35. 35
    36. 36
    if ($sub_sub_sub_sub_category_id !== null) {
    
    													if ($this->core->countUrl > 5) {
    														header('Location: /404/');
    													}
    
    													foreach ($categories[$category_id][$sub_category_id][$sub_sub_category_id][$sub_sub_sub_category_id][$sub_sub_sub_sub_category_id] as $k1 => $v1) {
    														if ($k1 !== 0) {
    															foreach ($v1 as $k2 => $v2) {
    																if ($k2 !== 0) {
    																	if ($this->core->translit($v2[0]) == $sub_sub_sub_category) {
    																		$sub_sub_sub_sub_sub_category_id = $k1;
    																		$sub_sub_sub_sub_sub_sub_category_id = $k2;
    																		break;
    																	}
    																}
    															}
    														}
    													}
    
    													$this->core->title($categories[$category_id][$sub_category_id][$sub_sub_category_id][$sub_sub_sub_category_id][$sub_sub_sub_sub_category_id][$sub_sub_sub_sub_sub_category_id][$sub_sub_sub_sub_sub_sub_category_id][0]);
    													$bread_crumbs[] = array(
    														'text' => $categories[$category_id][$sub_category_id][$sub_sub_category_id][$sub_sub_sub_category_id][$sub_sub_sub_sub_category_id][$sub_sub_sub_sub_sub_category_id][$sub_sub_sub_sub_sub_sub_category_id][0],
    														'url' => $location['alias'] . '/' . $this->core->translit($categories[$category_id][0]) . '/' . $this->core->translit($categories[$category_id][$sub_category_id][$sub_sub_category_id][0]) . '/' . $this->core->translit($categories[$category_id][$sub_category_id][$sub_sub_category_id][$sub_sub_sub_category_id][$sub_sub_sub_sub_category_id][0]) . '/' . $this->core->translit($categories[$category_id][$sub_category_id][$sub_sub_category_id][$sub_sub_sub_category_id][$sub_sub_sub_sub_category_id][$sub_sub_sub_sub_sub_category_id][$sub_sub_sub_sub_sub_sub_category_id][0])
    													);
    
    													$query_add = "
    														AND (`market_item`.`category_key` = '" . $category_id . "')
    														AND  `market_item`.`param` REGEXP '(\&quot;" . $sub_sub_sub_sub_category_id . "\&quot;)'
    													";
    													
    													$vip_query_add = "
    														AND `market_item`.`category_key` = '" . $category_id . "'
    													";
    
    												}

    qualitycode, 16 Февраля 2015

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

    +127

    1. 1
    2. 2
    wct 
    http://habrahabr.ru/post/250713/

    Vasiliy, 16 Февраля 2015

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

    +127

    1. 1
    http://i.gyazo.com/dd1b407b6ea528e59de2966e49d4cb82.png

    Юзабилити)))

    motobuster, 16 Февраля 2015

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

    +164

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    window.onload = function (){
         var divs=document.getElementsByTagName("DIV");
         for( var i=0; i<divs.length; i++)
         if(divs[i].className=="pro")
              divs[i].style.minHeight=0+"px" 
         ;
    }

    Целостность кода сохранена.

    korovnikissi, 16 Февраля 2015

    Комментарии (22)
  6. Python / Говнокод #17650

    −109

    1. 1
    2. 2
    3. 3
    4. 4
    def remove_duplicates(seq):
        seen = set()
        seen_add = seen.add
        return [x for x in seq if x not in seen and not seen_add(x)]

    замечательная функция, возвращающая уникальные элементы списка.

    python_ninja, 16 Февраля 2015

    Комментарии (3)
  7. Java / Говнокод #17649

    +74

    1. 1
    2. 2
    3. 3
    4. 4
    /**
     * singletone staff:
     */
    private static LogisticsAppContext local;

    Однотонный посох?

    someone, 16 Февраля 2015

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

    +158

    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
    35. 35
    36. 36
    if ( !defined ('BX_SKIP_INSTALL_CHECK') && file_exists( $dir['root'] . 'install' ) ) {
        $ret = <<<EOJ
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
    <head>
        <title>Dolphin Installed</title>
        <link href="{$site['url']}install/general.css" rel="stylesheet" type="text/css" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </head>
    <body class="bx-def-font">
        <div class="adm-header">
            <div class="adm-header-content">
                <div class="adm-header-title bx-def-margin-sec-left">
                    <img class="adm-header-logo" src="{$site['url']}administration/templates/base/images/logo.png" />
                    <div class="adm-header-text bx-def-font-h1">Dolphin {$site['ver']}</div>
                    <div class="clear_both">&nbsp;</div>
                </div>
                <div class="clear_both">&nbsp;</div>
            </div>
        </div>
        <div id="bx-install-main" class="bx-def-border bx-def-round-corners bx-def-margin-top">
            <div id="bx-install-content" class="bx-def-padding">
                <div class="bx-install-header-caption bx-def-font-h1 bx-def-margin-bottom">
                    Well done, mate! Dolphin is now installed.
                </div>
                <div class="bx-install-header-text bx-def-font-large bx-def-font-grayed">
                    Remove directory called <b>"install"</b> from your server and <a href="{$site['url']}administration/modules.php">proceed to Admin Panel to install modules</a>.
                </div>
            </div>
        </div>
    </body>
    </html>
    EOJ;
        echo $ret;
        exit();
    }

    Какой веселый вывод HTML (Dolphin 7)

    jey-val-star, 15 Февраля 2015

    Комментарии (0)
  9. Си / Говнокод #17647

    +138

    1. 1
    2. 2
    3. 3
    if (r_ptr->flags1 & (RF1_FEMALE)) my_strcpy(desc, "себя", max);
    else if (r_ptr->flags1 & (RF1_MALE)) my_strcpy(desc, "себя", max);
    else my_strcpy(desc, "себя", max);

    Может, я чего-то не понимаю?

    CYB3R, 15 Февраля 2015

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

    +76

    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
    35. 35
    36. 36
    private List< String > extractMetaDataLines()
    {
       final ArrayList< String > metaDataLines = new ArrayList< String >();
       int currentLineIndex = 0;
       int start = 0;
       int end = 0;
    
       for ( final String line : getLines() )
       {
          if ( line.contains( METADATA_TAG ) )
          {
             if ( line.contains( "</" ) )
             {
                end = currentLineIndex
                      - ( getLines().get( currentLineIndex - 1 ).contains( "]]>" ) ? 1
                                                                                  : 0 );
                if ( line.contains( "<fx" )
                      || line.contains( "<mx" ) )
                {
                   start = end;
                }
                break;
             }
             if ( line.contains( "<" ) )
             {
                start = currentLineIndex
                      + ( getLines().get( currentLineIndex + 1 ).contains( "CDATA[" ) ? 2
                                                                                     : 1 );
             }
          }
          currentLineIndex++;
       }
       metaDataLines.addAll( getLines().subList( start,
                                                 end ) );
       return metaDataLines;
    }

    build.xml:413: java.lang.IllegalArgumentException: fromIndex(12) > toIndex(11)
    at java.util.ArrayList.subListRangeCheck(ArrayList.java:964)
    at java.util.ArrayList.subList(ArrayList.java:954)
    at com.adobe.ac.pmd.files.impl.MxmlFile.extractMetaDataLines(MxmlFile.java:262)
    at com.adobe.ac.pmd.files.impl.MxmlFile.copyScriptLinesKeepingOriginalLineIndices(MxmlFile.java:191)

    Адоб, как обычно, порадовал. (Это типа линт, который должен проверять мелкие ошибки / стиль). В проекте примерно 300 файлво в которых есть тег "метадата", пойди пойми на каком оно валится... Самому собрать это говно - нереально сложно изза каких-то уебищных зависимостей, конфликтов версий мейвена и т.п.

    wvxvw, 15 Февраля 2015

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