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

    +168

    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
    // Saves options to localStorage.
    function save_options() {
    	if(document.getElementById("rate").checked == true) {localStorage["rate"] = 1;}
    else{localStorage["rate"] = 0;}
    	if(document.getElementById("transparentmenu").checked == true) {localStorage["transparentmenu"] = 1;}
    else{localStorage["transparentmenu"] = 0;}
    	if(document.getElementById("sidebarfix").checked == true) {localStorage["sidebarfix"] = 1;}
    else{localStorage["sidebarfix"] = 0;}
    	if(document.getElementById("menufix").checked == true) {localStorage["menufix"] = 1;}
    else{localStorage["menufix"] = 0;}
    	if(document.getElementById("away").checked == true) {localStorage["away"] = 1;}
    else{localStorage["away"] = 0;}
    	if(document.getElementById("music").checked == true) {localStorage["music"] = 1;}
    else{localStorage["music"] = 0;}
    	if(document.getElementById("smiles").checked == true) {localStorage["smiles"] = 1;}
    else{localStorage["smiles"] = 0;}
    	if(document.getElementById("chat").checked == true) {localStorage["chat"] = 1;}
    else{localStorage["chat"] = 0;}
    	if(document.getElementById("wide").checked == true) {localStorage["wide"] = 1;}
    else{localStorage["wide"] = 0;}
    	if(document.getElementById("oblivionbook").checked == true) {localStorage["oblivionbook"] = 1;}
    else{localStorage["oblivionbook"] = 0;}
    	if(document.getElementById("darkblue").checked == true) {localStorage["darkblue"] = 1;}
    else{localStorage["darkblue"] = 0;}
    	if(document.getElementById("mailcollor").checked == true) {localStorage["mailcollor"] = 1;}
    else{localStorage["mailcollor"] = 0;}
    	if(document.getElementById("savetext").checked == true) {localStorage["savetext"] = 1;}
    else{localStorage["savetext"] = 0;}
    	if(document.getElementById("groupsalign").checked == true) {localStorage["groupsalign"] = 1;}
    else{localStorage["groupsalign"] = 0;}
    	if(document.getElementById("vkcom").checked == true) {localStorage["vkcom"] = 1;}
    else{localStorage["vkcom"] = 0;}
    	if(document.getElementById("messege").checked == true) {localStorage["messege"] = 1;}
    else{localStorage["messege"] = 0;}
    	if(document.getElementById("ads").checked == true) {localStorage["ads"] = 1;}
    else{localStorage["ads"] = 0;}
    	if(document.getElementById("lmessege").checked == true) {localStorage["lmessege"] = 1;}
    else{localStorage["lmessege"] = 0;}
    	if(document.getElementById("video").checked == true) {localStorage["video"] = 1;}
    else{localStorage["video"] = 0;}
    	if(document.getElementById("stylewow").checked == true) {localStorage["stylewow"] = 1;}
    else{localStorage["stylewow"] = 0;}
    	if(document.getElementById("rayman").checked == true) {localStorage["rayman"] = 1;}
    else{localStorage["rayman"] = 0;}
    	if(document.getElementById("styletf2").checked == true) {localStorage["styletf2"] = 1;}
    else{localStorage["styletf2"] = 0;}
    	if(document.getElementById("stylestandard").checked == true) {localStorage["stylestandard"] = 1;}
    else{localStorage["stylestandard"] = 0;}
    	if(document.getElementById("stylewinter").checked == true) {localStorage["stylewinter"] = 1;}
    else{localStorage["stylewinter"] = 0;}
    	if(document.getElementById("stylewide").checked == true) {localStorage["stylewide"] = 1;}
    else{localStorage["stylewide"] = 0;}
    	if(document.getElementById("styledarkforest").checked == true) {localStorage["styledarkforest"] = 1;}
    else{localStorage["styledarkforest"] = 0;}
    	if(document.getElementById("stylegray").checked == true) {localStorage["stylegray"] = 1;}
    else{localStorage["stylegray"] = 0;}
    	if(document.getElementById("styledarkkde").checked == true) {localStorage["styledarkkde"] = 1;}
    else{localStorage["styledarkkde"] = 0;}
    	if(document.getElementById("friendsonline").checked == true) {localStorage["friendsonline"] = 1;}
    else {localStorage["friendsonline"] = 0;}
    	if(document.getElementById("removeheader").checked == true) {localStorage["removeheader"] = 1;}
    else {localStorage["removeheader"] = 0;}
    }

    Сохранение настроек в одном расширении для Google Chrome. Восстановление такого же плана...

    Proxeter, 01 Сентября 2010

    Комментарии (9)
  2. SQL / Говнокод #4140

    −854

    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
    procedure dynamic_open(p_sql VARCHAR2, p_params t_string_table, p_cur OUT SYS_REFCURSOR) is
      begin
        case p_params.count
          when 0 then open p_cur for p_sql;
          when 1 then open p_cur for p_sql using p_params(1);
          when 2 then open p_cur for p_sql using p_params(1),
                                                 p_params(2);
          when 3 then open p_cur for p_sql using p_params(1),
                                                 p_params(2),
                                                 p_params(3);
          when 4 then open p_cur for p_sql using p_params(1),
                                                 p_params(2),
                                                 p_params(3),
                                                 p_params(4);
    /* ... */
          when 100 then open p_cur for p_sql using p_params(1),
                                                 p_params(2),
                                                 p_params(3),
                                                 p_params(4),
    /* ... */
                                                 p_params(100);
        end case;
      end dynamic_open;

    Динамический SQL - такой динамический. Уложились всего-то в 5050 строк.

    wecanstoptrain, 31 Августа 2010

    Комментарии (12)
  3. JavaScript / Говнокод #4139

    +163

    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
    if (document.all('text1')!=null)
      {
       obj=document.all('text1');
       obj.style.position='absolute';
       obj.style.left=785+k;
       obj.style.top=66;
      }
      if (document.all('text1')!=null)
      {
      obj=document.all('text2');
      obj.style.position='absolute';
      obj.style.left=785+k;
      obj.style.top=88;
      }
      if (document.all('text1')!=null)
      {
      obj=document.all('img1');
      obj.style.position='absolute';
      obj.style.left=730+k;
      obj.style.top=72;
      }
      if (document.all('text1')!=null)
      {
      obj=document.all('img2');
      obj.style.position='absolute';
      obj.style.left=904+k;
      obj.style.top=84;
      }
      if (document.all('text1')!=null)
      {
      obj=document.all('img3');
      obj.style.position='absolute';
      obj.style.left=785+k;
      obj.style.top=39;
      }
      if (document.all('text1')!=null)
      {
      obj=document.all('img4');
      obj.style.position='absolute';
      obj.style.left=795+k;
      obj.style.top=109;
      }

    Надеюсь, что это генерировали в цикле, а не писали руками.

    telnet, 31 Августа 2010

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

    +151

    1. 1
    typedef std::basic_string<unsigned short> wstring;

    вот, надыбал в одном из подпроектов большого проекта.

    DarthBobr, 31 Августа 2010

    Комментарии (16)
  5. Си / Говнокод #4137

    +138

    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
    static const char*const nullp,From_[]=FROM,exflags[]=RECFLAGS,
     drcfile[]="Rcfile:",pmusage[]=PM_USAGE,*etcrc=ETCRC,
     misrecpt[]="Missing recipient\n",extrns[]="Extraneous ",ignrd[]=" ignored\n",
     pardir[]=chPARDIR,curdir[]={chCURDIR,'\0'},
     insufprivs[]="Insufficient privileges\n",
     attemptst[]="Attempt to fake stamp by";
    char*buf,*buf2,*loclock,*tolock;
    const char shell[]="SHELL",lockfile[]="LOCKFILE",newline[]="\n",binsh[]=BinSh,
     unexpeof[]="Unexpected EOL\n",*const*gargv,*const*restargv= &nullp,*sgetcp,
     pmrc[]=PROCMAILRC,*rcfile=pmrc,dirsep[]=DIRSEP,devnull[]=DevNull,
     lgname[]="LOGNAME",executing[]="Executing",oquote[]=" \"",cquote[]="\"\n",
     procmailn[]="procmail",whilstwfor[]=" whilst waiting for ",home[]="HOME",
     host[]="HOST",*defdeflock,*argv0="",errwwriting[]="Error while writing to",
     slogstr[]="%s \"%s\"",conflicting[]="Conflicting ",orgmail[]="ORGMAIL",
     exceededlb[]="Exceeded LINEBUF\n",pathtoolong[]=" path too long";
    char*Stdout;
    int retval=EX_CANTCREAT,retvl2=EXIT_SUCCESS,sh,pwait,lcking,rcstate,rc= -1,
     ignwerr,lexitcode=EXIT_SUCCESS,asgnlastf,accspooldir,crestarg,skiprc,
     savstdout,berkeley,mailfilter,erestrict;
    size_t linebuf=mx(DEFlinebuf+XTRAlinebuf,1024/*STRLEN(systm_mbox)<<1*/);
    volatile int nextexit;			       /* if termination is imminent */
    pid_t thepid;
    long filled,lastscore;	       /* the length of the mail, and the last score */
    char*themail,*thebody;			    /* the head and body of the mail */
    uid_t uid;
    gid_t gid,sgid;

    Источник: http://opensource.apple.com/source/procmail/procmail-1.2/procmail/src/procmail.c

    sanchousf, 31 Августа 2010

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

    +144

    1. 1
    2. 2
    int i = 1;
    int j = i++ + ++i;

    Инкремент-экскремент, чтобы враг не догадался, 3 или 4 это выражение возвращает.

    bugmenot, 31 Августа 2010

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

    +164

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    <?php
    $Data = array(images => ImgPathHttp);
    if ($level[$cn][good][$cg][news] || true) {
    	$Data[link_img] = "<a class=\"Size11item\" href=\"" . $App->GetURLWww(array(c => $level[$cn][id_cat], pid => $level[$cn][good][$cg][id_good], show_product => $show_product)) . "\" title=\"" . $level[$cn][good][$cg][model] . "\">";
    	$Data[link_img_end] = "</a>";
    } else {
    	$Data[link_img] = "<font class=red>";
    	$Data[link_img_end] = "</font>";
    }

    Требуется заменить шаблон на сайте.
    Переплёты PHP, HTML, SMARTY.
    Фаил "/includes/inc/item.inc.php".
    КАЗНИТЬ НЕЛЬЗЯ ПОМИЛОВАТЬ.

    doremidon, 31 Августа 2010

    Комментарии (15)
  8. PHP / Говнокод #4134

    +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
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    $divid = '';
    
    if ( $ja_left && $ja_right && $ja_mascol ) {
      //2 columns on the right
    	$divid = '';
    } elseif ( ($ja_left && !$ja_right && !$ja_mascol) ) {
      //One column without masscol
    	$divid = '-lo';
    } elseif ((!$ja_left && $ja_right && !$ja_mascol)) {
      //One column with masscol
    	$divid = '-ro';
    } elseif ((!$ja_left && !$ja_right && $ja_mascol)) {
      //One column with masscol
    	$divid = '-mo';
    } elseif ((!$ja_left && $ja_right && $ja_mascol)) {
      //One column with masscol
    	$divid = '-rm';
    } elseif (($ja_left && !$ja_right && $ja_mascol)) {
      //One column with masscol
    	$divid = '-lm';
    } elseif (($ja_left && $ja_right && !$ja_mascol)) {
      //One column with masscol
    	$divid = '-lr';
    } else {
      //No column in right
    	$divid = '-w';
    }
    
    
    // далее в другом файле
    
    <div id="ja-containerwrap<?php echo $divid ?>">

    Шаблон для жумлы. Особенно хороши комментарии

    mad_max, 31 Августа 2010

    Комментарии (6)
  9. Java / Говнокод #4133

    +79

    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
    /**
             * Convenience method call with one parameter
             * 
             * @param method name of method to call
             * @param p0 method's parameter
             * @return deserialized method return value
             * @throws XMLRPCException
             */
            public Object call(String method, Object p0) throws XMLRPCException {
                    Object[] params = {
                            p0,
                    };
                    return callEx(method, params);
            }
            
            /**
             * Convenience method call with two parameters
             * 
             * @param method name of method to call
             * @param p0 method's 1st parameter
             * @param p1 method's 2nd parameter
             * @return deserialized method return value
             * @throws XMLRPCException
             */
            public Object call(String method, Object p0, Object p1) throws XMLRPCException {
                    Object[] params = {
                            p0, p1,
                    };
                    return callEx(method, params);
            }
    
    //.......................................................
    //.....................cut.............................
    //.......................................................
    
            /**
             * Convenience method call with seven parameters
             * 
             * @param method name of method to call
             * @param p0 method's 1st parameter
             * @param p1 method's 2nd parameter
             * @param p2 method's 3rd parameter
             * @param p3 method's 4th parameter
             * @param p4 method's 5th parameter
             * @param p5 method's 6th parameter
             * @param p6 method's 7th parameter
             * @return deserialized method return value
             * @throws XMLRPCException
             */
            public Object call(String method, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) throws XMLRPCException {
                    Object[] params = {
                            p0, p1, p2, p3, p4, p5, p6,
                    };
                    return callEx(method, params);
            }
    
    
            /**
             * Convenience method call with eight parameters
             * 
             * @param method name of method to call
             * @param p0 method's 1st parameter
             * @param p1 method's 2nd parameter
             * @param p2 method's 3rd parameter
             * @param p3 method's 4th parameter
             * @param p4 method's 5th parameter
             * @param p5 method's 6th parameter
             * @param p6 method's 7th parameter
             * @param p7 method's 8th parameter
             * @return deserialized method return value
             * @throws XMLRPCException
             */
            public Object call(String method, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) throws XMLRPCException {
                    Object[] params = {
                            p0, p1, p2, p3, p4, p5, p6, p7,
                    };
                    return callEx(method, params);
            }

    http://code.google.com/p/android-xmlrpc/source/browse/trunk/XMLRPC/src/org/xmlrpc/android/XMLRPCClient.java

    striker, 31 Августа 2010

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

    +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
    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
    //               
                       // <?php if (!Yii::app()->user->checkAccess('partner')) { ?>
    
                            a+='<td'+cl+'>'+msg['keywords'][i][mord] + '</td>';
    
                       // <?php } ?>
    
                            //'</strong></td><td'+cl+'>'+currentMordCost+
                            a+='<td'+cl+'>'+(msg['keywords'][i]['costM'])
                            +'</td>'+
                            '<td'+cl+'>'+$.getTiming(msg['domainTrust'], msg['keywords'][i][mord]) + '</td>' +
                            '<td'+cl+'><img class="info" src=\"/images/information.png\" alt=\"'+i+'\" id=\"'+i+'\" > <B>' +msg['keywords'][i]['notice']+'</B></td></tr>';
                            msg['keywords'][i]['domainTrust'] = msg['domainTrust'];
                            hints[i]=jQuery.getHint(msg['keywords'][i]);
                            if (msg['keywords'][i]['bad']==true)
                                badCount++;
                            //mordNestedCost = mord/2 / msg['keywords'][i]['nested'].length;
    
                            //costMNested=(msg['keywords'][i]['costM']) / 2 / msg['keywords'][i]['nested'].length;
                            //if (halfMord == "-")
                            //	mordNestedCost = costMNested = "-";
                                mod='';modA='';
                            for (k=0;k<msg['keywords'][i]['nested'].length;k++)
                            {
    
                                if (k==parseInt(msg['keywords'][i]['up']))
                                    {
                                        mod  = '<span style="color:#626262;font-weight:bold;">';
                                        modA = '<\/span>';
                                    }
                                    if (msg['keywords'][i]['nested'][k]['freq'] <= 50 && msg['keywords'][i]['nested'][k]['mordCost'] >= 1)
                                            {
                                    msg['keywords'][i]['nested'][k]['notice'] += " <BR><span style='color:red'>Возможно посчитано неверно!</span>";
                                    hasCriticalErrors = true;
                                            }
                                a+= '<tr><td'+cl+'>' + mod + '    '+(msg['keywords'][i]['nested'][k]['title'])+ modA +
                                '</td>';
    
                            // // <?php if (!Yii::app()->user->checkAccess('partner')) { ?>
    
                                a+='<td'+cl+'>'+(msg['keywords'][i]['nested'][k][mord])+'</td>';
    
                            // <?php } ?>
    
                                a+='<td'+cl+'>'+
                                //'</td><td'+cl+'>'+currentNestedMordCost+'</td><td'+cl+'>'+
                                (msg['keywords'][i]['nested'][k]['costM'])+'</td>'+
                                    '<td'+cl+'>'+$.getTiming(msg['domainTrust'], msg['keywords'][i]['nested'][k][mord]) + '</td>' +
                                    '<td'+cl+'>'+'<img class="info" src=\"/images/information.png\" alt=\"info_'+i+'_'+k+'\" id=\"'+i+'_'+k+'\" >'+' <B>'+msg['keywords'][i]['nested'][k]['notice']+'</B></td></tr>';
                                msg['keywords'][i]['nested'][k]['domainTrust'] = msg['domainTrust'];
                                hints[i+'_'+k]=jQuery.getHint(msg['keywords'][i]['nested'][k]);
                                if (msg['keywords'][i]['nested']['bad'] == true)
                                    badCount++;
    
    
    
    
                            }

    Как вам такая каша из яваскрипта, пхп и хтмл?

    user654321, 31 Августа 2010

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