1. Pascal / Говнокод #8718

    +112

    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
    {...}
    type
    a=(
    january,
    february,
    march,
    {--------------}
    april,
    may,
    june,
    {--------------}
    jule,
    august,
    september,
    {--------------}
    october,
    november,
    december
                 );
    b=(
    seаson1,
    seаson2,
    seаson3,
    seаson4
               );
    c=(
    winter,
    spring,
    summer,
    autumn
              );
    {...}
    function d(e:a):b;
             begin
                  case e of
                           january,
                           february,
                           march
                                     :d:=seаson1;
                           april,
                           may,
                           june
                                     :d:=seаson2;
                           jule,
                           august,
                           september
                                     :d:=seаson3;
                           october,
                           november,
                           december
                                     :d:=seаson4
                  end
             end;
    function f(g:a):c;
             begin
                  case g of
                           december,
                           january,
                           february
                                      :f:=winter;
                           march,
                           may,
                           april
                                      :f:=spring;
                           june,
                           jule,
                           august
                                      :f:=summer;
                           september,
                           october,
                           november
                                      :f:=autumn
                  end
             end;
    begin
    {...}
    end.

    Сделал на этой неделе в первом часу ночи.

    dos_, 04 Декабря 2011

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

    +1000

    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
    bool __fastcall TItsString::operator == (const char* sVal) const
    {
      bool Empty1 = ((FStringValue == NULL) || (FStringValue[0] == 0));
      bool Empty2 = ((sVal == NULL) || (sVal[0] == 0));
      if (Empty1 && Empty2) return true;
      if (Empty1 || Empty2) return false;
      int i,j,k;
      for(i=0; FStringValue[i] && (GET_LOWER_CHAR(FStringValue[i]) == GET_LOWER_CHAR(sVal[i])); i++);
      if ((FStringValue[i] == 0) && (sVal[i] == 0)) return true;
      j=i; k=i;
      if (sVal[k] == 0)  for(; FStringValue[i] == 0x20; i++);
      if (FStringValue[k] == 0) for(; sVal[j] == 0x20; j++);
      if ((FStringValue[i] == 0) && (sVal[j] == 0)) return true;
      return false;
    }

    Try, 03 Декабря 2011

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

    +160

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    const ORDER_FUNC_ARGS   = '$a, $b';
    	const ORDER_FUNC_LOGIC  = '$a=strlen($a);$b=strlen($b);return$a==$b?0:($a<$b?1:-1);';
    // а дальше в одном из методов
    		$this->_userAgents 	= array_keys($browsers);
    		usort(
    			$this->_userAgents,
    			create_function(self::ORDER_FUNC_ARGS, self::ORDER_FUNC_LOGIC)
    		);

    Для меня это странно выглядит

    LiteError, 03 Декабря 2011

    Комментарии (0)
  4. ActionScript / Говнокод #8714

    −111

    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
    public class MonstrGrafic extends ModulINT {
    		var data:XML;
    		var colors:Array = new Array(
    			'0x008080',
    			'0x800080',
    			'0xccffcc',
    			'0x00ffff',
    			'0x800000',
    			'0x0000ff',
    			'0x00ccff',
    			'0xccffff',
    			'0xffff00',
    			'0xffff99',
    			'0x000080',
    			'0xff00ff'
    		);
    		var ListTime:Array = new Array(
    			"08:00:00 - 08:15:00",
    			"08:15:00 - 08:30:00",
    			"08:30:00 - 08:45:00",
    			"08:45:00 - 09:00:00",
    			"09:00:00 - 09:15:00",
    			"09:15:00 - 09:30:00",
    			"09:30:00 - 09:45:00",
    			"09:45:00 - 10:00:00",
    			"10:00:00 - 10:15:00",
    			"10:15:00 - 10:30:00",
    			"10:30:00 - 10:45:00",
    			"10:45:00 - 11:00:00",
    			"11:00:00 - 11:15:00",
    			"11:15:00 - 11:30:00",
    			"11:30:00 - 11:45:00",
    			"11:45:00 - 12:00:00",
    			"12:00:00 - 12:15:00",
    			"12:15:00 - 12:30:00",
    			"12:30:00 - 12:45:00",
    			"12:45:00 - 13:00:00",
    			"13:00:00 - 13:15:00",
    			"13:15:00 - 13:30:00",
    			"13:30:00 - 13:45:00",
    			"13:45:00 - 14:00:00",
    			"14:00:00 - 14:15:00",
    			"14:15:00 - 14:30:00",
    			"14:30:00 - 14:45:00",
    			"14:45:00 - 15:00:00",
    			"15:00:00 - 15:15:00",
    			"15:15:00 - 15:30:00",
    			"15:30:00 - 15:45:00",
    			"15:45:00 - 16:00:00",
    			"16:00:00 - 16:15:00",
    			"16:15:00 - 16:30:00",
    			"16:30:00 - 16:45:00",
    			"16:45:00 - 17:00:00",
    			"17:00:00 - 17:15:00",
    			"17:15:00 - 17:30:00",
    			"17:30:00 - 17:45:00",
    			"17:45:00 - 18:00:00",
    			"18:00:00 - 18:15:00",
    			"18:15:00 - 18:30:00",
    			"18:30:00 - 18:45:00",
    			"18:45:00 - 19:00:00",
    			"19:00:00 - 19:15:00",
    			"19:15:00 - 19:30:00",
    			"19:30:00 - 19:45:00",
    			"19:45:00 - 20:00:00",
    			"20:00:00 - 20:15:00",
    			"20:15:00 - 20:30:00",
    			"20:30:00 - 20:45:00",
    			"20:45:00 - 21:00:00",
    			"21:00:00 - 21:15:00",
    			"21:15:00 - 21:30:00",
    			"21:30:00 - 21:45:00",
    			"21:45:00 - 22:00:00",
    			"22:00:00 - 22:15:00",
    			"22:15:00 - 22:30:00",
    			"22:30:00 - 22:45:00",
    			"22:45:00 - 23:00:00",
    			"23:00:00 - 23:15:00",
    			"23:15:00 - 23:30:00",
    			"23:30:00 - 23:45:00",
    			"23:45:00 - 24:00:00"
    		);

    kyzi007, 03 Декабря 2011

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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    protected $_never_allowed_regex = array(
    					"javascript\s*:"			=> '[removed]',
    					"expression\s*(\(|&\#40;)"	=> '[removed]', // CSS and IE
    					"vbscript\s*:"				=> '[removed]', // IE, surprise!
    					"Redirect\s+302"			=> '[removed]'
    	);

    Это не разу не ковнокод, но строкой с // IE, surprise! не поделится, не смог)

    ЗЫ. это CodeIgniter 2.0.3 класс Security, строка 52

    Zerstoren, 02 Декабря 2011

    Комментарии (1)
  6. ActionScript / Говнокод #8712

    −111

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    try{
    	characterParser.parse(_daeXML);
    }catch(e:ScriptTimeoutError){
    	characterParser.parse(_daeXML);
    }

    чувак решил проблему пятнадцати секунд

    makc3d, 02 Декабря 2011

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

    +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
    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
    private function isBonusAddOK($code,$ffStr)
    	{
    		switch($code)
    		{
    			case 1:if(
    						($this->isBFFOK($ffStr,40) || $this->isBFFOK($ffStr,38) || $this->isBFFOK($ffStr,37)) && 
    						$this->isBFFOK($ffStr,24) && $this->isBFFOK($ffStr,19) &&
    						($this->isBFFOK($ffStr,42) || $this->isBFFOK($ffStr,43) || $this->isBFFOK($ffStr,44))
    						)return true;return false;
    						
    			case 6:if(
    						($this->isBFFOK($ffStr,40) || $this->isBFFOK($ffStr,38) || $this->isBFFOK($ffStr,37)) && 
    						$this->isBFFOK($ffStr,24) && $this->isBFFOK($ffStr,20) &&
    						($this->isBFFOK($ffStr,42) || $this->isBFFOK($ffStr,43) || $this->isBFFOK($ffStr,44))
    						)return true;return false;
    						
    			case 11:if(
    						$this->isBFFOK($ffStr,24) &&
    						($this->isBFFOK($ffStr,16) || $this->isBFFOK($ffStr,358) || $this->isBFFOK($ffStr,360) || $this->isBFFOK($ffStr,361)) && 
    						$this->isBFFOK($ffStr,62) &&
    						($this->isBFFOK($ffStr,64) || $this->isBFFOK($ffStr,352) || $this->isBFFOK($ffStr,356) || $this->isBFFOK($ffStr,363)) &&
    						($this->isBFFOK($ffStr,3) || $this->isBFFOK($ffStr,4) || $this->isBFFOK($ffStr,5))
    						)return true;return false;
    						
    			case 14:if(
    						$this->isBFFOK($ffStr,24) &&
    						($this->isBFFOK($ffStr,16) || $this->isBFFOK($ffStr,358) || $this->isBFFOK($ffStr,360) || $this->isBFFOK($ffStr,361)) && 
    						$this->isBFFOK($ffStr,61) &&
    						($this->isBFFOK($ffStr,64) || $this->isBFFOK($ffStr,352) || $this->isBFFOK($ffStr,356) || $this->isBFFOK($ffStr,363)) &&
    						($this->isBFFOK($ffStr,3) || $this->isBFFOK($ffStr,4) || $this->isBFFOK($ffStr,5))
    						)return true;return false;
    			
    			case 17:if(
    						($this->isBFFOK($ffStr,16) || $this->isBFFOK($ffStr,358) || $this->isBFFOK($ffStr,360) || $this->isBFFOK($ffStr,361)) && 
    						($this->isBFFOK($ffStr,64) || $this->isBFFOK($ffStr,352) || $this->isBFFOK($ffStr,356) || $this->isBFFOK($ffStr,363)) &&
    						($this->isBFFOK($ffStr,3) || $this->isBFFOK($ffStr,4) || $this->isBFFOK($ffStr,5)) &&
    						$this->isBFFOK($ffStr,17)
    						)return true;return false;
    			
    			case 20:if(
    						($this->isBFFOK($ffStr,16) || $this->isBFFOK($ffStr,358) || $this->isBFFOK($ffStr,360) || $this->isBFFOK($ffStr,361)) && 
    						($this->isBFFOK($ffStr,64) || $this->isBFFOK($ffStr,352) || $this->isBFFOK($ffStr,356) || $this->isBFFOK($ffStr,363)) &&
    						($this->isBFFOK($ffStr,3) || $this->isBFFOK($ffStr,4) || $this->isBFFOK($ffStr,5)) &&
    						$this->isBFFOK($ffStr,25) && $this->isBFFOK($ffStr,21)
    						)return true;return false;
    						
    			case 23:if(
    						($this->isBFFOK($ffStr,16) || $this->isBFFOK($ffStr,358) || $this->isBFFOK($ffStr,360) || $this->isBFFOK($ffStr,361)) && 
    						($this->isBFFOK($ffStr,64) || $this->isBFFOK($ffStr,352) || $this->isBFFOK($ffStr,356) || $this->isBFFOK($ffStr,363)) &&
    						($this->isBFFOK($ffStr,3) || $this->isBFFOK($ffStr,4) || $this->isBFFOK($ffStr,5)) &&
    						$this->isBFFOK($ffStr,21)
    						)return true;return false;
    						
    						
    		.... еще куча строк до значения 88
    			
    			default: return true;
    		}
    	}
    	
    	private function isBFFOK($ffStr,$pos)
    	{
    		$val = substr($ffStr,$pos,1);//echo $pos.':'.$val;var_dump(($val != '0'));echo ' ';
    		return ($val != '0');
    		/*if($val == 0)return false;

    ИфЗебок

    kyzi007, 02 Декабря 2011

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

    +75

    1. 1
    2. 2
    3. 3
    if(getFillColor().length() > 0){
    		/***/
    	}

    проверка на инициализацию переменной

    JJunior, 02 Декабря 2011

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

    +167

    1. 1
    ( $resultat == 1 AND $resultat != '' AND $resultat != 0 ) ? true : false;

    Что-бы наверняка.

    nethak, 02 Декабря 2011

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

    +164

    1. 1
    2. 2
    3. 3
    4. 4
    $sql = "SELECT (max(nid) + 1) FROM cms_news";
    $MySQL_baza->ExecQuery($sql);
    $myrow=$MySQL_baza->FetchArray();
    $max=$myrow[0];

    Копался в одном старом проекте, не сразу понял зачем нужен следующий код.
    Автоинкримент %)

    MAXHO, 02 Декабря 2011

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