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

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

    +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
    function _subqery_helper ($uri){
    static $i;
    		$i++;
    
    		if ((is_array($uri)) && (!empty($uri))) {
    			$keyword = array_pop($uri); //извлекаем последний элемент
    			
    			if ($i==1) 
    			{
    				$subqery = 'AND item.keyword= '.$this->db->escape($keyword).' '.(count($uri)? 'AND parent IN 
    				('.$this->_subqery_helper($uri).')' : '');
    			}
    			
    			elseif ($i > 1) 
    			{
    				$subqery = 'SELECT id FROM '.$this->db->dbprefix($this->table).' WHERE keyword = '.$this->db->escape($keyword).' AND parent '.(count($uri)? 'IN 
    				('.$this->_subqery_helper($uri).')' : ' = 0');
    			}
    		}
    		return $subqery;
    }

    массив $url очень простой:
    1=>"str1",2=>"str2",3=>"str3"

    это непонятная итерационная функция, которая вообще непонятно зачем такая сложная....

    xoptov, 15 Марта 2013

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

    +157

    1. 1
    if (!("" instanceof String)) throw new Error("Empty string is not a string");

    Майкрософт. JScript, ASP.

    wvxvw, 19 Февраля 2013

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

    +157

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    var onClear = function(e)
                {
                    if(e.value == "Логин" || e.value == "Пароль")
                        {
                            e.value = "";
                        }
                }

    <input type="text" name="login" value="Логин" onclick="onClear(this);"/>
    Ох блин...

    Govnisti_Diavol, 14 Января 2013

    Комментарии (22)
  5. JavaScript / Говнокод #12399

    +157

    1. 1
    2. 2
    3. 3
    4. 4
    $( function() { $('#brief').wysibb( window.uCoz.uwbb ); } );    
    $( function() { $('#message').wysibb( window.uCoz.uwbb ); } );    
    $( function() { $('#format_message, label[for="format_message"]').hide(); } );    
    $( function() { $('#format_brief, label[for="format_brief"]').hide(); } );

    В одну конструкцию-то стрёмно вставлять...

    TRANE73, 09 Января 2013

    Комментарии (1)
  6. JavaScript / Говнокод #12147

    +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
    <SCRIPT language=JavaScript>                     <!--#### Подпрограммы (скрипты) для вывода фотографий составных частей ПК #### -->
    	function picture1(){
    		window.open("P4P800.jpg", "newwindow01", config="width=460, height=515, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0");
    }
    	function picture2(){
    		window.open("CPU.jpg", "newwindow02", config="width=355, height=380, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0");
    }
    	function picture3(){
    		window.open("Video.jpg", "newwindow03", config="width=475, height=380, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0");
    }
    	function picture4(){
    		window.open("Syst.jpg", "newwindow04", config="width=220, height=220, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0");
    }
    	function picture5(){
    		window.open("audio.jpg", "newwindow05", config="width=315, height=200, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0");
    }
    	function picture6(){
    		window.open("Seti.jpg", "newwindow06", config="width=190, height=120, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0");
    }
    	function picture7(){
    		window.open("hdd.jpg", "newwindow07", config="width=725, height=425, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0");
    }
    	function picture8(){
    		window.open("dvd.jpg", "newwindow08", config="width=520, height=205, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0");
    }
    	function picture9(){
    		window.open("korpus.jpg", "newwindow09", config="width=820, height=435, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0");
    }
    	function picture10(){
    		window.open("monitor.jpg", "newwindow10", config="width=320, height=320, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0");
    }
    	function picture11(){
    		window.open("Klava.jpg", "newwindow11", config="width=510, height=250, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0");
    }
    	function picture12(){
    		window.open("Mouse.jpg", "newwindow12", config="width=340, height=285, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0");
    }
    	function picture13(){
    		window.open("print.jpg", "newwindow13", config="width=467, height=295, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0");
    }
    	function picture14(){
    		window.open("RAM.jpg", "newwindow14", config="width=530, height=135, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0");
    }
    </script>                                    <!--#### Конец скриптов ####-->

    Stallman, 18 Ноября 2012

    Комментарии (9)
  7. JavaScript / Говнокод #11898

    +157

    1. 1
    2. 2
    3. 3
    4. 4
    var body=document.getElementsByTagName('body')[0];
    var newBody="";
    newBody='<div id="'+this.cntID+'" class="hide you">'+this.flashCntDivArr.join('')+'</div>'+bgLayerDiv+"<div id='tplCnt'>"+body.innerHTML+"</div>";
    body.innerHTML=newBody;

    Натолкнулся в одном из проектов на такой вот способ добавления элемента в DOM. Я чего-то не понимаю?

    nbspjr, 09 Октября 2012

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

    +157

    1. 1
    this.unbind('click').die('click').off('click').on('click', _start)

    no comments

    Nemoden, 01 Октября 2012

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

    +157

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    var ml = ctx.offset().left - $(window).width() / 2 + 35;
    
                if (ml > 230) {
                    ml = 185;
                    ml = ctx.offset().left - $(window).width() / 2 - 289 - 10
                    popup.find('.popup-angle').addClass('popup-angle-right');
                }

    Чудеса нумерологии

    SuperChel, 05 Сентября 2012

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

    +157

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    функция foo( arr ) {
      для( пер i = 0; i < arr.length; i++ ) {
        если( arr[ i ] === неопредел ) {
          arr[ i ] = нуль;
        }
      }
      возврат arr;
    }

    http://eclipsesource.com/blogs/2012/09/03/js-i18n/ говорит, что мы можем писать такой джяваскрипт при условии использования http://fhtr.org/js-i18n/

    makc3d, 03 Сентября 2012

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

    +157

    1. 1
    2. 2
    3. 3
    4. 4
    var temp = new Date(),
        diff = parseInt(($('#calrlimit1').data('datebox').theDate - temp) / ( 1000 * 60 * 60 * 24 ));
        diffstrt = (diff * -1)-1; // If you want a minimum of 1 day between, make this -2 instead of -1
        diffend = diff + 11; // Why 11 instead of 10?  No idea...

    Документация к плагину jQuery Mobile DateBox2

    UnnamedUser, 30 Августа 2012

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