1. C++ / Говнокод #10120

    +25

    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
    /*
        Шаг по оси, представляет собой число из следующего ряда:
        ... 0.02 0.05 0.1 0.2 0.5 1 2 5 ...
        next и prev позволяют перемещаться в обе стороны по ряду
        после создания хранится число 1
    */
    class Step
    {
    public:
        Step()
        {
            scale = 1; pr = 1; type=0;
        }
        void next()
        {
            // шаг вперед
            type++;
            if (type==1)
                scale = pr * 2;
            else if (type==2)
                scale = pr * 5;
            else
            {
                type = 0;
                pr *= 10;
                scale = pr;
            }
        }
        void prev()
        {
            // шаг назад
            type--;
            if (type==0)
                scale = pr;
            else if (type==1)
                scale = pr*2;
            else
            {
                type = 2;
                pr /= 10;
                scale = pr*5;
            }
        }
        operator float()
        {
            return scale;
        }
    protected:
        float scale;    // текущее значение
        float pr;       // недомноженое значение 1 10 100 ...
        int type;       // 0 - x1 1 - x2 2 - x5
    };

    http://govnokod.ru/10117 напомнил о том, как я когда-то рисовал график, и для меток на осях потребовались те же самые красивые значения [... 0.1 0.2 0.5 1 2 5 ...]

    bormand, 30 Апреля 2012

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

    +154

    1. 1
    2. 2
    this.ie = (name=="ie" && this.v>=4)
    this.activeX = ( this.ie ) ? true : false;

    Кусочек шедевра
    https://github.com/miketaylr/Snort/blob/master/snort.yml

    kindofbear, 30 Апреля 2012

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

    −282

    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
    NSArray *beautifulValues = [[NSArray alloc] initWithObjects:
                                    [NSNumber numberWithFloat:0.00001], 
                                    [NSNumber numberWithFloat:0.00005], 
                                    [NSNumber numberWithFloat:0.0001],
                                    [NSNumber numberWithFloat:0.005],
                                    [NSNumber numberWithFloat:0.001],
                                    [NSNumber numberWithFloat:0.005],
                                    [NSNumber numberWithFloat:0.01],
                                    [NSNumber numberWithFloat:0.05], 
                                    [NSNumber numberWithFloat:0.1],
                                    [NSNumber numberWithFloat:0.5],
                                    [NSNumber numberWithFloat:1],
                                    [NSNumber numberWithFloat:5],
                                    [NSNumber numberWithFloat:10],
                                    [NSNumber numberWithFloat:50],
                                    [NSNumber numberWithFloat:100],
                                    [NSNumber numberWithFloat:500],
                                    [NSNumber numberWithFloat:1000],
                                    [NSNumber numberWithFloat:5000],
                                    [NSNumber numberWithFloat:10000],
                                    [NSNumber numberWithFloat:50000],
                                    [NSNumber numberWithFloat:100000],
                                    [NSNumber numberWithFloat:500000],
                                    [NSNumber numberWithFloat:1000000],
                                    [NSNumber numberWithFloat:5000000],
                                    [NSNumber numberWithFloat:10000000], nil];

    Нашел в одном из проектов.

    itruf, 30 Апреля 2012

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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if (arg4 == 1) {
                $('#FCPDT'+arg3+'__'+arg).remove();
                $('#Fcpdt'+arg3+'___'+arg).remove();
            } else {
                $('#FCPDT'+arg3+'__'+arg).remove();
                $('#Fcpdt'+arg3+'___'+arg).remove();
            }

    O_o

    Hits, 30 Апреля 2012

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

    +18

    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
    //---------------------------------------------------------
    void Link::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
    {
        Q_UNUSED(option);
        Q_UNUSED(widget);
    
    
        if ( mA && mB )
        {
            QPen pen(mColor, mPenWidth);
            painter->setPen(pen);
    
    
            if ( smooth() )
                painter->setRenderHint(QPainter::Antialiasing, true);
    
    
            QString ptname = mA->objectName() + QString("_point%1").arg(mAPoint);
            QDeclarativeItem *aConn = mA->findChild<QDeclarativeItem*>(ptname);
            QDeclarativeItem *bConn = *(QDeclarativeItem**) mB->property("root").constData();
    
    
            QRectF arect(aConn->x() + mA->x() - mB->x(), aConn->y() + mA->y() - mB->y(), aConn->width(), aConn->height());
            QRectF brect(bConn->x(), bConn->y(), bConn->width(), bConn->height());
    
    
            QLineF line(arect.center(), brect.center());
    
    
            painter->drawLine(line);
    
    
            if ( widget )
                widget->update();
       }
    }

    Из коммита где-то в 4:00 :)

    Elvenfighter, 30 Апреля 2012

    Комментарии (11)
  6. JavaScript / Говнокод #10078

    +155

    1. 1
    2. 2
    3. 3
    4. 4
    <style type="text/css">
    #1{display:<script type="text/javascript">if(NextStrInfo(1) == 1){document.write("block");}else{document.write("none");}</script>;}
    #2{display:<script type="text/javascript">if(NextStrInfo(2) == 1){document.write("block");}else{document.write("none");}</script>;}
    </style>

    Замечено на форуме.

    Nikitian, 29 Апреля 2012

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

    +75

    1. 1
    2. 2
    <input type="text" value="1" id="Count" size="1">
    <a href="<?=$arResult["ADD_URL"]?>" rel="nofollow" onclick="return addToCart(this, 'catalog_detail_image', 'detail', '<?=GetMessage("CATALOG_IN_BASKET")?>');" id="catalog_add2cart_link"><span><img src="/upload/cart.jpg"></span>

    o1eg, 29 Апреля 2012

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

    +141

    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
    <?php
    class GetF {
        var $symbol;
        public function __construct(){
            $this->symbol = 'Ф';
        }
    }
    
    function GetE(){
        return 'е';
    }
    
    function GetL(){
        $L = array('л'=>'Abracadabra');
        return str_replace(array_values($L), array_keys($L), 'Abracadabra');
    }
    
    function GetI($password){
        return $password == 'Please give me I' ? 'и' : 'WTF?';
    }
    
    class GetX extends GetF{
        var $symbol;
        public function __construct(){
            $this->symbol = 'кс';
        }
    }
    $preF = new GetF();
    $F = $preF->symbol;
    $E = GetE();
    $L = GetL();
    $I = GetI('Please give me I');
    $preX = new GetX();
    $X = $preX->symbol;
    
    echo $F.$E.$L.$I.$X;  //БУ парапам пам пам РА парапам пам пам ТИ парапам пам НО парапам пам пам

    My name is....

    Mrxan, 29 Апреля 2012

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

    +110

    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
    private void button6_Click(object sender, EventArgs e)
            {
                string str;
                FileStream fs = new FileStream("file.data", FileMode.Open,FileAccess.Read);
                BinaryReader br = new BinaryReader(fs, Encoding.UTF8);
                try
                {
                    while (true)
                    {
                        str = br.ReadString();
                        listBox1.Items.Add(str);
                    }
                }
                catch { MessageBox.Show("Файл file.data успешно считан", "Успех!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); }
    
                fs.Close();
                br.Close();
            }

    while (true)-изюминка конечно =)
    а так это из курсовой первокурсницы, так что простительно

    Bagger288, 29 Апреля 2012

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

    −120

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    Если НЕ Докум.ПроверенноБухгалтером Тогда
    	ЧихПых = Истина;     // подмена контрагента на НЕПРОВЕРЕНО БУХОМ
    Иначе
    	ЧихПых = Ложь;
    КонецЕсли;

    Вот такой вот фокус от программистов для бухгалтеров.

    koshak84, 28 Апреля 2012

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