1. Си / Говнокод #4144

    +144

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    }
                               }
                            }
                         }
                      }
                   }
                }
             }
          }
       }

    Да, у нас есть и такое.

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

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

    +150

    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
    private function sape()
    	{
    		$sapelinks = array('Ваша реклама <a href="http://www.remont-pr0.ru">будет</a> здесь!');
    		if ($this->sape_on)
    		{
    			if (!defined('_SAPE_USER')) define('_SAPE_USER', '3a2a5sd5a1dfas1fas154as3dd19391c');
    			require_once(_SAPE_USER.'/sape.php');
    			$fierce['charset'] = 'UTF-8';
    			$sape = new SAPE_client($fierce);
    			for ($i = 0; $i<16; $i++)
    			{
    				$item = $sape->return_links(1);
    				$sure = str_replace(' ', '', $sape->return_links(1));
                                    //$sape->return_links(1) заменить на $item выше
    				if ($sure <> '') $sapelinks[] = $item;
    			}
    		}
    		return $sapelinks;
    	}

    Подключил сапу к своей модной CMS. По желанию я зделал динамический вывод блока если ссылка существует. Но ошибся, в итоге вместо 3 ссылок выводилась одна. Сразу нашел ошибку, у меня чутье как у собак. Можете полюбоваться как красиво выводит в стиле вэб-2,0. Не то что ГЛУПЫЕ_И_ТУПЫЕ вэб мастера выводять комком снизу старницы. И разве я после этого не гений?

    Ссылка на страницу моего сайта с рекламой сапы: http://bit.ly/cl9sHP

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

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

    +170

    1. 1
    var divComment = img.getParent('div').getChildren('div.comment-children')[0];

    Из набирающего обороты LiveStreet. В теме есть чудо-скрипт comments.js, 79-я строчка. Все аяксы и ответы на комменты держатся на стратегической картинке. Не зная всунул картинко в другое место - трахался несколько часов ):

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

    Комментарии (1)
  4. 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)
  5. 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)
  6. 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)
  7. C++ / Говнокод #4138

    +151

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

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

    DarthBobr, 31 Августа 2010

    Комментарии (16)
  8. Си / Говнокод #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)
  9. C++ / Говнокод #4136

    +144

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

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

    bugmenot, 31 Августа 2010

    Комментарии (6)
  10. 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)