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

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

    +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
    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
    ISQ.Data.checkString=function(e,f){
        var d=true;
        switch(f){
        case"email":
    	var a=/^[\w-_\&.]+\@([\w-_]+\.[\w-_]+){1,3}$/;
    	var g=new RegExp("[~!#$%^&*()=''\"\\/><?[]{}|]","g");
    	return(e.search(g)===-1)&&(e.match(a))&&(e!=="");
    	break;
        case"number":
    	var b=/^[-]?[0-9]+\.?[0-9]?$/;
    	return b.test(e);
    	break;
        case"username":
    	var c=new RegExp(".+@.+");
    	return(c.test(e));
    	break;
        case"url":
    	var c=new RegExp("^https?://([a-zA-Z0-9]+.){1,}[a-zA-Z0-9]+");
    	return(c.test(e));
    	break
        }
        return d
    }
    
    // Функция универсальной валидации.
    // (Но незадолго до того было еще и)
    
    ISQ.Data.getEmailAddress=function(e){
        var a=/[\w-_\&.]+\@[\w-_]+\.+[\w-_.]+/g;
        var d=e.match(a);
        if(d===null||d.length===0){
    	return null
        }
        var f=new RegExp();
        f.compile("[~!#$%^&*()=`'\"\\/><?[]{}|]","g");
        var b=new Array();
        for(var c=0;c<d.length;++c){
    	if(d[c].search(f)===-1){
    	    b.push(d[c])
    	}
        }
        return b
    }

    Еще одна творческая работа.

    wvxvw, 03 Июня 2012

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

    +141

    1. 1
    foreach ($collector as $valuev)  {

    Очепятка.

    T_ENGINE, 02 Июня 2012

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

    +101

    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
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    private void FillLocalService(int SelectedPageIndex)
            {
                //Set category by search
                string search = inputSearch.Value == inputSearchValue ? string.Empty : inputSearch.Value;
                if (inputSearch.Value != inputSearchValue && !string.IsNullOrWhiteSpace(inputSearch.Value))
                {
                    if (inputSearch.Value.StartsWith("landscap", StringComparison.InvariantCultureIgnoreCase))
                    {
                        SelectedCategory = "Landscapers";
                        search = string.Empty;
                    }
                    else if (inputSearch.Value.StartsWith("baby sitter", StringComparison.InvariantCultureIgnoreCase))
                    {
                        SelectedCategory = "Baby sitters";
                        search = string.Empty;
                    }
                    else if (inputSearch.Value.StartsWith("doctor", StringComparison.InvariantCultureIgnoreCase))
                    {
                        SelectedCategory = "Doctor";
                        search = string.Empty;
                    }
                    else if (inputSearch.Value.StartsWith("cleaning service", StringComparison.InvariantCultureIgnoreCase))
                    {
                        SelectedCategory = "Cleaning services";
                        search = string.Empty;
                    }
                    else if (inputSearch.Value.StartsWith("pet sitter", StringComparison.InvariantCultureIgnoreCase))
                    {
                        SelectedCategory = "Pet sitters";
                        search = string.Empty;
                    }
                    else if (inputSearch.Value.StartsWith("handyman", StringComparison.InvariantCultureIgnoreCase))
                    {
                        SelectedCategory = "Handyman";
                        search = string.Empty;
                    }
                    else if (inputSearch.Value.StartsWith("electrical service", StringComparison.InvariantCultureIgnoreCase))
                    {
                        SelectedCategory = "Electrical services";
                        search = string.Empty;
                    }
                    else if (inputSearch.Value.StartsWith("tutor", StringComparison.InvariantCultureIgnoreCase))
                    {
                        SelectedCategory = "Tutor";
                        search = string.Empty;
                    }
                    else if (inputSearch.Value.StartsWith("dog walker", StringComparison.InvariantCultureIgnoreCase))
                    {
                        SelectedCategory = "Dog walker";
                        search = string.Empty;
                    }
                    else if (inputSearch.Value.StartsWith("plumb", StringComparison.InvariantCultureIgnoreCase))
                    {
                        SelectedCategory = "Plumbing";
                        search = string.Empty;
                    }
                    else if (inputSearch.Value.StartsWith("Caterer", StringComparison.InvariantCultureIgnoreCase))
                    {
                        SelectedCategory = "Caterers";
                        search = string.Empty;
                    }
                    else if (inputSearch.Value.Equals("misc", StringComparison.InvariantCultureIgnoreCase))
                    {
                        SelectedCategory = "Misc";
                        search = string.Empty;
                    }
                }
    
    200+ строк кода
    }

    тот же девелопер, та же .aspx страница)))))

    mangyst, 30 Мая 2012

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

    +62

    1. 1
    2. 2
    <<<<<<<<<<<<<<<<<===============================>>>>>>>>>>>>>>>>>
                                                      АДМИН - ПИДОР!!!

    uiopqwertyasd, 29 Мая 2012

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

    +122

    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
    <table border='0' cellspacing='1' cellspacing='1' width=707>
      <thead>
        <a>
          <th width=44 align='center'>
            <IMG name='Image300' SRC='images/check.gif' height='22' width='44'>
          </th>
        </a>
        <a href=javascript:SortForm('Agent_Name');>
          <th  class='header'>Name</th>
        </a>
        <a href=javascript:SortForm('Description');>
          <th class='header'>Description</th>
        </a>
      </thead>

    Сортировка таблицы по полю при нажатии на заголовок. Код отформатирован для читабельности.

    roman-kashitsyn, 28 Мая 2012

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

    +66

    1. 1
    2. 2
    3. 3
    4. 4
    function EchoForum( $var ){
    	return true;
    	echo $var.'<BR>';
    }

    Из модуля форума...

    Мартин, 27 Мая 2012

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

    +147

    1. 1
    2. 2
    3. 3
    function trim(str) {   //Маленький трёхколёсный велосипед
        return str.replace(/^\s+|\s+$/g, '');
    }

    Комментарий оригинала...

    vistefan, 25 Мая 2012

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

    +72

    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
    //1. файл
    ...
    else if ($elem->tagName == "Error") {
    		$errorCode = trim($elem->getElementsByTagName("Code")->item(0)->textContent);
    		$errorText = trim($elem->getElementsByTagName("Text")->item(0)->textContent);
    
    		var_dump('Fuck!!! Some Error:',$errorCode,$errorText);						
    }
    ...
    
    //2. файл, после получения результатов
    ...
    if(empty($result)){	
    	var_dump($sql);
    	die('Page fucking dead!!!!!');
    }
    ...
    
    //2. файл, 
    ...
    if(!file_exists($filePath)){	
    	var_dump('No file found???!!! Where if fucking CLASS file???!!!', $filePath);
    	return false;
    }
    ...
    
    //3. файл, 
    ...
    if (empty($fields['id'])){
    	var_dump('AAAAAAAAA. No ID again!!!', $fields, $sql);
    	return false;
    }
    ...
    
    //4. файл, 
    ...
    if (!$error){
    	if($this->debug)var_dump('Yeeeees!!! Work fine ^_^');
    	return true;
    }
    ...

    Наткнулся на один проектик. Не совсем говнокод, но программер был видать оочень емоциональный :)

    Edd, 25 Мая 2012

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

    +80

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    // Для очень важных целей извлекаем текущую дату на MSSQL сервере
    $d=mssql_query("SELECT getdate()");
    $dattime=mssql_fetch_array($d);
    
    // А теперь внимание. Вставляем полученную в предыдущем запросе дату в новую запись
    $result="INSERT INTO lgotrivia_gotrivia_game (dateTime, dateTimeIphone, gamemode, playerid, scores, phoneid, app_id)
                                                                 VALUES ('".$dattime[0]."','".$datetime_iphone."', '".$gamemode."', '".$playerid."', '".$scores."', '".$phoneid."', '".$appid."')";
    
    $res=mssql_query($result);

    По каким-то причинам стало не модно в INSERT запросах использовать вызов GETDATE() или CURRENT_TIMESTAMP. Через PHP прослойку ведь куда круче. Видимо таким ребятам тоже платят за строчки кода.

    SunnyMagadan, 23 Мая 2012

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

    +96

    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
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    private void textBox10_TextChanged(object sender, EventArgs e)
            {
            }
            private void button3_Click(object sender, EventArgs e)
            {
                textfactorname1.Text = "";
                textfactorname2.Text = "";
                textfactorname3.Text = "";
                textfactorname4.Text = "";
                textfactorname5.Text = "";
                textfactorname6.Text = "";
                textfactorname7.Text = "";
                textfactorname8.Text = "";
                textfactorname9.Text = "";
                ...
               
                checkBox9.Checked = false;
                checkBox10.Checked = false;
            }
            private void button2_Click_1(object sender, EventArgs e)
            {
                int n;
                try
                {
                    n = Convert.ToInt32(textItera.Text);
                }
                catch
                {
                    n = 1;
                }
                string results;
                double[] NPVarray = new double[n];
                double[] NPVsquares = new double[n];
                double NPVmax,NPVmin,NPVmid,disp,standdev,CV,zeropoint,pxy,xxx,yyy;
                int lessthanzero, morethanxxx, lessthanyyy;
                try
                {
                    for (int i = 0; i < n; i++)
                    {
                        string factorname1;
                       ...
                        string factorname10;
                        double fixedvalue1;
                       ...
                        double fixedvalue10;
                        double midvalue1;
                        ...
                        double midvalue10;
                        double minvalue1;
                        ...
                        double minvalue10;
                        double maxvalue1;
                        ...
                        double maxvalue10;
                        string varname1;
                       ...
                        string varname10;
                        if (textfactorname1.Text == "")
                        {
                            factorname1 = "What a fuck?";
                        }
                        else
                        {
                            factorname1 = textfactorname1.Text;
                        }
                        if (textfactorname2.Text == "")
                        {
                            factorname2 = "What a fuck?";
                        }

    Вот так вот. Лимит в 100 строк не позаоляет показать все прелести.

    tarabo, 20 Мая 2012

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