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

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

    −169

    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
    // Функция возвращает округленное значение общего количества продуктов питания.
    // 
    // Параметры:
    //	Число - число, которое необходимо округлить.
    //	Порядок - число, порядок округления.
    
    Функция УППБУ_Округлить(Число, ПорядокОкругления) Экспорт
    	
    	Порядок = Число(Строка(ПорядокОкругления));
    	
    	..........
    	
    КонецФункции

    Тиражное решение от одного из партнеров...

    HomoAlbus, 02 Июля 2013

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

    +153

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    /**
             * you known..
             * here you find great music: http://www.youtube.com/watch?v=0lTKErnmmoA
             *
             * good, yeah? :)
             *
             */
    
            $controller = self::call($controllerName);
            $controller->preLoad();
            $controller->runBefore();

    deep, 01 Июля 2013

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

    +20

    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
    #include <iostream>
    
    enum Quiet { LOG };
    
    template<typename T>
    Quiet operator <<(Quiet o, T) {
        return o;
    }
    
    static inline Quiet operator <<(Quiet o, std::ostream &(*)(std::ostream &)) {
        return o;
    }
    
    int main() {
        LOG << "Hello world!" << std::endl;
        return 0;
    }

    Измыслил сегодня вот такую вот затычку для выключения логгирования

    uranix, 20 Июня 2013

    Комментарии (5)
  5. C# / Говнокод #13170

    +104

    1. 1
    2. 2
    || Request.UserAgent.ToLower().Contains("WindowsPhone")
                    || Request.UserAgent.ToLower().Contains("LG"))

    Пытаемся определить с мобильного ли устройства заходим на сайт. :)

    kore_sar, 14 Июня 2013

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

    +130

    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
    public ICommand StartCommand
    {
        get
        {
            if (this.startCommand == null)
            {
                this.startCommand = new DelegateCommand(() =>
                {
                    Thread t = new Thread(StartServer);
                    t.Start();
                });
            }
    
            return this.startCommand;
        }
    }
    
    public ICommand EndCommand
    {
        get
        {
            if (this.endCommand == null)
            {
                this.endCommand = new DelegateCommand(() =>
                {
                    Thread t = new Thread(EndServer);
                    t.Abort();
                });
            }
    
            return this.startCommand;
        }
    }

    Команды для кнопочек запуска и остановки сервера

    NeoN, 11 Июня 2013

    Комментарии (5)
  7. SQL / Говнокод #13151

    −166

    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
    SELECT DISTINCT d.ageing as predicateid,
    		CONCAT(
    			TRIM(
    				TRIM(TRAILING "года" FROM 
    					TRIM(TRAILING "лет" FROM 
    						REPLACE(
    							REPLACE(
    								REPLACE(
    									REPLACE(
    										REPLACE(
    											REPLACE(
    												REPLACE(d.ageing, "не более ", "lte"), 
    											"не менее ","gte"),
    										"более ", "gt"),
    									"от ", "gt"),
    								"до ", "lt"),
    							"около ", "ab"), 
    						"менее ", "lt")
    					)
    				)
    			), 
    		"ag")  as nodecode, ...

    DIX315, 11 Июня 2013

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

    +133

    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
    64. 64
    65. 65
    66. 66
    if (SellMenuEnable)
    {
    	GUI.Box (new Rect (Screen.width/2 - 200, Screen.height/2 - 300, 400, 480),"");
    	if (GUI.Button (new Rect (Screen.width/2 + 180, Screen.height/2 - 300, 20, 20), "X" ))
    	{
    		SellMenuEnable = false;
    	}
    	// ШМОТКИ слево
    	if (SLOT1)
    	{
    		GUI.Box (new Rect (Screen.width/2 - 170, Screen.height/2 - 270, 160, 50),"1");
    	}
    	if (SLOT3)
    	{
    		GUI.Box (new Rect (Screen.width/2 - 170, Screen.height/2 - 210, 160, 50),"3");
    	}
    	if (SLOT5)
    	{
    		GUI.Box (new Rect (Screen.width/2 - 170, Screen.height/2 - 150, 160, 50),"5");
    	}
    	if (SLOT7)
    	{
    		GUI.Box (new Rect (Screen.width/2 - 170, Screen.height/2 - 90, 160, 50),"7");
    	}
    	if (SLOT9)
    	{
    		GUI.Box (new Rect (Screen.width/2 - 170, Screen.height/2 - 30, 160, 50),"9");
    	}
    	if (SLOT11)
    	{
    		GUI.Box (new Rect (Screen.width/2 - 170, Screen.height/2 + 30, 160, 50),"11");
    	}
    	if (SLOT13)
    	{
    		GUI.Box (new Rect (Screen.width/2 - 170, Screen.height/2 + 90, 160, 50),"13");
    	}
    	// ШМОТКИ с права
    	if (SLOT2)
    	{
    		GUI.Box (new Rect (Screen.width/2 + 10, Screen.height/2 - 270, 160, 50),"2");
    	}
    	if (SLOT4)
    	{
    		GUI.Box (new Rect (Screen.width/2 + 10, Screen.height/2 - 210, 160, 50),"4");
    	}
    	if (SLOT6)
    	{
    		GUI.Box (new Rect (Screen.width/2 + 10, Screen.height/2 - 150, 160, 50),"6");
    	}
    	if (SLOT8)
    	{
    		GUI.Box (new Rect (Screen.width/2 + 10, Screen.height/2 - 90, 160, 50),"8");
    	}
    	if (SLOT10)
    	{
    		GUI.Box (new Rect (Screen.width/2 + 10, Screen.height/2 - 30, 160, 50),"10");
    	}
    	if (SLOT12)
    	{
    		GUI.Box (new Rect (Screen.width/2 + 10, Screen.height/2 + 30, 160, 50),"12");
    	}
    	if (SLOT14)
    	{
    		GUI.Box (new Rect (Screen.width/2 + 10, Screen.height/2 + 90, 160, 50),"14");
    	}
    }

    http://unity3d.ru/distribution/viewtopic.php?f=105&t=16515

    kostoprav, 10 Июня 2013

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

    +69

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    public static String generateName(String baseName, int length) {
        if (length < 1) {
            length = Math.abs(length);
        }
        if(length == 0){
            length = 1;
        }
        if (length > 36) {
            length = length % 36;
        }
        return baseName + "_" + UUID.randomUUID().toString().substring(0, length).replaceAll("[-]", "");
    }

    Должна была быть генерация строки заданной общей длины с пятизначным хешем в конце.

    Actine, 06 Июня 2013

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

    +132

    1. 1
    int count = _repository.GetObjectList().Select(x => x).Where(x => x.Id > 4).Count();

    Sql style

    neeedle, 04 Июня 2013

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

    +150

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if (isset($_trade) && $_trade == 'wholesale') {
    	header('Location: /market/order/');
    	exit;
    }
    else {
    	header('Location: /market/order/');
    	exit;
    }

    Нашел в коде магазина

    Tek, 30 Мая 2013

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