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

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

    +56

    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
    <html>
    <head>
    <style>
       body{
        background-color: #3366CC; /* Цвет фона веб-страницы */
       }
    </style>
    </head>
    <body>
    <?php
    	/*error_reporting(E_ALL);*/
    	class Mirror{
    		public $sizeX;
    		public $sizeY;
    		public $filenameI;
    		public $filenameO;
    		public $red;
    		public $green;
    		public $blue;
    		public $alpha;
    		function __construct($f){
    			$this->filenameI=$f.".png";
    			$this->filenameO=$f."2.png";
    			$size=getimagesize($this->filenameI);
    			$this->sizeX=$size[0];
    			$this->sizeY=$size[1];
    		}
    		function saveImg(){
    			if(!file_exists($this->filenameO)){
    				$xx=$this->sizeX;
    				$yy=($this->sizeY)*2;
    				$im = imagecreatetruecolor($xx, $yy);
    				imageAlphaBlending($im, false);
    				imageSaveAlpha($im, true);
    				for($x=0;$x<$xx;$x++){
    					for($y=0;$y<$yy;$y++){
    						$r=$this->red[$x][$y];
    						$g=$this->green[$x][$y];
    						$b=$this->blue[$x][$y];
    						$alph=$this->alpha[$x][$y];
    						$color=ImageColorAllocateAlpha($im, $r, $g, $b, $alph);
    						imagesetpixel($im, $x, $y, $color);
    					}
    				}
    				imagepng($im, $this->filenameO);
    				imagedestroy($im);
    			}
    			echo "<img src=\"".$this->filenameI."\" /><hr>\n";
    			echo "<img src=\"".$this->filenameO."\" /><br>\n";
    		}
    		function loadImg(){
    			$im = imagecreatefrompng($this->filenameI);
    			for($x=0;$x<$this->sizeX;$x++){
    				for($y=0;$y<$this->sizeY;$y++){
    					$rgb = imagecolorat($im, $x, $y);
    					$color=imagecolorsforindex($im, $rgb);
    					$this->red[$x][$y]=$color['red'];
    					$this->green[$x][$y]=$color['green'];
    					$this->blue[$x][$y]=$color['blue'];
    					$this->alpha[$x][$y]=$color['alpha'];
    				}
    			}
    			imagedestroy($im);
    		}
    		function createMirror(){
    			if(!file_exists($this->filenameO)){
    				$yy=($this->sizeY*2);
    				for($x=0;$x<$this->sizeX;$x++){
    					$alph=0;
    					for($y=$this->sizeY;$y<$yy;$y++){
    						if($alph<126){
    							$alph++;
    						}
    						$this->red[$x][$y]=$this->red[$x][$this->sizeY-($y-$this->sizeY)-1];
    						$this->green[$x][$y]=$this->green[$x][$this->sizeY-($y-$this->sizeY)-1];
    						$this->blue[$x][$y]=$this->blue[$x][$this->sizeY-($y-$this->sizeY)-1];
    						$this->alpha[$x][$y]=$alph+$this->alpha[$x][$this->sizeY-($y-$this->sizeY)-1];
    						if($this->alpha[$x][$y]>127) $this->alpha[$x][$y]=127;
    					}
    				}
    			}
    		}
    	}
    	$filename="alpha";
    	$mirror=new Mirror($filename);
    	$mirror->loadImg();
    	$mirror->createMirror();
    	$mirror->saveImg();
    ?>
    </body>
    </html>

    Делал для одного сайта зеркальное отражение картинки (photoshop использовать не умеем-с). Почему-то сервер часто падал.
    Как оно работает, можно посмотреть здесь http://xcont.com/perc/newperceptron/cell/mirror.php

    xcont, 11 Июля 2012

    Комментарии (9)
  3. SQL / Говнокод #11376

    −122

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    exec @res = dbo.p_bis_prepaid_diagnostic @tar_addr, @req_dubug_info output
      
    if (@res = 0)
      set @res = 1
    else
      set @res = 0

    aloha, 07 Июля 2012

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

    +142

    1. 1
    <a href="tariff.php">Расчет тарифа</a>

    dos_, 21 Июня 2012

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

    +132

    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
    <div style="text-align: left;">
      <span style="font-size: 30px;line-height:100%;font-family:Tahoma; ">
        <a style="color:#FFFFFF" href="/uslugi/skoraya-pomoshh">
          <span style="font-size: 24pt;">
            <strong>
              <span style="font-size: 18pt;">
                <span style="font-family: arial helvetica sans-serif;">Выезд врача</span>
              </span>
            </strong>
          </span>
          <strong>
            <span style="font-size: 18pt;">
              <span style="font-family:  arial  helvetica  sans-serif;">
                <br>
              </span>
            </span>
          </strong>
        </a>
      </span>
    </div>
    <div style="text-align: left;">
      <strong>
        <span style="font-size: 18pt;">
          <span style="font-family: arial helvetica  sans-serif;"></span>
        </span>
      </strong>
    </div>
    <div style="text-align: left;">
      <span style="font-size: 30px;line-height:100%;font-family:Tahoma; ">
        <a style="color:#FFFFFF" href="/uslugi/skoraya-pomoshh">
          <span style="font-size: 12pt;">
            <span style="font-size: 14pt;">
              <strong>
                <span style="font-size: 18pt;">
                  <span style="font-family:  arial  helvetica sans-serif;">на дом</span>
                </span>
              </strong>
            </span>
          </span>
        </a>
      </span>
    </div>

    Просто ссылка "Выезд врача на дом"

    aleksey_b, 15 Июня 2012

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

    +61

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if (empty($columns)) {
    	$columns = 'eleven';
    } else {
    	// Check the function for a returned variable
            // (от автора) КОГО КОГО МЫ ТАМ ЧЕКАЕМ??
    	$columns = $columns;
    }

    Найдено в достойном шаблоне Skeleton для WordPress
    /(. . )

    blessed, 13 Июня 2012

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

    +63

    1. 1
    2. 2
    $ToName = "$user_iname";
    $ToEmail = "$user_email";

    Кавычки-то зачем?

    domaster, 09 Июня 2012

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

    +54

    1. 1
    $todayweekday = date("w", mktime(0, 0, 0, date("m"), date("d"), date("Y")));

    апофеоз

    shmaltorhbooks, 05 Июня 2012

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

    −34

    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
    int ConditionsTuple(const bool Condition1, const bool Condition2)
    {
    	return (Condition1<<1) + Condition2;
    }
    
    template <bool Condition1, bool Condition2>
    struct TConditionsTuple
    {
    	enum {Result = (Condition1<<1) + Condition2};
    };
    
    float SignedIf(const bool Condition)
    {
    	return Condition ? -1 : 1;
    }
    
    switch (ConditionsTuple(
    					bExpr1,
    					bExpr2
    					))
    	{
    		case TConditionsTuple<1, 1>::Result:
    			return PArc(new TArc(
    							CouplePointAtPrimitive1,
    							CouplePointAtPrimitive2,
    							ArcCoupleCenter,
    							Abs(arcCoupleRadius)
    							));
    		case TConditionsTuple<0, 1>::Result:
    			throw TPrimitive1HalfLengthExpiredException();
    		case TConditionsTuple<1, 0>::Result:
    			throw TPrimitive2HalfLengthExpiredException();
    		case TConditionsTuple<0, 0>::Result:
    			throw TAllPrimitivesHalfLengthExpiredException();			
    	}

    Говногость, 04 Июня 2012

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

    +96

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    public bool IsStandart
    {
        get { return IsStandart; }
        set { IsStandart = value; }
    }

    Maps, 31 Мая 2012

    Комментарии (9)
  11. JavaScript / Говнокод #10437

    +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
    var nav = document.getElementById('navigation');
    
    var properties = {
    	'display' : 'block',
    	'position' : 'fixed',
    	'top' : '5px',
    	'backgroundColor' : '#F2F0E3',
    	'opacity' : '.6',
            ........
            //Много всяких свойств
            ........
    	'border' : '2px solid #DDDDDD',
    	'borderRadius' : '1em',
    	'padding' : '5px',
    	'zIndex' : '1'
    }
    
    for (var i in properties) {
    	nav.style[i] = properties[i];
    }

    Послать бы автора на три буквы: CSS

    vistefan, 30 Мая 2012

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