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

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

    −247

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    declare @col int
    set @col = 0
    
    while (select count(distinct id) from #tovar) > @col
    begin
    set @col = (select count(distinct id) from #tovar)
    	insert into #tovar (ParentID, ID, ISFOLDER, Tov) select parentID, ID, ISFOLDER, DESCR from SC23(nolock) where ISMARK = 0 and PARENTID in (select id from #tovar) 
    end

    dsfix, 30 Июля 2015

    Комментарии (1)
  3. Pascal / Говнокод #18547

    +7

    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
    function variant (x0, y0, x1, y1, x2, y2, x3, y3:real):integer;
    begin
        if (x0<=x1) and (y0<=y1) and (x1<=x2) and (y1<=y2) and (x2<=x3) and (y2<=y3) or
           (x0>=x1) and (y0<=y1) and (x1>=x2) and (y1<=y2) and (x2>=x3) and (y2<=y3) or
           (x0>=x1) and (y0>=y1) and (x1>=x2) and (y1>=y2) and (x2>=x3) and (y2>=y3) or
           (x0>=x1) and (y0<=y1) and (x1>=x2) and (y1<=y2) and (x2>=x3) and (y2<=y3) then variant:=1;
        if (x0<=x1) and (y0<=y1) and (x1<=x3) and (y1<=y3) and (x3<=x2) and (y3<=y2) or
           (x0>=x1) and (y0<=y1) and (x1>=x3) and (y1<=y3) and (x3>=x2) and (y3<=y2) or
           (x0>=x1) and (y0>=y1) and (x1>=x3) and (y1>=y3) and (x3>=x2) and (y3>=y2) or
           (x0>=x1) and (y0<=y1) and (x1>=x3) and (y1<=y3) and (x3>=x2) and (y3<=y2) then variant:=2;
        if (x1<=x0) and (y1<=y0) and (x0<=x2) and (y0<=y2) and (x2<=x3) and (y2<=y3) or
           (x1>=x0) and (y1<=y0) and (x0>=x2) and (y0<=y2) and (x2>=x3) and (y2<=y3) or
           (x1>=x0) and (y1>=y0) and (x0>=x2) and (y0>=y2) and (x2>=x3) and (y2>=y3) or
           (x1>=x0) and (y1<=y0) and (x0>=x2) and (y0<=y2) and (x2>=x3) and (y2<=y3) then variant:=3;
        if (x1<=x0) and (y1<=y0) and (x0<=x3) and (y0<=y3) and (x3<=x2) and (y3<=y2) or
           (x1>=x0) and (y1<=y0) and (x0>=x3) and (y0<=y3) and (x3>=x2) and (y3<=y2) or
           (x1>=x0) and (y1>=y0) and (x0>=x3) and (y0>=y3) and (x3>=x2) and (y3>=y2) or
           (x1>=x0) and (y1<=y0) and (x0>=x3) and (y0<=y3) and (x3>=x2) and (y3<=y2) then variant:=4;
        if (x0<=x3) and (y0<=y3) and (x3<=x1) and (y3<=y1) and (x1<=x2) and (y1<=y2) or
           (x0>=x3) and (y0<=y3) and (x3>=x1) and (y3<=y1) and (x1>=x2) and (y1<=y2) or
           (x0>=x3) and (y0>=y3) and (x3>=x1) and (y3>=y1) and (x1>=x2) and (y1>=y2) or
           (x0>=x3) and (y0<=y3) and (x3>=x1) and (y3<=y1) and (x1>=x2) and (y1<=y2) then variant:=5;
        if (x0<=x3) and (y0<=y3) and (x3<=x2) and (y3<=y2) and (x2<=x1) and (y2<=y1) or
           (x0>=x3) and (y0<=y3) and (x3>=x2) and (y3<=y2) and (x2>=x1) and (y2<=y1) or
           (x0>=x3) and (y0>=y3) and (x3>=x2) and (y3>=y2) and (x2>=x1) and (y2>=y1) or
           (x0>=x3) and (y0<=y3) and (x3>=x2) and (y3<=y2) and (x2>=x1) and (y2<=y1) then variant:=6;
        if (x0<=x2) and (y0<=y2) and (x2<=x1) and (y2<=y1) and (x1<=x3) and (y1<=y3) or
           (x0>=x2) and (y0<=y2) and (x2>=x1) and (y2<=y1) and (x1>=x3) and (y1<=y3) or
           (x0>=x2) and (y0>=y2) and (x2>=x1) and (y2>=y1) and (x1>=x3) and (y1>=y3) or
           (x0>=x2) and (y0<=y2) and (x2>=x1) and (y2<=y1) and (x1>=x3) and (y1<=y3) then variant:=7;
        if (x0<=x2) and (y0<=y2) and (x2<=x3) and (y2<=y3) and (x3<=x1) and (y3<=y1) or
           (x0>=x2) and (y0<=y2) and (x2>=x3) and (y2<=y3) and (x3>=x1) and (y3<=y1) or
           (x0>=x2) and (y0>=y2) and (x2>=x3) and (y2>=y3) and (x3>=x1) and (y3>=y1) or
           (x0>=x2) and (y0<=y2) and (x2>=x3) and (y2<=y3) and (x3>=x1) and (y3<=y1) then variant:=8;
        if (x1<=x2) and (y1<=y2) and (x2<=x0) and (y2<=y0) and (x0<=x3) and (y0<=y3) or
           (x1>=x2) and (y1<=y2) and (x2>=x0) and (y2<=y0) and (x0>=x3) and (y0<=y3) or
           (x1>=x2) and (y1>=y2) and (x2>=x0) and (y2>=y0) and (x0>=x3) and (y0>=y3) or
           (x1>=x2) and (y1<=y2) and (x2>=x0) and (y2<=y0) and (x0>=x3) and (y0<=y3) then variant:=9;
        if (x1<=x3) and (y1<=y3) and (x3<=x0) and (y3<=y0) and (x0<=x2) and (y0<=y2) or
           (x1>=x3) and (y1<=y3) and (x3>=x0) and (y3<=y0) and (x0>=x2) and (y0<=y2) or
           (x1>=x3) and (y1>=y3) and (x3>=x0) and (y3>=y0) and (x0>=x2) and (y0>=y2) or
           (x1>=x3) and (y1<=y3) and (x3>=x0) and (y3<=y0) and (x0>=x2) and (y0<=y2) then variant:=10;
        if (x2<=x0) and (y2<=y0) and (x0<=x1) and (y0<=y1) and (x1<=x3) and (y1<=y3) or
           (x2>=x0) and (y2<=y0) and (x0>=x1) and (y0<=y1) and (x1>=x3) and (y1<=y3) or
           (x2>=x0) and (y2>=y0) and (x0>=x1) and (y0>=y1) and (x1>=x3) and (y1>=y3) or
           (x2>=x0) and (y2<=y0) and (x0>=x1) and (y0<=y1) and (x1>=x3) and (y1<=y3) then variant:=11;
        if (x2<=x1) and (y2<=y1) and (x1<=x0) and (y1<=y0) and (x0<=x3) and (y0<=y3) or
           (x2>=x1) and (y2<=y1) and (x1>=x0) and (y1<=y0) and (x0>=x3) and (y0<=y3) or
           (x2>=x1) and (y2>=y1) and (x1>=x0) and (y1>=y0) and (x0>=x3) and (y0>=y3) or
           (x2>=x1) and (y2<=y1) and (x1>=x0) and (y1<=y0) and (x0>=x3) and (y0<=y3) then variant:=12;
    end;

    Источник: http://e-olimp.blogspot.com/2013/08/12.html

    Felytic, 29 Июля 2015

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

    +142

    1. 1
    typedef long char wchar_t;

    qnx4.25 /usr/include/stdlib.h:
    sizeof(long char) == 2

    Xom94ok, 25 Июля 2015

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

    +142

    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
    (function($){
        
        var popup_show_delay = 0.5; // задержка в секундах
    
        $('.in_basket').each(function(){
            var $popup = $(this).find('.flyout');
            var timeoutId = null;
    
            var showPopup = function() {
                // Показываем попап
                $popup.removeClass('hidden');
            };
    
            var hidePopup = function() {
                // Скрываем попап
                $popup.addClass('hidden');
                console.log('hide popup');
            };
    
            var $targets = $([ this, $popup.get(0) ]);
    
            $targets.on('mouseenter', function(){
                console.log('show popup');
                clearTimeout(timeoutId);
                showPopup();
            });
    
            $targets.on('mouseleave', function(){
                clearTimeout(timeoutId);
                timeoutId = setTimeout(hidePopup, popup_show_delay * 1000);
            });
        });
    
    })(jQuery);

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

    littlefuntik, 15 Июля 2015

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

    +145

    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
    Xml: {
                parse: function (text) {
                    var xmlDocument;
                    if (window.DOMParser) {
                        var parser = new DOMParser();
                        xmlDocument = parser.parseFromString(text, "text/xml")
                    } else {
                        if (window.ActiveXObject) {
                            try {
                                xmlDocument = new ActiveXObject("Msxml2.DOMDocument.6.0")
                            } catch (err6) {
                                try {
                                    xmlDocument = new ActiveXObject("Msxml2.DOMDocument.5.0")
                                } catch (err5) {
                                    try {
                                        xmlDocument = new ActiveXObject("Msxml2.DOMDocument.4.0")
                                    } catch (err4) {
                                        try {
                                            xmlDocument = new ActiveXObject("MSXML2.DOMDocument.3.0")
                                        } catch (err3) {
                                            try {
                                                xmlDocument = new ActiveXObject("Microsoft.XMLDOM")
                                            } catch (err2) {
                                                Wicket.Log.error("Cannot create DOM document: " + err2)
                                            }
                                        }
                                    }
                                }
                            }
                            if (xmlDocument) {
                                xmlDocument.async = "false";
                                if (!xmlDocument.loadXML(text)) {
                                    Wicket.Log.error("Error parsing response: " + text)
                                }
                            }
                        }
                    }
                    return xmlDocument
                }
            },

    http://trudvsem.ru/

    alek0585, 10 Июля 2015

    Комментарии (1)
  7. C# / Говнокод #18466

    +142

    1. 1
    2. 2
    3. 3
    4. 4
    if (_availabilityOfThisPersonnel == null)
         _availabilityOfThisPersonnel = new List<Availability>();
    if (_availabilityOfThisPersonnel.Any())
        _availabilityOfThisPersonnel.Clear();

    vldalx, 10 Июля 2015

    Комментарии (1)
  8. Куча / Говнокод #18464

    +141

    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
    <div class="zz">
          <p2><span class="yy"><img src="pic.png" alt="..." name="..." class="yx" id="..."></span></2p>
          <div class="xx">
            <p2>1.<strong><a href="link1.html" title="..."> <span class="x">...</span></a><span class="x">.</span></strong>...</p2>
            <p>
            <p2>2. <strong class="x"><a href="link2.html" title="...">...</a></strong>...</p2>
            <p>
            <p2>3. <a href="link3.html" title=" ..." class="x"><strong>...</strong></a>, ...</p2>
            <p>
            <p2>4.<a href="link4.html" title="..." class="x"><strong>...</strong></a>. ...</p2>
            <p>
            <p2>5. <strong class="x"><a href="link5.html" title="..."><strong>...</strong></a></strong> ... </p2>
          </div>
    </div>

    html гуру

    username255, 10 Июля 2015

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

    +144

    1. 1
    2. 2
    3. 3
    4. 4
    $(document).ready(
    		function () {
    		    // Refactoring start
    		    $(document).ready(function () {

    Refactoring my ass

    Onanymous, 10 Июля 2015

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

    +141

    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
    <?
    /*
    =====================================================================================================================================================
    
    	DB COOPERATION
    	Developer:	Yudin Roman
    	Description:
    	Cooperation with databases.
    	
    	ВЗАИМОДЕЙСТВИЕ С БД
    	Разработка:	Юдин Роман
    	Описание:
    	Взаимодействие с базами данных.
    	
    =====================================================================================================================================================
    */
    
    class database
    {
        function connect()
        {
            global $config;
            $this->db = mysql_connect($config['db']['host'], $config['db']['user'], $config['db']['pass'])
            or die("база данных не доступна: " . mysql_error());
            mysql_query("SET character_set_results=utf8", $this->db);
            mysql_query("SET character_set_client=utf8", $this->db);
            mysql_query("SET character_set_connection=utf8", $this->db);
            mb_language('uni');
            mb_internal_encoding('UTF-8');
            mysql_select_db($config['db']['database'], $this->db);
            mysql_query("set names 'utf8'",$this->db);
        }
    
        function query($sql)
        {
            //$result = mysql_query($sql);
            //$this->result=$result;
            return mysql_query($sql);
        }
    
        function num_rows($res)
        {
            return @mysql_num_rows($res);
        }
    
        function fetch($res)
        {
            return @mysql_fetch_array($res, MYSQL_ASSOC);
        }
    
        function insert_id()
        {
            return @mysql_insert_id($this->db);
        }
    }
    
    
    if (!isset($_SESSION)) session_start();

    2015 год, есть PDO, есть фреймворки, есть компоненты и классы, но нет, этот идёт другим путём. И самое приятное - $_SESSION в файле класса.

    damir, 09 Июля 2015

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

    +144

    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
    $( document ).ready(function() {
          $(".doc_4").hover(function(){
            $(".Kiril").css("display","block");
            $(".beckzhan").css("display","none");
            $(".Sergey").css("display","none");
            $(".Asiya").css("display","none");
          });
          $(".doc_1").hover(function(){
            $(".beckzhan").css("display","block");
            $(".Kiril").css("display","none");
            $(".Sergey").css("display","none");
            $(".Asiya").css("display","none");
          });
          $(".doc_2").hover(function(){
            $(".Sergey").css("display","block");
            $(".beckzhan").css("display","none");
            $(".Kiril").css("display","none");
            $(".Asiya").css("display","none");
          });
          $(".doc_3").hover(function(){
            $(".Asiya").css("display","block");
            $(".beckzhan").css("display","none");
            $(".Sergey").css("display","none");
            $(".Kiril").css("display","none");
          });
        });

    Супер реализация.
    При наведении на объект он должен подсвечиваться, остальные тухнут.

    kschingiz, 07 Июля 2015

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