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

    В номинации:
    За время:
  2. Куча / Говнокод #13491

    +125

    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
    slowCallPattern (P: P: P: P: P: P: _) = (fsLit "stg_ap_pppppp", 6)
    slowCallPattern (P: P: P: P: P: _) = (fsLit "stg_ap_ppppp", 5)
    slowCallPattern (P: P: P: P: _) = (fsLit "stg_ap_pppp", 4)
    slowCallPattern (P: P: P: V: _) = (fsLit "stg_ap_pppv", 4)
    slowCallPattern (P: P: P: _) = (fsLit "stg_ap_ppp", 3)
    slowCallPattern (P: P: V: _) = (fsLit "stg_ap_ppv", 3)
    slowCallPattern (P: P: _) = (fsLit "stg_ap_pp", 2)
    slowCallPattern (P: V: _) = (fsLit "stg_ap_pv", 2)
    slowCallPattern (P: _) = (fsLit "stg_ap_p", 1)
    slowCallPattern (V: _) = (fsLit "stg_ap_v", 1)
    slowCallPattern (N: _) = (fsLit "stg_ap_n", 1)
    slowCallPattern (F: _) = (fsLit "stg_ap_f", 1)
    slowCallPattern (D: _) = (fsLit "stg_ap_d", 1)
    slowCallPattern (L: _) = (fsLit "stg_ap_l", 1)
    slowCallPattern (V16: _) = (fsLit "stg_ap_v16", 1)
    slowCallPattern [] = (fsLit "stg_ap_0", 0)

    Исходник GHC
    https://github.com/ghc/ghc/blob/master/compiler/codeGen/StgCmmArgRep.hs#L120

    j123123, 27 Июля 2013

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

    +5

    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
    template<class T>
    class E{};
    struct T
    {
        operator E<T>&()
          {static E<T> a; return a;}
          operator const E<T>&() const
          {static E<T> a; return a;}
            T(E<T>&){}
            T(){}
            
            private:
            T(T&);
    };
    int main() {
            T a;
        T b((T()));
        //T c((a));//Если расскомментировать эту строчку, то не скомпилируется, тк T(T&); в private.
            return 0;
    }

    Новая тема для размышлений в пользу убогости крестов:
    http://www.gamedev.ru/flame/forum/?id=178189
    http://ideone.com/ONQPBb

    LispGovno, 09 Июля 2013

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

    +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
    /**
     * Геноцид.
     */
    public function purgeProducts()
    {
    	$command = Yii::app()->db->createCommand();
    	
    	$command->truncateTable('tbl_catalogue_property_value');
    	$command->truncateTable('tbl_catalogue_property_value');
    	$command->truncateTable('tbl_catalogue_product_info');
    	$command->truncateTable('tbl_catalogue_product');
    	$command->truncateTable('tbl_products_to_features');
    	$command->truncateTable('tbl_catalogue_category_to_product');
    	$command->truncateTable('tbl_relation_material');
    }

    Геноцид.

    kukymbr, 09 Июля 2013

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

    +119

    1. 1
    border-color: #dadada #ebebeb #ebebeb #dadada;

    CSS. Встречено в проекте, разработчики с пост-совка :)

    Elvenfighter, 04 Июля 2013

    Комментарии (5)
  6. 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)
  7. 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)
  8. 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)
  9. C# / Говнокод #13170

    +104

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

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

    kore_sar, 14 Июня 2013

    Комментарии (5)
  10. 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)
  11. 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)