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

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

    +148

    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
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    <div id="html-header">
    	<!--Начало этого долбаного скрипта-->
    <Sсгiрt>
    <!--
    var checkpass=''''
    tell=0
    counttimes=0
    disComp=0
    function preferences(encryptpass,encryptdepth,what,dis){
     disComp=dis
     tell=0
     tell=what
     checkpass=''''
     counttimes=0
     times=encryptdepth
     checkpass=encryptpass
     orig=''''
     this.check=mkasci
    }
    
    bases=new Array(17,33,57,101);
    var acharset=''XYZNOhijkVWHIJ45ncdefMyzopqPQRSTUABKL6789ab_rs23CDEFGlmwtuvg01x''
    var storeup='''';
    function mkasci(orig){
     if(counttimes==0){storeup=orig}
     ascival=new Array()
     for(i=0;i<=orig.length-1;i++){
     for(i1=0;i1<=acharset.length;i1++){
     if(orig.charAt(i)==acharset.charAt(i1)){ascival=i1}
     }
     }
     themeat(ascival)
    }
    function cutoff(code){
     eval("var whatcode=''"+code+"''");
     eval("var whatcode2=''"+Math.ceil(code)+"''");
     bigVal=(Math.pow(10,whatcode.length-(whatcode2.length)-2)<1)?1:Math.pow(10,whatcode.length-(whatcode2.length)-2);
     whatcode3=Math.round(code*bigVal)/bigVal
     return(whatcode3)
    }
    function themeat(basecode){
     if(basecode.length>=4){
     counttimes++
     if(disComp==1){windоw.status="Computating encryption level "+counttimes+"/"+times}
     newcode=0
     finalcode=1
     for(count=0;count!=basecode.length;count++){
     newcode=(basecode[(count<(basecode.length-1))?count+1:count-2]+(basecode[count]*bases[2])*(2.303)+basecode[Math.round(((basecode.length-1)*((Math.atan(basecode[(count!=0)?count-1:count+1])*basecode.length)+2*bases[0]))/100)]+1)
     newcode=cutoff(newcode)
     newcode=(newcode>basecode[Math.round(basecode.length/2)])?newcode-=bases[3]:newcode+=bases[3]
     finalcode=cutoff(((newcode/10)*finalcode)/(basecode.length-bases[0]))
     }
     var deconstruct=''''
     eval(''var finalcode="''+(finalcode+times)+''"'');
     for(count=0;count<finalcode.length;count++){
     if(!isNaN(finalcode.charAt(count))){
     deconstruct=deconstruct+finalcode.charAt(count)
     }
     }
     finalcode=deconstruct
     var encrypt=new Array()
     for(count=2;count<finalcode.length+2;count+=2){
     eval("encrypt["+((count/2)-1)+"]=''"+((finalcode.charAt(count-2)!=''0'')?finalcode.charAt(count-2):'''')+""+finalcode.charAt(count-1)+"''")
     encrypt[((count/2)-1)]=acharset.charAt(Math.round((acharset.length*encrypt[((count/2)-1)])/100))
     }
     encrypt=encrypt.join('''')
     if(counttimes<times){mkasci(encrypt)} else {
     counttimes=0
     if(encrypt==checkpass&&tell==0){а1егt(''OK! Password '');1осаtiоn.replace(storeup+encrypt.substring(0,5)+".html");} else {
     if(tell==1){dосиmеnt.write("<B>"+storeup+"</B> is encrypted as <B>"+encrypt+"</B>");} else {
     if(history.length>0){
     а1егt("ERROR! Password ");
     history.go(-1);
     } else {1осаtiоn.replace("err.html")}
     }
     }
     }
     } else {
     if(history.length>0){
     а1егt("ERROR! Password ");
     history.go(-1);
     } else {1осаtiоn.replace("vhod.html")}
     }
    }
    
    
    password=new preferences(''s_mkAi_Z'',15,0,1);
    var enter='''';
    while(enter.length<4){
     enter=ргоmрt(''Enter Password PAROL '','''');
     if(!enter){enter='' ''}
    }
    password.check(enter);
    </Sсгiрt>
    <!--конец этого долбаного скрипта-->
    </div>

    Гк, однако.

    Stertor, 15 Января 2014

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

    +142

    1. 1
    2. 2
    /* 3.0.17-73642 */ 
    !function(){function createCookie(a,b,c){if(c){var d=new Date;d.setTime(d.getTime()+1000*60*60*24*c);var e="; expires="+d.toGMTString();}else{var e="";}document.cookie=a+"="+b+e+"; path=/";}function readCookie(a){for(var b=a+"=",c=document.cookie.split(";"),d=0;d<c.length;d++){for(var e=c[d];" "==e.charAt(0);){e=e.substring(1,e.length);}if(0==e.indexOf(b)){return e.substring(b.length,e.length);}}return null;}function eraseCookie(a){createCookie(a,"",-1);}var requirejs,require,define;!function(a){function b(a,b){var c,d,e,f,g,h,i,j=b&&b.split("/"),k=m.map,l=k&&k["*"]||{};if(a&&"."===a.charAt(0)&&b){for(j=j.slice(0,j.length-1),a=j.concat(a.split("/")),g=0;i=a[g];g++){if("."===i){a.splice(g,1),g-=1;}else{if(".."===i){if(1===g&&(".."===a[2]||".."===a[0])){return !0;}g>0&&(a.splice(g-1,2),g-=2);}}}a=a.join("/");}if((j||l)&&k){for(c=a.split("/"),g=c.length;g>0;g-=1){if(d=c.slice(0,g).join("/"),j){for(h=j.length;h>0;h-=1){if(e=k[j.slice(0,h).join("/")],e&&(e=e[d])){f=e;break;}}}if(f=f||l[d]){c.splice(0,g,f),a=c.join("/");break;}}}return a;}function c(b,c){return function(){return j.apply(a,o.call(arguments,0).concat([b,c]));};}function d(a){return function(c){return b(c,a);};}function e(a){return function(b){k[a]=b;};}function f(b){if(l.hasOwnProperty(b)){var c=l[b];delete l[b],n[b]=!0,i.apply(a,c);}if(!k.hasOwnProperty(b)){throw new Error("No "+b);}return k[b];}function g(a,c){var e,g,h=a.indexOf("!");return -1!==h?(e=b(a.slice(0,h),c),a=a.slice(h+1),g=f(e),a=g&&g.normalize?g.normalize(a,d(c)):b(a,c)):a=b(a,c),{f:e?e+"!"+a:a,n:a,p:g};}function h(a){return function(){return m&&m.config&&m.config[a]||{};};}var i,j,k={},l={},m={},n={},o=[].slice;i=function(b,d,i,j){var m,o,p,q,r,s,t=[];if(j=j||b,"function"==typeof i){for(d=!d.length&&i.length?["require","exports","module"]:d,s=0;s<d.length;s++){if(r=g(d[s],j),p=r.f,"require"===p){t[s]=c(b);}else{if("exports"===p){t[s]=k[b]={},m=!0;}else{if("module"===p){o=t[s]={id:b,uri:"",exports:k[b],config:h(b)};}else{if(k.hasOwnProperty(p)||l.hasOwnProperty(p)){t[s]=f(p);}else{if(r.p){r.p.load(r.n,c(j,!0),e(p),{}),t[s]=k[p];}else{if(!n[p]){throw new Error(b+" missing "+p);}}}}}}}q=i.apply(k[b],t),b&&(o&&o.exports!==a&&o.exports!==k[b]?k[b]=o.exports:q===a&&m||(k[b]=q));}else{b&&(k[b]=i);}},requirejs=require=j=function(b,c,d,e){return"string"==typeof b?f(g(b,c).f):(b.splice||(m=b,c.splice?(b=c,c=d,d=null):b=a),c=c||function(){},e?i(a,b,c,d):setTimeout(function(){i(a,b,c,d);},15),j);},j.config=function(a){return m=a,j;},define=function(a,b,c){b.splice||(c=b,b=[]),l[a]=[a,b,c];},define.amd={jQuery:!0};}(),define("../vendor/almond",function(){}),fortyone=new function(){this.e=new Date(2005,0,15).getTimezoneOffset(),this.f=new Date(2005,6,15).getTimezoneOffset(),this.plugins=[],this.d={Flash:["ShockwaveFlash.ShockwaveFlash",function(a){return a.getVariable("$version");}],Director:["SWCtl.SWCtl",function(a){return a.ShockwaveVersion("");}]},this.r=function(a){var b;try{b=document.getElementById(a);}catch(c){}if(null===b||"undefined"==typeof b){try{b=document.getElementsByName(a)[0];}catch(d){}}if(null===b||"undefined"==typeof b){for(var e=0;e<document.forms.length;e++){for(var f=document.forms[e],g=0;g<f.elements.length;g++){var h=f[g];if(h.name===a||h.id===a){return h;}}}}return b;},this.b=function(a){var b="";try{"undefined"!=typeof this.c.getComponentVersion&&(b=this.c.getComponentVersion(a,"ComponentID"));}catch(c){a=c.message.length,a=a>40?40:a,b=escape(c.message.substr(0,a));}return b;},this.exec=function(b){for(var c=0;c<b.length;c++){try{var d=eval(b[c]);if(d){return d;}}catch(e){}}return"";},this.p=function(a){var b="";try{if(navigator.plugins&&navigator.plugins.length){var c=RegExp(a+".* ([0-9._]+)");for(a=0;a<navigator.plugins.length;a++){var d=c.exec(navigator.plugins[a].name);null===d&&(d=c.exec(navigator.plugins[a].description)),d&&(b=d[1]);}}else{if(window.ActiveXObject&&this.d[a]){try{var e=new ActiveXObject(this.d[a][0]);b=this.d[a][1](e);}catch(f){b="";}}}}catch(g){b=g.message;}return b;},this.q=function(){for(var a=["Acrobat","Flash","QuickTime","Java Plug-in","Director","Office"],b=0;b<a.length;b++){var c=a[b];this.plugins[c]=this.p(c);}},this.g=function(){return Math.abs(this.e-this.f);},this.h=function(){return 0!==this.g();},this.i=function(a){var b=Math.min(this.e,this.f);return this.h()&&a.getTimezoneOffset()===b;},this.n=function(a){var b=0;return b=0,this.i(a)&&(b=this.g()),b=-(a.getTimezoneOffset()+b)/60;},this.j=function(a,b,c,d){"boolean"!=typeof d&&(d=!1);for(var e,f=!0;(e=a.indexOf(b))>=0&&(d||f);){a=a.substr(0,e)+c+a.substr(e+b.length),f=!1;}return a;},this.m=function(){return new Date(2005,5,7,21,33,44,888).toLocaleString();},this.k=function(b){var c=new Date,d=[function(){return"TF1";},function(){return"015";},function(){return ScriptEngineMajorVersion();},function(){return ScriptEngineMinorVersion();},function(){return ScriptEngineBuildVersion();},function(a){return a.b(

    йарасна зажыгаюць

    bahamot, 14 Января 2014

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

    +161

    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
    static function anyToTimestamp($date) {
    		// 2009-09-03 12:10:55
    		if (preg_match('/^([0-9]{4})\-([0-9]{2})\-([0-9]{2})(?: ([0-9]{2})\:([0-9]{2})\:([0-9]{2}))?$/', $date, $arr)) {
    			$ts = mktime($arr[4], $arr[5], $arr[6], $arr[2], $arr[3], $arr[1]);
    		// 03.04.2008 10:12:11
    		} elseif (preg_match('/^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})(?: ([0-9]{1,2})\:([0-9]{1,2})(?:\:([0-9]{2}))?)?$/', $date, $arr)) {
    			$ts = mktime($arr[4], $arr[5], $arr[6], $arr[2], $arr[1], $arr[3]);
    			// MySQL timestamp YYYYMMDDHHMISS
    		} elseif (preg_match('/^\d{14}$/', $date)) {
    			$ts = mktime(substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2), substr($string, 4, 2), substr($string, 6, 2),
    				substr($string, 0, 4));
    			// PHP timestamp
    		} elseif (is_int($date)) {
    			$ts = $date;
    			// давно заметил, что предыдущее условие не всегда срабатывает. добавил условие ниже. если передается timestamp 100% сработает
    		}elseif(strlen((int)$date)>=10 && is_int((int)$date)) {
    			$ts = $date;
    		}
    
    		return ($ts && $ts!=-1)?$ts:null;
    	}

    Копаюсь как обычно в проекте, а этот довольно большой на протяжении нескольких лет над ним трудились разные программисты.
    Причем бывает читаю смешные комментарии.

    Однако весь смысл не в этом как вы уже поняли.

    oooZinka, 14 Января 2014

    Комментарии (4)
  5. Objective C / Говнокод #14205

    −110

    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
    struct testStruct
    {
        char test[1024*1024*110];
    };
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        logMemUsage();
        testStruct* test = new testStruct();
        NSLog(@"test mem: %d", sizeof(test));
        logMemUsage();
        delete test;
        logMemUsage();
    
       <...>
    }

    Особенности управления памятью в iOS 6.
    Без этого фрагмента на слабых устройствах может ВНЕЗАПНО понизить объём доступной для приложения памяти со 120 до 90мб.

    Почему-то не порнографических ассоциаций не возникает.

    krypt, 10 Декабря 2013

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

    +8

    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
    void print(int i) {printf("int: %d\n", i);}
    void print(double f) {printf("double: %f\n", f);}
    void print(char const * c) {printf("str: %s\n", c);}
    
    void WTF(...) {}
    
    template<typename... T>
    void print(T ... t) 
    {
      WTF((print(t), 0)...);
    }
    
    int main()
    {
      print(1, "hello", 3.0);
      return 0;
    }

    http://ideone.com/wddRC7

    LispGovno, 03 Декабря 2013

    Комментарии (4)
  7. Си / Говнокод #14136

    +136

    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
    /*
     * Just a wifi driver hooker.
     *
     * Yongle Lai @ 2009-05-10 @ Rockchip
     */
    
    #include <linux/init.h>
    #include <linux/module.h>
    #include <linux/kernel.h>
    
    MODULE_LICENSE("Dual BSD/GPL");
    
    #ifdef CONFIG_MODVERSIONS
    #define MODVERSIONS
    #include <linux/modversions.h>
    #endif 
    
    //#define OLD_WIFI_IFACE
    
    #ifdef OLD_WIFI_IFACE
    extern int mv88w8686_if_sdio_init_module(void);
    extern void mv88w8686_if_sdio_exit_module(void);
    #else
    extern int rockchip_wifi_init_module(void);
    extern void rockchip_wifi_exit_module(void);
    #endif
    
    static int wifi_launcher_init(void) 
    {
      int ret;
    
      printk("=======================================================\n");
      printk("==== Launching Wi-Fi driver! (Powered by Rockchip) ====\n");
      printk("=======================================================\n");
    
    #ifdef OLD_WIFI_IFACE
      ret = mv88w8686_if_sdio_init_module();
      if (ret) /* Try again */
            ret = mv88w8686_if_sdio_init_module();
    #else
      ret = rockchip_wifi_init_module();
      //if (ret) /* Try again */
      //    ret = rockchip_wifi_init_module();
    #endif
    
      return ret;
    }
    
    static void wifi_launcher_exit(void) 
    {
      printk("=======================================================\n");
      printk("== Dis-launching Wi-Fi driver! (Powered by Rockchip) ==\n");
      printk("=======================================================\n");
    
    #ifdef OLD_WIFI_IFACE
      mv88w8686_if_sdio_exit_module();
    #else
      rockchip_wifi_exit_module();
    #endif
    }
    
    module_init(wifi_launcher_init);
    module_exit(wifi_launcher_exit);

    Вот так вот, просто и незатейливо на RK3188 включается и выключается вайфай.

    Necromant, 25 Ноября 2013

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

    +153

    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
    App.ns.SomeClass.prototype = {
        addMessage: function(status, msg, timeDelay) {
            if (status === false || status === this.STATUS_ERROR) {
                status = this.STATUS_ERROR;
                delay = timeDelay || 5; // default delay of msg box for error is 5 seconds. 
            }
            if (!timeDelay) {
                // 1 character - 1/7 sec 
                delay = msg.length / 7;
                if ((delay < 3) && !(timeDelay)) {
                    delay = 3;
                } else if ((delay > 30) && !(timeDelay)) {
                    delay = 30;
                    }
            }
            // показываем messagebox
        }
    };

    Кручу-верчу, запутать хочу.

    Elvenfighter, 24 Ноября 2013

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

    +160

    1. 1
    2. 2
    3. 3
    if(floor($info['http_code'] / 100) >= 4) {
      throw $this->castError($result);
    }

    Библиотека интеграции с Mandrill.

    korchasa, 20 Ноября 2013

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

    +131

    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
    try
                {
                    m = (int)Convert.ToInt32(num[1]);
                }
                catch
                {
                    Console.WriteLine("Invalid parametr");
                    return true;
                }
    
    //...................................................
                  try
                        {
                            matrix[i, j] = (float)Convert.ToDouble(num[j]);
                            
                        }
                        catch
                        {
                            Console.WriteLine("Invalid matrix");
                            return false;
                        }

    Лаба одногруника...

    Michigan, 09 Ноября 2013

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

    +161

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    this.ShowHideNoticeDate = function () {
            if ($("#associateNotice").is(':checked')) {
                jsNoticeField.setFieldValue(1);            
                $("#associateNotice").parent().parent().parent().parent().parent().parent().next().show();
                $("#associateNotice").parent().parent().parent().parent().parent().parent().next().children(1).children(0).children(0).children(0).children(0).children(0).children(1).val("");
                
            } else {
                jsNoticeField.setFieldValue(0);
                $("#associateNotice").parent().parent().parent().parent().parent().parent().next().hide();            
                $("#associateNotice").parent().parent().parent().parent().parent().parent().next().children(1).children(0).children(0).children(0).children(0).children(0).children(1).val("");            
            }
        };

    Голландский джаваскриптик)))

    RomashkaPro, 08 Ноября 2013

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