1. JavaScript / Говнокод #10506

    +154

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    checkParent: function () {
                var p = this.el.parent().length > 0 ? this.el.parent()[0] : this.el.parent(),
                    tp = this.parent && this.parent.length > 0 ? this.parent[0] : this.parent;
    
                return p !== tp;
            }

    wtf?

    nur, 31 Мая 2012

    Комментарии (0)
  2. JavaScript / Говнокод #10505

    +157

    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
    ISQ.Tools.getNumber=function(c,a){
        var d=typeof(c);
        if(typeof(c)==="number"){
    	return c
        }
        if(typeof(c)!=="string"){
    	c=c.toString()
        }
        var b;
        if(c.contains(".")){
    	b=parseFloat(c)
        }
        else
        {
    	b=parseInt(c)
        }
        if(isNaN(b)){
    	return typeof(a)==="number"?a:NaN
        }
        return b
    };

    Того же автора, что и предыдущий пост:
    Борьба идиота и динамической типизации, где в итоге динамическая типизация все же побеждает, но какой ценой...

    wvxvw, 31 Мая 2012

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

    +65

    1. 1
    2. 2
    3. 3
    <?if (strpos($img, 'no_photo') !== false) {} else {?>     
    	  <img title="<?=util::prepareHTML($a_info['cap'])?>" src="<?=$img?>" width="361" height="238" class="clipart-news-l" alt="<?=util::prepareHTML($a_info['cap'])?>" />         
        <?}?>

    no comment.

    nethak, 31 Мая 2012

    Комментарии (16)
  4. JavaScript / Говнокод #10503

    +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
    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
    String.prototype.startsWith=function(b){
        if(this.length<b.length){
    	return false
        }
        for(var a=0;a<b.length;++a){
    	if(this.charAt(a)!==b.charAt(a)){
    	    return false
    	}
        }
        return true
    };
    
    String.prototype.endsWith=function(b){
        if(this.length<b.length){
    	return false
        }
        var c=b.length-1;
        for(var a=this.length-1;a>this.length-1-b.length;--a){
    	if(b.charAt(c--)!==this.charAt(a)){
    	    return false
    	}
        }
        return true
    };
    
    String.prototype.contains=function(a){
        return this.indexOf(a)!==-1
    };
    
    String.prototype.LastIndexOf=function(d,c){
        if(this.length===0||d===null){
    	return -1
        }
        if(d.length>this.length){
    	return -1
        }
        if(isNaN(c)){
    	c=this.length-d.length
        }
        var a=false;
        for(var b=c;b>=0;--b){
    	a=true;
    	for(var e=0;e<d.length;++e){
    	    if(this.charAt(b+e)!==d.charAt(e)){
    		a=false;
    		break
    	    }
    	}
    	if(a){
    	    return b
    	}
        }
        return -1
    };
    
    String.prototype.LastIndexOf_char=function(a){
        for(var b=this.length-1;b>=0;--b){
    	if(this.charAt(b)===a){
    	    return b
    	}
        }
        return -1
    };
    
    String.prototype.setCharAt=function(b,a){
        if(b>this.length-1){
    	return str
        }
        return this.substr(0,b)+a+this.substr(b+1)
    };
    
    String.prototype.countCharAppearances=function(a){
        var b=0;
        for(var c=0;c<this.length;++c){
    	if(this.charAt(c)==a){
    	    ++b
    	}
        }
        return b
    };

    Сорри, что много буков, но тут каждую функцию можно воспринимать как отдельное произведение.
    Разбираю бред какого-то безымянного идиота :(

    wvxvw, 31 Мая 2012

    Комментарии (53)
  5. Python / Говнокод #10502

    −91

    1. 1
    2. 2
    3. 3
    >>>from itertools import chain, repeat
    >>>tuple(chain(tuple(chain(*tuple(repeat(tuple(chain((6,), repeat(7,5), (8,))),5)))),repeat(9, 7),repeat(10, 7)))
    (6, 7, 7, 7, 7, 7, 8, 6, 7, 7, 7, 7, 7, 8, 6, 7, 7, 7, 7, 7, 8, 6, 7, 7, 7, 7, 7, 8, 6, 7, 7, 7, 7, 7, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10)

    Zapix, 31 Мая 2012

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

    +82

    1. 1
    bool IsClient = level == "Client" ? true : false;

    startrack, 31 Мая 2012

    Комментарии (4)
  7. 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)
  8. Python / Говнокод #10482

    −96

    1. 1
    2. 2
    3. 3
    4. 4
    import sys, os
    
    # include project path like an EVIL
    sys.path.append('/'+os.path.join(*os.getcwd().split(os.path.sep)[1:-1]))

    Включении в поиск родительской директории

    mindinpanic, 31 Мая 2012

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

    +78

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    public function monthToString($month)
    {	
    	$months = array('никогдарь', 'январь', 'февраль', 'март', 'апрель', 'май', 'июнь', 'июль', 'август', 'сентябрь', 'октябрь', 'ноябрь', 'декабрь');
    	if(is_numeric($month))
    	{
    		$month = ltrim($month, "0");
    		$month = $months[$month];
    	}
    	return $month;
    }

    Стажер нашел весьма нетривиальный способ получить месяц текстом =D

    s1Paris, 31 Мая 2012

    Комментарии (49)
  10. Java / Говнокод #10480

    +111

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    // WARNING!
    // This has to be optional=true so that OpenJPA uses
    // LEFT JOIN instead of INNER JOIN. Otherwise, MySQL tries
    // using a temporary table (horrible for performance) and dies.
    @ManyToOne(optional = true)
    @NotNull
    private Font font;

    someone, 31 Мая 2012

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