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

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

    −176

    1. 1
    SELECT DISTINCT(sid) FROM

    sid - уникальное значение(PK)

    ferry-very-good, 13 Сентября 2010

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

    +166

    1. 1
    $need	= explode(',', 'name,phone');

    Оригинальный способ создания массивов

    netrain, 07 Сентября 2010

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

    +126

    1. 1
    2. 2
    3. 3
    4. 4
    <div id="search"><form action="http://youex.ru/search" method="post"><button name="send" type="submit" ><img src="/skins/default/design/img/img_space.gif" alt=""/></button><input name="type_send"value="Поиск......................................................................." onfocus="if (this.value=='Поиск.......................................................................') this.value='';" onblur="if (this.value==''){this.value='Поиск.......................................................................'}"/></form></div>
    
    
    <!--/* взято с сайта  http://youex.ru/  */-->

    http://govnokod.ru/4160 - смотри...
    уж больно показалось что аффтор кода уснул...

    istem, 03 Сентября 2010

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

    +95

    1. 1
    2. 2
    3. 3
    4. 4
    result = result == 0 ? tempResult
                            : (tempResult == 0 ? result
                            : (result == tempResult ? result : result
                            * tempResult));

    utinger, 02 Сентября 2010

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

    +164

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    <?php
    $Data = array(images => ImgPathHttp);
    if ($level[$cn][good][$cg][news] || true) {
    	$Data[link_img] = "<a class=\"Size11item\" href=\"" . $App->GetURLWww(array(c => $level[$cn][id_cat], pid => $level[$cn][good][$cg][id_good], show_product => $show_product)) . "\" title=\"" . $level[$cn][good][$cg][model] . "\">";
    	$Data[link_img_end] = "</a>";
    } else {
    	$Data[link_img] = "<font class=red>";
    	$Data[link_img_end] = "</font>";
    }

    Требуется заменить шаблон на сайте.
    Переплёты PHP, HTML, SMARTY.
    Фаил "/includes/inc/item.inc.php".
    КАЗНИТЬ НЕЛЬЗЯ ПОМИЛОВАТЬ.

    doremidon, 31 Августа 2010

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

    +157

    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
    //               
                       // <?php if (!Yii::app()->user->checkAccess('partner')) { ?>
    
                            a+='<td'+cl+'>'+msg['keywords'][i][mord] + '</td>';
    
                       // <?php } ?>
    
                            //'</strong></td><td'+cl+'>'+currentMordCost+
                            a+='<td'+cl+'>'+(msg['keywords'][i]['costM'])
                            +'</td>'+
                            '<td'+cl+'>'+$.getTiming(msg['domainTrust'], msg['keywords'][i][mord]) + '</td>' +
                            '<td'+cl+'><img class="info" src=\"/images/information.png\" alt=\"'+i+'\" id=\"'+i+'\" > <B>' +msg['keywords'][i]['notice']+'</B></td></tr>';
                            msg['keywords'][i]['domainTrust'] = msg['domainTrust'];
                            hints[i]=jQuery.getHint(msg['keywords'][i]);
                            if (msg['keywords'][i]['bad']==true)
                                badCount++;
                            //mordNestedCost = mord/2 / msg['keywords'][i]['nested'].length;
    
                            //costMNested=(msg['keywords'][i]['costM']) / 2 / msg['keywords'][i]['nested'].length;
                            //if (halfMord == "-")
                            //	mordNestedCost = costMNested = "-";
                                mod='';modA='';
                            for (k=0;k<msg['keywords'][i]['nested'].length;k++)
                            {
    
                                if (k==parseInt(msg['keywords'][i]['up']))
                                    {
                                        mod  = '<span style="color:#626262;font-weight:bold;">';
                                        modA = '<\/span>';
                                    }
                                    if (msg['keywords'][i]['nested'][k]['freq'] <= 50 && msg['keywords'][i]['nested'][k]['mordCost'] >= 1)
                                            {
                                    msg['keywords'][i]['nested'][k]['notice'] += " <BR><span style='color:red'>Возможно посчитано неверно!</span>";
                                    hasCriticalErrors = true;
                                            }
                                a+= '<tr><td'+cl+'>' + mod + '    '+(msg['keywords'][i]['nested'][k]['title'])+ modA +
                                '</td>';
    
                            // // <?php if (!Yii::app()->user->checkAccess('partner')) { ?>
    
                                a+='<td'+cl+'>'+(msg['keywords'][i]['nested'][k][mord])+'</td>';
    
                            // <?php } ?>
    
                                a+='<td'+cl+'>'+
                                //'</td><td'+cl+'>'+currentNestedMordCost+'</td><td'+cl+'>'+
                                (msg['keywords'][i]['nested'][k]['costM'])+'</td>'+
                                    '<td'+cl+'>'+$.getTiming(msg['domainTrust'], msg['keywords'][i]['nested'][k][mord]) + '</td>' +
                                    '<td'+cl+'>'+'<img class="info" src=\"/images/information.png\" alt=\"info_'+i+'_'+k+'\" id=\"'+i+'_'+k+'\" >'+' <B>'+msg['keywords'][i]['nested'][k]['notice']+'</B></td></tr>';
                                msg['keywords'][i]['nested'][k]['domainTrust'] = msg['domainTrust'];
                                hints[i+'_'+k]=jQuery.getHint(msg['keywords'][i]['nested'][k]);
                                if (msg['keywords'][i]['nested']['bad'] == true)
                                    badCount++;
    
    
    
    
                            }

    Как вам такая каша из яваскрипта, пхп и хтмл?

    user654321, 31 Августа 2010

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

    +144

    1. 1
    2. 2
    3. 3
    int main(){
    func(z(c(v(b(n(m(a(s(d(f(g())))))))))));\\и так далее
    }

    Это не совсем оригинал, но смысл тот же. Писал мой знакомый...
    m,z,c... это все функции, которые отдают значения.
    Конечно это лишь прикол, но логика рушится быстро...

    hromjo, 25 Августа 2010

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

    +168

    1. 1
    2. 2
    3. 3
    if (isAdmin($user)) {echo "<a href=/admin.php>Администрирование</a>";}
    
       else echo "хуй! ";

    логинизация на сайте продакшн:)

    moonie, 21 Августа 2010

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

    +142

    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
    void InitializeComponent()
            {
                ResizeRedraw = true;
                this.Paint += new PaintEventHandler(Do);
            }
    
            void Do(object sender, PaintEventArgs e)
            {
                object[] ob = { e.Graphics };
                new Thread(Update).Start(ob);
            }
    
            void Update(Graphics e)
            {
                PointF[] pp = new PointF[this.Width];
    
                for (int i = 0; i < this.Width; i++)
                {
                    pp[i].X = i;
                    pp[i].Y = this.Height / 2;
                }
    
                e.DrawCurve(new Pen(Color.Black, 3), pp);
            }

    sergylens, 16 Августа 2010

    Комментарии (15)
  11. C++ / Говнокод #3973

    +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
    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
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    typedef unsigned char byte;
    
    byte masks[] =
    {
    	0,
    	0x1,
    	0x3,
    	0x7,
    	0xF,
    	0x1F,
    	0x3F,
    	0x7F,
    	0xFF
    };
    
    class RegionBool
    {
    public:
    	RegionBool(unsigned int width, unsigned int height) : w_(width), h_(height), arr_(0), lineLenBytes_(0)
    	{
    		double lineLenBytes = 0;	// байт на строку
    		byte strLenAddBits = static_cast<byte>(modf(static_cast<double>(w_) / 8, &lineLenBytes) * 8);
    		lineLenBytes_ = static_cast<long>(lineLenBytes) + ((strLenAddBits > 0) ? 1 : 0);
    
    		long bytes = lineLenBytes_ * h_;
    		arr_ = new byte[bytes];
    		memset(arr_, 0, bytes);
    	}
    
    	virtual ~RegionBool()
    	{
    		delete[] arr_;
    	}
    
    	inline byte* createLineMask(int x, int w)
    	{
    		// Hey! Attention, animal! Me is you. Listen: you can replace "masks[i]" with "(0xFF >> (8-i))". ХЗ, хав ит фастер.
    
    		byte* mask = new byte[lineLenBytes_];
    		memset(mask, 0, lineLenBytes_);
    
    		double skipBytes = 0;
    		byte startSkipBits = static_cast<byte>(modf(static_cast<double>(x) / 8, &skipBytes) * 8);
    		byte* pmask = mask + static_cast<int>(skipBytes);
    
    
    		byte before = (startSkipBits) ? (8 - startSkipBits) : 0;
    		if (before > w)
    			*pmask |= (masks[w] << startSkipBits);
    		else
    		{
    			if (before)
    				*pmask++ |= (masks[before] << startSkipBits);
    
    			double fillBytes = 0;
    			byte after = static_cast<byte>(modf(static_cast<double>(w - before) / 8, &fillBytes) * 8);
    			
    			if (fillBytes)
    			{
    				memset(pmask, 0xFF, static_cast<int>(fillBytes));
    				pmask += static_cast<int>(fillBytes);
    			}
    
    			if (after)
    				*pmask |= masks[after];
    		}
    
    		return mask;
    	}
    
    	virtual void OR(int x, int y, unsigned int w, unsigned int h)
    	{
    		byte* mask = createLineMask(x,w);
    
    		unsigned int lim = y + h;
    		byte* cur = arr_ + (y * lineLenBytes_);
    		for (unsigned int ty = y; ty < lim; ty++)
    		{
    			byte* m = mask;
    			for (int i = 0; i < lineLenBytes_; i++)
    				*cur++ |= *m++;
    		}
    		delete[] mask;
    	}
    
    private:
    	long lineLenBytes_;
    	unsigned int w_;
    	unsigned int h_;
    	unsigned char* arr_;
    };

    Простите, что много букв.
    Подобие региона, в котором пиксель представлен битом. Операции предполагаются только с прямоугольниками, подразумевается, что прямоугольники вмещаются в регион.
    Рассказывайте мне про меня))

    Altravert, 13 Августа 2010

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