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

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

    +147

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    ...
    char det(char a[4][4])
    { float det;
    det=a[0][0]*(a[1][1]*(a[2][2]*a[3][3]-a[3][2]*a[2][3])-a[1][2]*(a[2][1]*a[3][3]-a[2][3]*a[3][1])+a[1][3]*(a[2][1]*a[3][2]-a[2][2]*a[3][1]))
    -a[0][1]*(-a[1][0]*(a[2][2]*a[3][3]-a[3][2]*a[2][3])-a[1][2]*(a[2][0]*a[3][3]-a[3][0]*a[2][3])+a[1][3]*(a[2][0]*a[3][2]-a[3][0]*a[2][2]))
    +a[0][2]*(-a[1][0]*(a[2][1]*a[3][3]-a[3][1]*a[2][3])+a[1][1]*(a[2][0]*a[3][3]-a[3][0]*a[2][3])+a[1][3]*(a[2][0]*a[3][1]-a[2][1]*a[3][0]))
    -a[0][3]*(-a[1][0]*(a[2][1]*a[3][2]-a[3][1]*a[2][2])+a[1][1]*(a[2][0]*a[3][2]-a[3][0]*a[2][2])-a[1][2]*(a[2][0]*a[3][1]-a[3][0]*a[2][1]));
    return(det);
    }; 
    ...

    http://otvet.mail.ru/question/59918103/

    1_and_0, 23 Июня 2011

    Комментарии (39)
  3. PHP / Говнокод #7011

    +147

    1. 1
    2. 2
    3. 3
    if ($a = 1) {
    	...бла-бла-бла
    }

    nislova, 20 Июня 2011

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

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    char c;
    cin>>c;
    if (c == 'a') cout<<'a';
    if (c == 'b') cout<<'b';
    if (c == 'c') cout<<'c';
    //....
    if (c == 'z') cout<<'z';

    классика

    skim1776, 19 Июня 2011

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

    +147

    1. 1
    2. 2
    3. 3
    if(entry.getName().equals("back.jpg"));{
    
    }

    просто смешная (но с последствиями) опечатка

    Lure Of Chaos, 16 Июня 2011

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

    +147

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    function timesec($str) 
    { 
    $h = date("H", strtotime($str)); 
    $i = date("i", strtotime($str)); 
    $s = date("s", strtotime($str)); 
    $m = date("m", strtotime($str)); 
    $d = date("d", strtotime($str)); 
    $y = date("Y", strtotime($str)); 
    return mktime($h, $i, $s, $m, $d, $y); 
    }

    GoodTalkBot, 10 Июня 2011

    Комментарии (10)
  7. Java / Говнокод #6907

    +147

    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
    Query query = entityManager.createNativeQuery(
                            "select * from ("
                                    + "select g4.id as goodId, g4.name as goodName, g4.code as goodCode, "
                                    + "u4.name as uomName, sum(bgd.quantity_out) as quantityOut, "
                                    + " g4.productcode as goodProductCode, sum(bgd.quantity_return) as quantityReturn "
                                    + "from good g4 "
                                    + "inner join consignment cs1 on cs1.good_id = g4.id "
                                    + (customizationUtilSQL == null ? "" : customizationUtilSQL.buildCustomAttributesQueryInnerPart())
                                    + " inner join "
                                    + "(select gg.consignment_id, op.sourcestore_id as place_id, " +
                                    		" sum(gg.quantity) as quantity_out, sum(coalesce(srset.return_quantity, 0)) as quantity_return "
                                    + "from motion gg "
                                    + "inner join operation op " +
                                    		" on (gg.operation_id = op.id " +
                                    		" and op.company = gg.company" +
                                            (projectId == null ? "" : " and (op.project_id  = :projectId) ") +
                                            (contractId == null ? "" : " and (op.contract_id  = :contractId) ") +
                                    		") "
                                    + "inner join place pld on op.sourcestore_id = pld.id "
                            		+ " left outer join "
                    				+ " (select ds.demand_id as demand_id, srm.consignment_id as consignment_id, srm.sum as sum, " +
                    						" sum(srm.quantity) as return_quantity from demand_salesreturn ds " +
                    						" inner join operation sr on sr.id = ds.salesreturn_id " +
                    						" inner join motion srm on srm.operation_id = sr.id " +
                    						" where sr.dtype = 'SalesReturn' " +
                                            " and sr.deleted is null " +
                                            (!includeAboardOperations ? " and sr.applicable = true " : "") +
                                            " and (sr.moment between :upToDate and :toDate) " +
                                            " and " + SecurityUtil.companyFilterSQL("sr") +
                    						" group by ds.demand_id, srm.consignment_id, srm.sum) srset " +
                    						" on (srset.demand_id = op.id and srset.sum = gg.sum " +
                    						" and srset.consignment_id = gg.consignment_id) "
                                    + (agentId == null ? "" :
                                        " left outer join requisite tr on op.targetagentrequisite_id = tr.id "
                                        + " left outer join requisite sr on op.sourceagentrequisite_id = sr.id "
                                        + " left outer join agent agt on tr.agent_id = agt.id "
                                		+ " left outer join agent ags on sr.agent_id = ags.id ")
                                    + "where " + SecurityUtil.companyFilterSQL("op")
                                    + " and op.deleted is null "
                                    + (!includeAboardOperations ? " and op.applicable = true " : "")
                                    + " and (op.moment between :upToDate and :toDate) "
                                    + " and op.dtype = 'Demand' "
                                    + (agentId == null ? ""
                                        : " and ((ags.path || ags.id) like ( "
                                            + "select distinct (a21.path || a21.id || '%') from agent a21  where a21.id = :agentId) or "

    всё не влезло, вообще тут 65 строк. пожалуйста выскажите ваше мнение об этом коде. спасибо :)

    ab368, 09 Июня 2011

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

    +147

    1. 1
    $APPLICATION->SetTitle('Хуй на рыло, чтоб душа не ныла');

    код скриптов админ-панели, взято с продакшена

    elw00d, 08 Июня 2011

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

    +147

    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
    <?php
    $this->phptal->id=$id;
    $this->phptal->returnid=$returnid;
    
    if(isset($params['catalogue']))
    {
    	if(isset($params['category']))
    	{
    		if(isset($params['news']))
    		{
    			$nid=(int)$params['news'];
    			require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventNewsDAO.php'));
    			$nldao=new EventNewsDAO($this);
    			$this->phptal->newsline=$nldao->get($nid);
    			echo $this->ProcessTalTemplate('admin/admin_newsline.tal.tpl');
    		}
    		else
    		{
    			$cid=(int)$params['catalogue'];
    			require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventCatalogueDAO.php'));
    			$cdao=new EventCatalogueDAO($this);
    			$this->phptal->catalogue=$cdao->get($cid);
    			require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventCategoryDAO.php'));
    			$ccdao=new EventCategoryDAO($this);
    			$this->phptal->categories=$ccdao->all($cid);
    
    			$ccid=(int)$params['category'];
    			$this->phptal->category=$ccdao->get($ccid);
    			require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventNewsDAO.php'));
    			$ndao=new EventNewsDAO($this);
    			$this->phptal->news=$ndao->all($ccid);
    			echo $this->ProcessTalTemplate('admin/admin_news.tal.tpl');
    		}
    	}
    	else
    	{
    		$cid=(int)$params['catalogue'];
    		require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventCatalogueDAO.php'));
    		$cdao=new EventCatalogueDAO($this);
    		$this->phptal->catalogue=$cdao->get($cid);
    		require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventCategoryDAO.php'));
    		$ccdao=new EventCategoryDAO($this);
    		$this->phptal->categories=$ccdao->all($cid);
    		echo $this->ProcessTalTemplate('admin/admin_categories.tal.tpl');
    	}
    }
    else
    {
    	require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventCatalogueDAO.php'));
    	$cdao=new EventCatalogueDAO($this);
    	$this->phptal->catalogues=$cdao->all();
    	echo $this->ProcessTalTemplate('admin/admin_catalogues.tal.tpl');
    }

    я молодец. наговнокодил как школьник.
    ветвистое ветвление + жуткая копипаста.
    буду это рефакторить, когда в целом закончу базовую функциональность.

    Lure Of Chaos, 04 Июня 2011

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

    +147

    1. 1
    2. 2
    GOVNOREGER© для govnokod.ru
    http://slil.ru/31180342

    15d980da30374a8f, 02 Июня 2011

    Комментарии (5)
  11. Java / Говнокод #6790

    +147

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    public void assert(boolean t)
        {
            if(!t)
            {
                throw new Error();
            } else
            {
                return;
            }
        }

    Lure Of Chaos, 30 Мая 2011

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