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

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

    +81

    1. 1
    item.getName().equals("")==false

    Art, 23 Сентября 2011

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

    +144

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    А я люблю обмазываться не свежим С++ и дрочить. 
    Каждый день я программирую на С++. 
    На две полных проги целый день уходит. 
    Зато, когда после тяжёлого дня я прихожу домой, 
        иду на геймдев...ммм и сру в каменты про С++. 
    И дрочу, представляя, что меня поглотил единый организм С++. 
    Мне вообще кажется, что С++, умеет думать,
        у него есть своя семья, город, чувства, не удаляйте его с харда,
        лучше приютите у себя, говорите с ним, ласкайте С++.... 
    А вчера, мне преснился чудный сон, как будто я зашел на геймдев, 
        и он превратился в сайт про С++, странички, каменты, все из С++, даже небо, 
        даже Аллах!

    http://www.gamedev.ru/flame/forum/?id=152618#m9

    C_Plus_Plus_Govno, 21 Сентября 2011

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

    +161

    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
    function checkEmail(form){	
        var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
        if(pattern.test(form.email.value)  &&  (!((form.fio.value=="")||(form.email.value=="")||(form.message.value=="")) ))
    	{   
    	//Возвращаем правду
    	return true;  
        }
    	
    	else
    	{   
    	//Выводим на экран сообщение
    	alert("Вы заполнили не все поля и/или неверно заполнили поле e-mail");
        //Возвращаем ложь
        return false;
        }
    }

    Валидаторы валидируют. Форматирование сохранено.

    telnet, 21 Сентября 2011

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

    +128

    1. 1
    2. 2
    3. 3
    string a = 'a'+""+'b';
    string b = ""+'a'+'b';
    string c = 'a'+'b'+"";

    никогда не воспроизводи говнокод по памяти

    Ccik, 19 Сентября 2011

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

    +151

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $res = mysql_query("SELECT id, name, furltag, furlspage FROM {$oCfg->prefX}core WHERE top = 9 AND act = 1");
    $num_res = mysql_num_rows($res);
    for ($i = 1; $i <= $num_res; $i++){
        $row = mysql_fetch_assoc ($res);
    }

    Моё =)

    De-Luxis, 15 Сентября 2011

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

    −343

    1. 1
    [[[[[[mainDelegate.subController.CellOfTable.subCellsArray objectAtIndex:[[sourceArray objectAtIndex:1] intValue]] objectForKey:@"Cell in subCell"] subviews] objectAtIndex:0] subviews] objectAtIndex:0];

    Доголи-коротколи, а до нужной ячейки доберемся ))))

    Psionic, 13 Сентября 2011

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

    +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
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    $id = $_POST['id'];
    //$id = 194;
    $temp = $id;
    $str = "";
    for ( $incr = 0; $incr < 100; $incr++ ) {
    	$result = $dbs -> query("SELECT * FROM 
    								market_categs 
    							WHERE 
    								categid={$temp} AND 
    								published = 1 AND 
    								status = 1");
    	if ( mysql_num_rows($result) > 0 ) {
    		$categ = mysql_fetch_array($result);
    		$result2 = $dbs -> query("SELECT * FROM 
    									market_categs_trans 
    								WHERE 
    									categid={$categ[categid]}");
    		$categ_title = mysql_fetch_array( $result2 );
    		$str2 = "";
    		$temp2 = $categ[categid];
    		for ( $incr2 = 0; $incr2 < 100; $incr2++ ) {
    			$result3 = $dbs -> query("SELECT * FROM 
    										market_categs 
    									WHERE 
    										categid={$temp2} AND 
    										published = 1 AND 
    										status = 1");
    			if ( mysql_num_rows($result3) > 0 ) {
    				$categ2 = mysql_fetch_array($result3);
    				$str2 .= "/".$categ2[url];
    				$temp2 = $categ2[parent];
    			}
    		}
    		$str2 = substr($str2,1);
    		$nb2 = substr_count($str2,"/");
    		$temp_str2 = explode ("/",$str2);
    		$str2 = "";
    		$back = "";
    		for ($i2 = $nb2; $i2 >= 0; $i2--) {
    			$str2 .="/".$temp_str2[$nb2];
    			$nb2--;
    		}
    		$str .= " / <a href='/".substr($str2,1)."'>".$categ_title[title]."</a>";
    		$temp = $categ[parent];
    	}
    }

    Рекурсия... мать его

    cephuo, 12 Сентября 2011

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

    −85

    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
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    def captions_and_translations_to_srt(captions_and_translations):
        output = StringIO.StringIO()
        for i in range(len(captions_and_translations)):
            translation_to_srt(captions_and_translations[i][1],
                               captions_and_translations[i][0],
                               i, output)
        srt = output.getvalue()
        output.close()
        return srt
    
    def translation_to_srt(translation, video_caption, index, output):
        subtitle_to_srt_impl(video_caption.caption_text if translation is None \
                             else translation.translation_text, 
                             video_caption, index, output)
    
    def subtitle_to_srt_impl(text, video_caption, index, output):
        output.write(str(index + 1))
        output.write("\n")
        write_srt_time_line(video_caption, output)
        output.write(text)
        output.write("\n\n")
    
    def write_srt_time_line(video_caption, output):
        write_srt_time(video_caption.start_time, output)
        output.write(" --> ")
        write_srt_time(video_caption.end_time, output)
        output.write("\n")
    
    def write_srt_time(seconds, output):
        seconds_int = int(seconds)
        write_padded_num((seconds_int / 3600) % 60, 2, output)
        output.write(":")
        write_padded_num((seconds_int / 60) % 60, 2, output)
        output.write(":")
        write_padded_num(seconds_int % 60, 2, output)
        output.write(",")
        write_padded_num(int(seconds * 1000) % 1000, 3, output)
    
    def write_padded_num(num, numchars, output):
        strnum = str(num)
        numzeros = numchars - len(strnum)
        for i in range(numzeros):
            output.write("0")
        output.write(strnum)

    Генератор SRT субтитров.

    alerion, 08 Сентября 2011

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

    +167

    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
    // Проверка на спам
    $Spam = false;
    if ( substr_count( GetParam( 'info', true ), '[url' ) > 0 )
    {
    	$Spam = true;
    };
    if ( substr_count( GetParam( 'info', true ), 'viagra' ) > 0 )
    {
    	$Spam = true;
    };
    if ( substr_count( GetParam( 'info', true ), 'cialis' ) > 0 )
    {
    	$Spam = true;
    };
    if ( substr_count( GetParam( 'info', true ), 'casino' ) > 0 )
    {
    	$Spam = true;
    };
    if ( strlen( GetParam( 'info', true ) ) < 10 )
    {
    	$Spam = true;
    };
    
    if ( $Spam )
    {
    	$Message = "В тексте сообщения находятся спам-подобные слова.";
    }

    кусок кода одного скрипта, гордо именуемого CMS

    forkhammer, 07 Сентября 2011

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

    +170

    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
    <?php
    // $Id: post.php, v 1.12 2010/08/09 11:42:55 dries Exp $
    
    /**
     * Description of post
     *		Sending Email
     *
     * @author Unknown
     */
    class post {
    
    	public function send ( $email, $subject, $message, $addHeaders, $addParameters ) {
    
    		return mail($email, $subject, $message, $addHeaders, $addParameters);
    	}
    }
    ?>

    Цит: "Говорят, что сначала была нарисована какая-то картина, а потом Малевич закрасил ее в черный цвет".
    Ну мы ХОТЕЛИ нарисовать. Очень очень...

    istem, 05 Сентября 2011

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