1. PHP / Говнокод #11502

    +46

    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
    public function getAddressInfo($address) {
    		if (!$address instanceof SalesOrderAddressShipping) return '';
    		
    		$country = $address->getCountry();
    		$region = $address->getRegion();
    		$city = $address->getCity();
    		$zipCode = $address->getZipCode();
    		$street = $address->getStreet();
    		$houseNumber = $address->getHouseNumber();
    		$building = $address->getBuilding();
    		$appartment = $address->getAppartment();
    
    		$addressInfo = '';
    		$addressInfo .= $city . ', ' . $street . ' ' . $houseNumber;
    		$addressInfo .= !empty($building) ? ', корп. ' . $building : '';
    		$addressInfo .= !empty($appartment) ? ', кв. ' . $appartment : '';
    
    		return $addressInfo;
    	}
    
    	public function getAddressInfoWithoutApartment($address) {
    		if (!$address instanceof SalesOrderAddressShipping) return '';
    
    		$country = $address->getCountry();
    		$region = $address->getRegion();
    		$city = $address->getCity();
    		$zipCode = $address->getZipCode();
    		$street = $address->getStreet();
    		$houseNumber = $address->getHouseNumber();
    		$building = $address->getBuilding();
    		$appartment = $address->getAppartment();
    
    		$addressInfo = '';
    		$addressInfo .= $city . ', ' . $street . ' ' . $houseNumber;
    		$addressInfo .= !empty($building) ? ', корп. ' . $building : '';
    		//$addressInfo .= !empty($appartment) ? ', кв. ' . $appartment : '';
    
    		return $addressInfo;
    	}

    а сам класс называется AdminOrderListContentView, ебиеговрот....

    SET, 31 Июля 2012

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

    +51

    1. 1
    AdminOrderListContentView::getAddressInfoWithoutApartment()

    Одна строчка кода но как много в ней...

    SET, 30 Июля 2012

    Комментарии (36)
  3. Java / Говнокод #11498

    +62

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    public synchronized void changePassword(String password, int id){
    		try {
    			Connection conn = Db.getInstance().createConnection();
    			Statement stmt = conn.createStatement();
    			String sql = "UPDATE "+tableName+"SET `password` ='"+password+"' WHERE `userId` ="+id+"";
    			stmt.executeUpdate(sql);
    		}
    		catch(Exception ex){
    			Logger.writeToFile("Exception occured " + ex.toString());
    		}
    	}

    Типичная лаба

    qsort, 30 Июля 2012

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

    +71

    1. 1
    2. 2
    3. 3
    4. 4
    function __destruct(){
    		$sql = "DELETE FROM Basket";
    		mysql_query($sql);
    	}

    Удаление товаров из корзины в интернет магазине.

    BrdNLSrg, 30 Июля 2012

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

    +154

    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
    function reNumberAreas(parent)
    {
     for (i=0;i<parent.childNodes.length;i++)
     {
      try
      {
       parent.childNodes[i].firstChild.firstChild.firstChild.firstChild.id = cutNumber(parent.childNodes[0].firstChild.firstChild.firstChild.firstChild.id) + i;
       parent.childNodes[i].firstChild.firstChild.firstChild.firstChild.nextSibling.nextSibling.id = parent.childNodes[i].firstChild.firstChild.firstChild.firstChild.id + "_text";
       parent.childNodes[i].firstChild.firstChild.firstChild.firstChild.nextSibling.nextSibling.nextSibling.src = parent.childNodes[i].firstChild.firstChild.firstChild.firstChild.nextSibling.nextSibling.nextSibling.src.replace(/index=\d+/g,"index=" + i);
      }
      catch (e)
      {
      }
     }
    }

    Форматирование кода сохранено для придания драматичности.

    Areks, 30 Июля 2012

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

    +2

    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
    auto addition = [] (double a, double b) { return a + b; };
    
    auto substruction = [] (double a, double b) { return a - b; };
    
    auto divide = [] (double a, double b) { return a / b; };
    
    auto multiplie = [] (double a, double b) { return a * b; };
    
    typedef std::function<double (double, double)> DoubleFunc;
    
    int main()
    {
        std::vector<DoubleFunc> funcVector;
    
        funcVector.push_back(addition);
        funcVector.push_back(substruction);
        funcVector.push_back(multiplie);
        funcVector.push_back(divide);
    
        std::for_each(funcVector.begin(), funcVector.end(), []
        (DoubleFunc func)
        {
            std::cout << func(3.14159, 100500) << std::endl;
        });
    
        system("pause");
        return 0;
    }

    А ваш язык такое сможет:)? (я о delphi, java, etc.)
    Кстати, если писать все в таком духе, то параллелиться прога будет безболезненно:), правда это уже какой-то хацкель/лисп...

    suc-daniil, 30 Июля 2012

    Комментарии (134)
  7. Куча / Говнокод #11493

    +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
    Уважаемые пользователи ресурса Говнокод.ру.
    
    В связи с повышением процента неадекватных участников и по этой причине участившимися ЧП.
    А также регулярным нарушением правил оными, сообщаю, что проводится расширение дружного модераторского коллектива.
    Посредством набора новых добровольцев-модераторов.
    
    Получив права модератора Вы сможете:
    - банить неугодных вам пользователей
    - закрывать неудобные для вас темы
    - выигрывать в спорах, если аргументы закончились - достаточно просто зайти под модератором и забанить оппонента (например за троллинг)
    
    Чтобы обеспечить анонимность Вам будут выданы спец. аккаунты. 
    Для обусждения вашей кандидатуры пишите мне на e-mail [email protected] или в личку.

    Модератор

    moderator, 29 Июля 2012

    Комментарии (13)
  8. ActionScript / Говнокод #11492

    −111

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    lv.onData = function(data:String):Void{
      htmlData = data;
      
      xml.parseXML(htmlData);
      trace(xml.firstChild.lastChild.firstChild.lastChild.lastChild.lastChild.childNodes[1].childNodes[1].childNodes[0]);
      trace(xml.firstChild.lastChild.firstChild.lastChild.lastChild.lastChild.childNodes[1].childNodes[2].childNodes[1].firstChild);
    }

    С демиарта.

    kyzi007, 29 Июля 2012

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

    +81

    1. 1
    2. 2
    3. 3
    if (uf.getPath().contains("d:/test.java/uploads/")) {
       uf.setPath(uf.getPath().replace("d:/test.java/uploads/", this.uploadPath));
    }

    хуита, 29 Июля 2012

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

    +79

    1. 1
    String url = m_launchUrl.replaceAll(" ", "%20");

    Percent-encode по-Адобовски.

    http://svn.apache.org/repos/asf/incubator/flex/trunk/modules/debugger/src/java/flash/tools/debugger/concrete/PlayerSession.java

    wvxvw, 29 Июля 2012

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