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

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

    −34

    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
    int ConditionsTuple(const bool Condition1, const bool Condition2)
    {
    	return (Condition1<<1) + Condition2;
    }
    
    template <bool Condition1, bool Condition2>
    struct TConditionsTuple
    {
    	enum {Result = (Condition1<<1) + Condition2};
    };
    
    float SignedIf(const bool Condition)
    {
    	return Condition ? -1 : 1;
    }
    
    switch (ConditionsTuple(
    					bExpr1,
    					bExpr2
    					))
    	{
    		case TConditionsTuple<1, 1>::Result:
    			return PArc(new TArc(
    							CouplePointAtPrimitive1,
    							CouplePointAtPrimitive2,
    							ArcCoupleCenter,
    							Abs(arcCoupleRadius)
    							));
    		case TConditionsTuple<0, 1>::Result:
    			throw TPrimitive1HalfLengthExpiredException();
    		case TConditionsTuple<1, 0>::Result:
    			throw TPrimitive2HalfLengthExpiredException();
    		case TConditionsTuple<0, 0>::Result:
    			throw TAllPrimitivesHalfLengthExpiredException();			
    	}

    Говногость, 04 Июня 2012

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

    +96

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    public bool IsStandart
    {
        get { return IsStandart; }
        set { IsStandart = value; }
    }

    Maps, 31 Мая 2012

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

    +155

    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
    var nav = document.getElementById('navigation');
    
    var properties = {
    	'display' : 'block',
    	'position' : 'fixed',
    	'top' : '5px',
    	'backgroundColor' : '#F2F0E3',
    	'opacity' : '.6',
            ........
            //Много всяких свойств
            ........
    	'border' : '2px solid #DDDDDD',
    	'borderRadius' : '1em',
    	'padding' : '5px',
    	'zIndex' : '1'
    }
    
    for (var i in properties) {
    	nav.style[i] = properties[i];
    }

    Послать бы автора на три буквы: CSS

    vistefan, 30 Мая 2012

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

    −40

    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
    /*
    	 * This GtkIMHtml has the maximum number of smileys allowed, so don't
    	 * add any more.  We do this for performance reasons, because smileys
    	 * are apparently pretty inefficient.  Hopefully we can remove this
    	 * restriction when we're using a better HTML widget.
    	 */
    	unescaped = purple_unescape_html(smiley);
    	numsmileys_thismsg = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(imhtml), "gtkimhtml_numsmileys_thismsg"));
    	if (numsmileys_thismsg >= 30) {
    		gtk_text_buffer_insert(imhtml->text_buffer, iter, unescaped, -1);
    		g_free(unescaped);
    		return;
    	}
    	numsmileys_total = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(imhtml), "gtkimhtml_numsmileys_total"));
    	if (numsmileys_total >= 300) {
    		gtk_text_buffer_insert(imhtml->text_buffer, iter, unescaped, -1);
    		g_free(unescaped);
    		return;
    	}

    Вот такой прикол от Pidgin. Больше 30 смайлов в сообщении и 300 в диалоге - низя. Захардкодили, ибо стыдно, что тормозит. А оно действительно тормозит.

    g0rky, 29 Мая 2012

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

    +88

    1. 1
    2. 2
    Посоны, Я думал, что то, что вы здесь выкладываете - это выдумки и неправда. 
    Теперь Я работаю в команде...

    nolka4, 28 Мая 2012

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

    +78

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    /*при всем этом работает как часы*/
    ...
    foreach ($array as $k=>$v) {
        $k++
        if ($k==300) {
            die ('выходим потому что 5');
        }
    ...

    маленькая часть большого парсера

    maslenkov, 17 Мая 2012

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

    +62

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if($col == "#eeeeee"){
    $col = "#ffffff";
    }else{
    $col = "#eeeeee";
    }

    Нашел на просторах интернета скрипт, а в нем вот это. $col нигде не присваивается.

    mxst, 15 Мая 2012

    Комментарии (9)
  9. Си / Говнокод #10235

    +116

    1. 1
    2. 2
    3. 3
    short lPort = atoi(szTemp);
    if (lPort <= 0 || lPort > 65535)
    	lPort = 80;

    absolut, 10 Мая 2012

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

    −24

    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
    map<HANDLE,VRwnd*> windows;
    LRESULT WndProc(HANDLE h,UINT ui,WPARAM w,LPARAM m)try{
             return windows.at(h)->Process(ui,w,l);
    }catch(...){ return 0;}
    class VRwnd{
        HANDLE h;
    protected:
        map<UINT,function<LPRESULT(WPARAM,LPARAM)> handlers;// заполняется в конструкторе
        map<int,VRwnd*> idChilds;
        map<HANDLE,VRwnd*> Childs;
    public:
    
         virtual ~VRwnd();
         LRESULT Process(UINT ui,WPARAM w,LPARAM m)try{
                    PreProcess(w,l);// сами решайте, давать фильтру на что-то влиять, или нет.
                    if(ui==WM_NOTIFY) return WmNotify(w,m) ;
                    if(ui==WM_NOTIFY) return WmCommand(w,m) ;
                   return handlers.at(ui).second(w,l);
         }
          catch(...){return 0;}
          LPRESULT WmNotify(WPARAM w,LPARAM m){...}
          LPRESULT WmCommand(WPARAM w,LPARAM m){...}
          virtual LPRESULT PreProcess(WPARAM w,LPARAM m){return 0;}
    };

    HaskellGovno, 09 Мая 2012

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

    +76

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    $sizes = array(50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200);
    foreach ($sizes as $v2)
    {
        $file3 = $file1."-".$v2."x".$v2.".".$ext;
        if(file_exists($file3)) unlink($file3);
        $c = "convert $file2 -resize ".$v2."x".$v2." -quality 80 -strip $file3";
        $last_line = system($c, $retval);
        chmod($file3, 0777);
    }

    Мне одному кажется, что порождать пару десятков процессов из php скрипта при загрузке небольшой картинки немного... толсто?

    roman-kashitsyn, 09 Мая 2012

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