1. 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)
  2. 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)
  3. Java / Говнокод #8710

    +75

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

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

    JJunior, 02 Декабря 2011

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

    +167

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

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

    nethak, 02 Декабря 2011

    Комментарии (3)
  5. 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)
  6. Pascal / Говнокод #8707

    +87

    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
    function det5(var a:atab):double;
    {FUNKCIYA VYCHISLYAET OPREDELITEL MATRITSY 5-go PORYADKA a}
    begin
    det5:=
    +a[1,1]*a[2,2]*a[3,3]*a[4,4]*a[5,5]-a[1,2]*a[2,1]*a[3,3]*a[4,4]*a[5,5]
    +a[1,3]*a[2,1]*a[3,2]*a[4,4]*a[5,5]-a[1,1]*a[2,3]*a[3,2]*a[4,4]*a[5,5]
    -a[1,3]*a[2,2]*a[3,1]*a[4,4]*a[5,5]+a[1,2]*a[2,3]*a[3,1]*a[4,4]*a[5,5]
    -a[1,4]*a[2,1]*a[3,2]*a[4,3]*a[5,5]+a[1,1]*a[2,4]*a[3,2]*a[4,3]*a[5,5]
    -a[1,1]*a[2,2]*a[3,4]*a[4,3]*a[5,5]+a[1,4]*a[2,2]*a[3,1]*a[4,3]*a[5,5]
    -a[1,2]*a[2,4]*a[3,1]*a[4,3]*a[5,5]+a[1,2]*a[2,1]*a[3,4]*a[4,3]*a[5,5]
    -a[1,4]*a[2,3]*a[3,1]*a[4,2]*a[5,5]+a[1,3]*a[2,4]*a[3,1]*a[4,2]*a[5,5]
    -a[1,3]*a[2,1]*a[3,4]*a[4,2]*a[5,5]+a[1,4]*a[2,1]*a[3,3]*a[4,2]*a[5,5]
    -a[1,1]*a[2,4]*a[3,3]*a[4,2]*a[5,5]+a[1,1]*a[2,3]*a[3,4]*a[4,2]*a[5,5]
    +a[1,4]*a[2,3]*a[3,2]*a[4,1]*a[5,5]-a[1,3]*a[2,4]*a[3,2]*a[4,1]*a[5,5]
    +a[1,3]*a[2,2]*a[3,4]*a[4,1]*a[5,5]-a[1,4]*a[2,2]*a[3,3]*a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]-a[1,3]*a[2,2]*a[3,4]*a[4,5]....

    Жалко, что вся функця не поместилась.
    Найдено здесь. http://bbi-math.narod.ru/rosenbrock/rosenbrock.html
    Там автор показывает мастерство владения циклами и рекурсиями. А так же демонстрирует каменную выдержку и самообладание, при наборе такого кода.

    antoha_by, 02 Декабря 2011

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

    +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
    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
    public void type(char character) {
        	switch (character) {
        	case 'a': doType(VK_A); break;
        	case 'b': doType(VK_B); break;
        	case 'c': doType(VK_C); break;
        	case 'd': doType(VK_D); break;
        	case 'e': doType(VK_E); break;
        	case 'f': doType(VK_F); break;
        	case 'g': doType(VK_G); break;
        	case 'h': doType(VK_H); break;
        	case 'i': doType(VK_I); break;
        	case 'j': doType(VK_J); break;
        	case 'k': doType(VK_K); break;
        	case 'l': doType(VK_L); break;
        	case 'm': doType(VK_M); break;
        	case 'n': doType(VK_N); break;
        	case 'o': doType(VK_O); break;
        	case 'p': doType(VK_P); break;
        	case 'q': doType(VK_Q); break;
        	case 'r': doType(VK_R); break;
        	case 's': doType(VK_S); break;
        	case 't': doType(VK_T); break;
        	case 'u': doType(VK_U); break;
        	case 'v': doType(VK_V); break;
        	case 'w': doType(VK_W); break;
        	case 'x': doType(VK_X); break;
        	case 'y': doType(VK_Y); break;
        	case 'z': doType(VK_Z); break;
        	case 'A': doType(VK_SHIFT, VK_A); break;
        	case 'B': doType(VK_SHIFT, VK_B); break;
        	case 'C': doType(VK_SHIFT, VK_C); break;
        	case 'D': doType(VK_SHIFT, VK_D); break;
        	case 'E': doType(VK_SHIFT, VK_E); break;
    <...>
        	case '$': doType(VK_DOLLAR); break;
        	case '%': doType(VK_SHIFT, VK_5); break;
        	case '^': doType(VK_CIRCUMFLEX); break;
        	case '&': doType(VK_AMPERSAND); break;
        	case '*': doType(VK_ASTERISK); break;
        	case '(': doType(VK_LEFT_PARENTHESIS); break;
        	case ')': doType(VK_RIGHT_PARENTHESIS); break;
        	case '_': doType(VK_UNDERSCORE); break;
        	case '+': doType(VK_PLUS); break;
        	case '\t': doType(VK_TAB); break;
        	case '\n': doType(VK_ENTER); break;
        	case '[': doType(VK_OPEN_BRACKET); break;
        	case ']': doType(VK_CLOSE_BRACKET); break;
        	case '\\': doType(VK_BACK_SLASH); break;
        	case '{': doType(VK_SHIFT, VK_OPEN_BRACKET); break;
        	case '}': doType(VK_SHIFT, VK_CLOSE_BRACKET); break;
        	case '|': doType(VK_SHIFT, VK_BACK_SLASH); break;
        	case ';': doType(VK_SEMICOLON); break;
        	case ':': doType(VK_COLON); break;
        	case '\'': doType(VK_QUOTE); break;
        	case '"': doType(VK_QUOTEDBL); break;
        	case ',': doType(VK_COMMA); break;
        	case '<': doType(VK_LESS); break;
        	case '.': doType(VK_PERIOD); break;
        	case '>': doType(VK_GREATER); break;
        	case '/': doType(VK_SLASH); break;
        	case '?': doType(VK_SHIFT, VK_SLASH); break;
        	case ' ': doType(VK_SPACE); break;
        	default:

    http://stackoverflow.com/questions/1248510/convert-string-to-keyevents
    Конвертируем символы в клавиши.
    Боян, да. Но теперь на джаве. Кстати, автор забыл про toLower и toUpper.

    RaZeR, 01 Декабря 2011

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

    +169

    1. 1
    <img onmouseover="this.style.cursor='pointer'" onmouseout="this.style.cursor=''">

    gorsash, 01 Декабря 2011

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

    +1020

    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
    #include <stdio.h>
    #define _0000 0
    #define _0001 int
    #define _0010 a
    #define _0011 16
    #define _0100 b
    #define _0101 c
    #define _0110 printf
    #define _0111 "%d"
    #define _1000 d
    #define _1001 (
    #define _1010 )
    #define _1011 =
    
    int main()
    {
    	_0001 _1000 _1011 _0011;
    	_0001 _0010 _1011 _1000;
    	_0001 _0100 _1011 _1001--_1000 _1010+++_1001++_1000 _1010;
    	_0001 _0101 _1011 _0010>_0100?_0010:_0100>_0010?_0100:_0000;
    	_0110 _1001 _0111, _0101 _1010;
    	getchar();
    }

    Показал первому курсу define, на дом задал простейшую задачу. На следующий день увидел это.

    A1mighty, 01 Декабря 2011

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

    +161

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    function GetBasketUserID($bSkipFUserInit = False)
    {
    		$bSkipFUserInit = ($bSkipFUserInit ? True : False);   //  <----это зачем вообще надо
    
    		if (!array_key_exists("SALE_USER_ID", $_SESSION))
    			$_SESSION["SALE_USER_ID"] = 0;
    
    		CSaleBasket::Init(false, $bSkipFUserInit);
    
    		return $_SESSION["SALE_USER_ID"];
    }

    Стандартная функция модуля интернет-магазина в битригзе. Наткнулся во время поиска неуловимого бага, из-за которого пришлось лезть в кишки CMS

    forkhammer, 01 Декабря 2011

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