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

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

    −103

    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
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    99. 99
    package _3d
    {
    
        public class Vector extends Object
        {
            private var xx:Number;
            public var z:Number;
            private var L:Number;
            private var zz:Number;
            private var yy:Number;
            private var c:Number;
            public var x:Number;
            public var y:Number;
            private var s:Number;
    
            public function Vector(param1:Number = 0, param2:Number = 0, param3:Number = 0)
            {
                x = param1;
                y = param2;
                z = param3;
                return;
            }// end function
    
            public function mul(param1:Number) : void
            {
                x = x * param1;
                y = y * param1;
                z = z * param1;
                return;
            }// end function
    
            public function normalize() : void
            {
                var _loc_1:* = length;
                L = length;
                if (_loc_1 > 0)
                {
                    x = x / L;
                    y = y / L;
                    z = z / L;
                }
                return;
            }// end function
    
            public function revolutiony(param1:Number) : void
            {
                c = Math.cos(param1);
                s = Math.sin(param1);
                zz = z;
                xx = x;
                z = zz * c - xx * s;
                x = zz * s + xx * c;
                return;
            }// end function
    
            public function revolutionz(param1:Number) : void
            {
                c = Math.cos(param1);
                s = Math.sin(param1);
                xx = x;
                yy = y;
                x = xx * c - yy * s;
                y = xx * s + yy * c;
                return;
            }// end function
    
            public function toString() : String
            {
                return "(" + x + "," + y + "," + z + ")";
            }// end function
    
            public function clone() : Vector
            {
                return new Vector(x, y, z);
            }// end function
    
            public function revolutionx(param1:Number) : void
            {
                c = Math.cos(param1);
                s = Math.sin(param1);
                yy = y;
                zz = z;
                y = yy * c - zz * s;
                z = yy * s + zz * c;
                return;
            }// end function
    
            public function add(param1:Vector) : void
            {
                x = x + param1.x;
                y = y + param1.y;
                z = z + param1.z;
                return;
            }// end function
    
            public function crossProduct(param1:Vector) : Vector
            {
                return new Vector(y * param1.z - z * param1.y, z * param1.x - x * param1.z, x * param1.y - y * param1.x);
            }// end function

    Lure Of Chaos, 21 Декабря 2010

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

    +153

    1. 1
    2. 2
    3. 3
    if (5 < strlen($method) && '_init' === substr($method, 0, 5)){
        $this->_classResources[strtolower(substr($method, 5))] = $method;
    }

    ZendFramework (c)

    Bydlo, 21 Декабря 2010

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

    +159

    1. 1
    2. 2
    3. 3
    function pop3_dele($connection,$message) {
        return(imap_delete($connection,$message));
    }

    Настоятельно рекомендуют не использовать wrapper'ы... М да... [http://www.php.net/manual/en/intro.imap.php]

    dwinner, 20 Декабря 2010

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

    +159

    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
    $one = $_POST["one"];
    $two = $_POST["two"];
    $three = $_POST["three"];
    $total = $_POST["total"];
    $total = $_POST["total1"];
     
     
    function Action($a, $b, $act)
    {
        switch($act)
        {
            case "add":
                return $a+$b;
            case "sub":
                return $a-$b;
            case "mult":
                return $a*$b;
            case "div":
                return $a/$b;
        }
    }
     
    /*Это проверка на то, какое действие выполняется первое
    total или total1(Если total равен умножению или делению то он и первый.
    А все остальное его не интересует)*/ 
    if ($total == "mult" || $total == "div")
    {
        $result = Action($one, $two, $total);
        $result = Action($result, $three, $total1);
    }
    else
    {
        $result = Action($two, $three, $total1);
        $result = Action($result, $one, $total);
    }
    echo $result;

    qbasic, 18 Декабря 2010

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

    +33

    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
    <!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" lang="en">
    
    <head>
    <meta http-equiv=Content-Type content="text/html; charset=windows-1251">
    <meta http-equiv="Pragma" content="no-cache">
    <link rel=File-List href="SL_php2weeks_box.files/filelist.xml">
    
    <title>PHP за 2 недели - курс обучения PHP от Школы Программирования</title>
    <style type="text/css">
    <!--
    .style1 {font-family: Georgia, "Times New Roman", Times, serif}
    .style5 {font-family: Georgia, "Times New Roman", Times, serif; font-style: italic; }
    .style6 {font-family: Georgia, "Times New Roman", Times, serif; font-weight: bold; }
    .style7 {font-family: Verdana, Arial, Helvetica, sans-serif}
    .style8 {
    	font-family: Verdana, Arial, Helvetica, sans-serif;
    	font-weight: bold;
    	font-style: italic;
    	color: #009000;
    }
    .style9 {
    	font-family: Georgia, "Times New Roman", Times, serif;
    	font-size: 18px;
    }
    .style10 {
    	font-family: "Courier New", Courier, monospace;
    	font-size: 12px;
    }
    .style11 {
    	font-size: 24px;
    	font-weight: bold;
    }
    .style12 {font-size: 24px; font-weight: bold; font-family: Georgia, "Times New Roman", Times, serif; }
    .style13 {font-size: 24px; font-weight: bold; font-family: Georgia, "Times New Roman", Times, serif; font-style: italic; }
    .style14 {font-family: Georgia, "Times New Roman", Times, serif; font-weight: bold; font-style: italic; }
    .style15 {
    	color: #0000FF;
    	font-family: Verdana, Arial, Helvetica, sans-serif;
    }
    .style17 {font-family: Georgia, "Times New Roman", Times, serif; font-style: italic; font-size: 16px; }
    .style18 {
    	font-size: 20px
    }
    -->
    </style>
    </head>
    
    
    
    <body lang=RU link=blue vlink=purple>
    
    <!-- SmartResponder.ru PopOver code (begin) -->
    <script language="javascript" type="text/javascript" src="popover.js"></script>
    <span style="margin: 0pt; padding: 0pt; width: 400px; height: 400px; position: absolute; left: 0pt; top: 0pt; right: 0pt; z-index: 1; display: none;" id="SR_PopOver">
    <table cellpadding="0" cellspacing="0" height="246" width="400">
    <tbody>
    <tr>
    <td style="border: 1px solid rgb(0, 0, 0);">
    <table bgcolor="#ffffff" cellpadding="3" cellspacing="0" height="100%" width="100%">
    <tbody>
    <tr bgcolor="#dddddd" valign="middle">
    <td onMouseDown="popover_drag_start(event, this, 'SR_PopOver')" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 255); font-weight: bold;" align="center" width="100%">
    <b>Подарок Вам - <font style="color:#009000;">Курс Web-Старт!</font><br /> 7 Бесплатных Видеоуроков По PHP!</b></td>
    <td align="right">
    <table cellspacing="0">
    <tbody>
    
    <tr>
    <td style="padding: 0pt 3px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; color: rgb(0, 0, 0); font-weight: bold;" onClick="popover_close(this, 'popover_start_to(\'SR_PopOver\', 21, 0, \'windowWidth\', parseInt(popover_obj.style.top) - popover_base_y)')" onMouseOver="this.style.cursor='pointer'" onMouseOut="this.style.cursor='default'">X</td>
    </tr>
    </tbody>
    </table>

    http://prog-school.ru/php2weeks/

    вот как бывает! исходник страницы смотрите сами :)

    brainstorm, 11 Декабря 2010

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

    +163

    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
    //
    				if (delay == 0)
    				{
    					Uint8 *keys = SDL_GetKeyState(NULL);
    					// Checking for letters
    					for (c = 97; c < 123; c++)
    						if (cpos < 9)
    							if (keys[c] && !delay)
    							{
    								mapname[cpos] = c;
    								mapname[++cpos] = '\0';
    								delay = 5;
    								
    								bg.show(400, 240, 0);
    								text.print(mapname, 200, 180);
    								render.backend();
    								
    								break;
    							}
    					// Checking for numbers
    					for (c = 48; c < 58; c++)
    						if (cpos < 9)
    							if (keys[c] && !delay)
    							{
    								mapname[cpos] = c;
    								mapname[++cpos] = '\0';
    								delay = 5;
    								
    								bg.show(400, 240, 0);
    								text.print(mapname, 200, 180);
    								render.backend();
    								
    								break;
    							}
    					// On pressing ENTER
    					if (keys[13] && !delay && strlen(mapname) > 2)
    						break;
    					// On pressing BACKSPACE
    					if (keys[SDLK_BACKSPACE] && cpos > 0 && !delay)
    					{
    						mapname[--cpos] = '\0';
    						delay = 5;
    						
    						bg.show(400, 240, 0);
    						if (cpos > 0) text.print(mapname, 200, 180);
    						render.backend();
    					}
    				}
    				
    				if (delay > 0)
    					delay--;

    Уверен, можно было сделать намного проще =)

    wh_, 10 Декабря 2010

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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    public static function encode($value, $cycleCheck = false, $options = array())
        {
            $encoder = new self(($cycleCheck) ? true : false, $options);
    
            return $encoder->_encodeValue($value);
        }

    Zend Framework, Zend_Json_Encoder

    dr_von_ozgg, 30 Ноября 2010

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

    +144

    1. 1
    2. 2
    3. 3
    4. 4
    while(sizeof($data)>sizeof($head)) {
    		$data[sizeof($data)-2].=$data[sizeof($data)-1];
    		unset($data[sizeof($data)-1]);
    	}

    кусочек моего скрипта разовой работы, накиданного на скорую руку(неудивительно, что он выполнялся 2 минуты).
    думаю, всем понятен смысл этого кусочка = )

    Lure Of Chaos, 27 Ноября 2010

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

    +156

    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
    index.php:
    <?php
    
    	define("TEMPLATE_FOLDER", "./templates/");
    
    	class Template
    	{
    		
    		public function view($template, $data)
    		{
    			foreach($data as $key => $variable)
    				$$key = $variable;
    			
    			require(TEMPLATE_FOLDER . $template . '.php');
    			
    			foreach($data as $key => $variable)
    				unset($$key);
    		}
    		
    	}
    	
    	$template = new Template();
    	
    	$data['test'] = array(1, 2, 3);
    	
    	$template->view('index', $data);
    	
    ?>
    
    templates/index.php:
    <html>
    	<body>
    		<?php foreach($test as $row): ?>
    			<?php echo $row ?><br/><br/>
    		<?php endforeach; ?>
    	</body>
    </html>

    Говно ли?

    TapTap, 12 Ноября 2010

    Комментарии (17)
  11. Perl / Говнокод #4592

    −122

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    sub generate_code {
    	my ($arrey_pos,$code);
    	my @arrey = ('a'..'q', 'C'..'O', '1'..'9', 'g'..'u', 'l'..'z', '9'..'1', 'H'..'W');
    
    	for (my $i = 0; $i < $_[0]; $i++) {
    		$arrey_pos = int(rand($#arrey));
    		$code .= $arrey[$arrey_pos];
    	}
    	$code;
    }

    Генерация кода.

    Arigato, 11 Ноября 2010

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