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

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

    +86

    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
    private static void slowDownABit() {
            for (int i = 0; i < 100; i++) {
                new Thread() {
    
                    @Override
                    public void run() {
                        for (int i = 0; i < 10000000; i++) {
                            double d1 = Math.random() + 1;
                            double d2 = Math.random() + 1;
                            double d3 = Math.random() + 1;
                            double d4 = Math.random() + 1;
                            double d = d1 * d2 / d3 / d4 * Math.sin(Math.random());
                        }
                    }
                }.start();
            }
        }

    akkuch, 06 Сентября 2011

    Комментарии (13)
  3. JavaScript / Говнокод #7762

    +167

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    function loadvalue()
    {
    	var link="connect3.html";
    	if(link != "connect3.html")
    	   location.href=link;
    }

    Wi-Fi роутер от Дом.ру (Netgear (модель не известна)).
    Код из его "веб панельки".

    stasyan, 04 Сентября 2011

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

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    <?php
    /*.......*/
    
    $x =& J_USER;
    
    /*.......*/
    ?>

    Ошибка порадовала.

    "Parse error: syntax error, unexpected ';', expecting T_PAAMAYIM_NEKUDOTAYIM"

    "а, да ебать, говно вопрос.

    jokz, 03 Сентября 2011

    Комментарии (13)
  5. Pascal / Говнокод #7698

    +105

    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
    procedure TForm2.FormCreate(Sender: TObject);
    begin
      SpeedButton1.Left := Form2.ClientWidth div 2 - SpeedButton1.Width;
      SpeedButton1.Top := Form2.ClientHeight div 2 - SpeedButton1.Height;
     
      SpeedButton2.Left := Form2.ClientWidth div 2;
      SpeedButton2.Top := Form2.ClientHeight div 2 - SpeedButton2.Height;
     
      SpeedButton3.Left := Form2.ClientWidth div 2 - SpeedButton3.Width;
      SpeedButton3.Top := Form2.ClientHeight div 2;
     
      SpeedButton4.Left := Form2.ClientWidth div 2;
      SpeedButton4.Top := Form2.ClientHeight div 2;
    end;

    Fai, 30 Августа 2011

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

    +175

    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
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    function get_user_name($id) {
    		$query = "
    			SELECT name
    			FROM users 
    			WHERE id = '".$id."'
    		";
    		$this->registry['sql']->query($query);
    		if ($this->registry['sql']->getNumberRows()>0) {
    			$result = $this->registry['sql']->getFetchObject();
    			return $result[0]->name;
    		}
    	}
    	
    	function get_user_login($id) {
    		$query = "
    			SELECT login
    			FROM users 
    			WHERE id = '".$id."'
    		";
    		$this->registry['sql']->query($query);
    		if ($this->registry['sql']->getNumberRows()>0) {
    			$result = $this->registry['sql']->getFetchObject();
    			return $result[0]->login;
    		}
    	}
    	
    	function get_user_password($id) {
    		$query = "
    			SELECT password
    			FROM users 
    			WHERE id = '".$id."'
    		";
    		$this->registry['sql']->query($query);
    		if ($this->registry['sql']->getNumberRows()>0) {
    			$result = $this->registry['sql']->getFetchObject();
    			return $result[0]->password;
    		}
    	}
    	
    	function get_user_role($id) {
    		$query = "
    			SELECT role
    			FROM users 
    			WHERE id = '".$id."'
    		";
    		$this->registry['sql']->query($query);
    		if ($this->registry['sql']->getNumberRows()>0) {
    			$result = $this->registry['sql']->getFetchObject();
    			return $result[0]->role;
    		}
    	}
    	
    	function get_user_adress($id) {
    		$query = "
    			SELECT adress
    			FROM users 
    			WHERE id = '".$id."'
    		";
    		$this->registry['sql']->query($query);
    		if ($this->registry['sql']->getNumberRows()>0) {
    			$result = $this->registry['sql']->getFetchObject();
    			return $result[0]->adress;
    		}
    	}
    	
    	function get_user_valuta($id) {
    		$query = "
    			SELECT valuta
    			FROM users 
    			WHERE id = '".$id."'
    		";
    		$this->registry['sql']->query($query);
    		if ($this->registry['sql']->getNumberRows()>0) {
    			$result = $this->registry['sql']->getFetchObject();
    			return $result[0]->valuta;
    		}
    	}
    	
    	function get_room_type($id){
    		$query = "
    			SELECT type
    			FROM rooms 
    			WHERE id = '".$id."'
    		";
    		$this->registry['sql']->query($query);
    		if ($this->registry['sql']->getNumberRows()>0) {
    			$result = $this->registry['sql']->getFetchObject();
    			return $result[0]->type;
    		}	
    	}

    в догонку к Говнокод #7684

    vkontakte, 29 Августа 2011

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

    +167

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    char *sLoop = new char[4];
    _itoa(i, sLoop, 10);
    string strField = fp1 + sLoop + fp2;
    char *str = new char[255];
    for (int i=0; i<=sizeof(strField); i++)
        str[i] = strField[i];
    _bstr_t impFieldName(str);
    // думаю, очевдно, что delete нигде не было. ;)

    Говногость, 25 Августа 2011

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

    +73

    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
    if(block == Block.blockDiamond || block == Block.oreDiamond)
            {
                return toolMaterial.getHarvestLevel() >= 2;
            }
            if(block == Block.blockGold || block == Block.oreGold)
            {
                return toolMaterial.getHarvestLevel() >= 2;
            }
            if(block == Block.blockSteel || block == Block.oreIron)
            {
                return toolMaterial.getHarvestLevel() >= 1;
            }
            if(block == Block.blockLapis || block == Block.oreLapis)
            {
                return toolMaterial.getHarvestLevel() >= 1;
            }
            if(block == Block.oreRedstone || block == Block.oreRedstoneGlowing)
            {
                return toolMaterial.getHarvestLevel() >= 2;
            }

    Из сорцов майнсрафта.
    Нахрена делать из двух ifов пять?!

    RaZeR, 19 Августа 2011

    Комментарии (13)
  9. ActionScript / Говнокод #7552

    −117

    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
    // Здесь примерно еще примерно 50 условий
    
    if (event.keyCode == 188)
     	{
       my_answer[pos_text] = "Б";
       pos_text = pos_text + 1;
    
     	}
    
     	if (event.keyCode == 190)
     	{
       my_answer[pos_text] = "Ю";
       pos_text = pos_text + 1;
    
     	}

    Маленький кусочек говнокода..

    KirAmp, 16 Августа 2011

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

    +159

    1. 1
    Наконец-то http://goo.gl/SjgUj

    absolut, 13 Августа 2011

    Комментарии (13)
  11. Java / Говнокод #7537

    +147

    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
    <script type="text/javascript" >
        var str = window.location + "";
        var t = str.substr(7, 2);
        if (t=="40") {document.write("(4842)<span style=\"font-size:30px;font-weight:bold;color:white;\">562–003</span>");}
        if (t=="36") {document.write("(473)<span style=\"font-size:30px;font-weight:bold;color:white;\">233-03-20</span>");}
        if (t=="62") {document.write("(4912)<span style=\"font-size:30px;font-weight:bold;color:white;\">300-305</span>");}
        if (t=="ww") {document.write("(4872)<span style=\"font-size:30px;font-weight:bold;color:white;\">39-03-06</span>");}
        if (t=="po") {document.write("(4872)<span style=\"font-size:30px;font-weight:bold;color:white;\">39-03-06</span>");}
    </script>
    <script type="text/javascript" >
       var str = window.location + "";
       var t = str.substr(7, 2);
       if (t=="40") {document.write("Калуга");}
       if (t=="36") {document.write("Воронеж");}
       if (t=="62") {document.write("Рязань");}
       if (t=="ww") {document.write("Тула");}
       if (t=="po") {document.write("Тула");}
    </script>

    Вот так упыри меняют телефоны на сайте в зависимости от региона, при том, что сайт использует PHP на сервере.

    demitriy_, 12 Августа 2011

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