1. Java / Говнокод #7591

    +75

    1. 1
    String s = (new StringBuilder()).append("c.").append(Integer.toString(i, 36)).append(".").append(Integer.toString(j, 36)).append(".dat").toString();

    Опять из сорцов минесрафта.
    У нотча видимо StringBuilder головного мозга.

    RaZeR, 19 Августа 2011

    Комментарии (14)
  2. 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)
  3. PHP / Говнокод #7589

    +149

    1. 1
    INSERT INTO `wp_posts` (`ID`, `post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_excerpt`, `post_status`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_content_filtered`, `post_parent`, `guid`, `menu_order`, `post_type`, `post_mime_type`, `comment_count`) VALUES (NULL, '0', '2011-08-19 00:00:00', '2011-08-19 00:00:00', '$content', '$title', '', 'publish', 'open', 'open', '', '$cpu', '', '', '2011-08-19 00:00:00', '2011-08-19 00:00:00', '', '0', '$cpu_num', '0', 'post', '', '0');

    maeln0r, 19 Августа 2011

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

    +167

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $used_vars = Array ("s_user","s_roles","s_error");
    
    	for ($i = 0; $i < sizeof($used_vars); $i++) {
    		eval ("unset(\$".$used_vars[$i].");");
    	}

    humbug, 19 Августа 2011

    Комментарии (15)
  5. Java / Говнокод #7587

    +76

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    @Override
        public ResponseBag[] send(SmsBag[] smsBag) {
            ArrayList<ResponseBag> responseList = new ArrayList<ResponseBag>();
            for(SmsBag bag : smsBag) {
                responseList.add(super.send(bag));
            }
            ResponseBag[] responseBag = new ResponseBag[responseList.size()];
            return responseList.toArray(responseBag);
        }

    manyrus, 18 Августа 2011

    Комментарии (82)
  6. Pascal / Говнокод #7586

    +108

    1. 1
    if (rmes<>'')and(rmes<>#13#10)and(rmes<>#13#10#13#10)and(rmes<>#13#10#13#10#13#10) then

    Эталонный условный оператор прямо из Парижской Дельфийской палатки мер и весов.

    bugmenot, 18 Августа 2011

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

    +152

    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
    public function getObject()
    	{
    		$args = func_get_args();
    		if (empty($args)) {
    			$this->_throwException('wrong call of method - interface should be as 1st parameter');
    		}
    
    		$interface = array_shift($args);
    		
    		$class = $this->getInjection($interface);
    
            $argsCnt = count($args);
            if ($argsCnt == 0) {
                $object = new $class;
            }
            else if ($argsCnt == 1) {
                $object = new $class($args[0]);
            }
            else if ($argsCnt == 2) {
                $object = new $class($args[0], $args[1]);
            }
            else if ($argsCnt == 3) {
                $object = new $class($args[0], $args[1], $args[2]);
            }
            else if ($argsCnt == 4) {
                $object = new $class($args[0], $args[1], $args[2], $args[3]);
            }
            else if ($argsCnt == 5) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4]);
            }
            else if ($argsCnt == 6) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5]);
            }
            else if ($argsCnt == 7) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6]);
            }
            else if ($argsCnt == 8) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7]);
            }
            else if ($argsCnt == 9) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8]);
            }
            else if ($argsCnt == 10) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9]);
            }
            else if ($argsCnt == 11) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9], $args[10]);
            }
            else if ($argsCnt == 12) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9], $args[10], $args[11]);
            }
            else if ($argsCnt == 13) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9], $args[10], $args[11], $args[12]);
            }
            else if ($argsCnt == 14) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9], $args[10], $args[11], $args[12], $args[13]);
            }
            else if ($argsCnt == 15) {
                $object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9], $args[10], $args[11], $args[12], $args[13], $args[14]);
            }
            else {
        	   $this->_throwException('it looks like you use more than 15 arguments when trying to instantiate an object of class '.$class.' - that\'s ugly');
            }
    
            return $object;
    	}

    webeith, 18 Августа 2011

    Комментарии (25)
  8. Lua / Говнокод #7584

    −86

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if ( (world:isSelectionMode() or (world:getEffectSizeIcoLua() == 1) or
       (world:getEffectSizeIcoLua() == -1)) and (world:getEffectSizeIcoLua() ~= 2) ) 
    then
    ...
    end

    Скрипт на Lua, доставшийся в наследство. Несмотря на непонятное условие, вся грусть в том, что все значения скрипт получает с движка, и что это за значения нет ни одного комента... '-(

    MAGnit, 18 Августа 2011

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

    −321

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    typedef double NSTimeInterval;//Убило
    typedef signed char		BOOL; //??????????????
    #define YES             (BOOL)1
    #define NO              (BOOL)0
    typedef char *STR; //????

    Кокоа - рекомендует использовать свои типы вместо стандартных, но то что я нашел в библиотеках - тут писал наверное Кэп!

    Psionic, 18 Августа 2011

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

    −113

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    - (void)imageTransitionDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
        // clear the previous imageView
        [articleImageView removeFromSuperview];
        [articleImageView release];
        articleImageView = nil;
        articleImageView = articleImageView;
        newImageView = nil;
    }

    Чистим UIImageView так, что бы наверняка.

    nunaconecto, 18 Августа 2011

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