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

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

    +126

    1. 1
    <input type="text" id="tos" name="tos" data-validate="true" class="text-field" tabindex="6"  data-validation-rules="^(https?|ftp):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$" data-validation-msg="Invalid URL" />

    Monkey killing monkey killing monkey
    Over pieces of the ground.
    Silly monkeys give them thumbs,
    They forge a blade,
    And where there's one
    they're bound to divide it,
    Right in two.
    Right in two.


    :'(

    wvxvw, 07 Января 2014

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

    +13

    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
    if(ortho){
                if( abs(e->x() - line.p1().x() ) * 2 < abs( e->y() - line.p1().y() ) ){
                    y = e->y();
                    x = line.p1().x();
                }else if(abs(e->x() - line.p1().x() ) > 2 * abs( e->y() - line.p1().y() )){
                    x = e->x();
                    y = line.p1().y();
                }else if(abs(e->x() - line.p1().x() ) * 2 > abs( e->y() - line.p1().y() ) &&
                         abs(e->x() - line.p1().x() ) < abs( e->y() - line.p1().y() )){
                    if((e->x() < line.p1().x() && e->y() < line.p1().y()) || (e->x() > line.p1().x() && e->y() < line.p1().y())){
                        x = e->x();
                        y = line.p1().y() - abs(line.p1().x() - e->x());
                    }else if((e->x() > line.p1().x() && e->y() > line.p1().y()) || (e->x() < line.p1().x() && e->y() > line.p1().y())){
                        x = e->x();
                        y = line.p1().y() + abs(line.p1().x() - e->x());
                    }
                }else if(abs(e->x() - line.p1().x() ) < 2 * abs( e->y() - line.p1().y() ) &&
                         abs(e->x() - line.p1().x() ) > abs( e->y() - line.p1().y() )){
                    if((e->x() < line.p1().x() && e->y() < line.p1().y()) || (e->x() < line.p1().x() && e->y() > line.p1().y())){
                        y = e->y();
                        x = line.p1().x() - abs(line.p1().y() - e->y());
                    }else if((e->x() > line.p1().x() && e->y() > line.p1().y()) || (e->x() > line.p1().x() && e->y() < line.p1().y())){
                        y = e->y();
                        x = line.p1().x() + abs(line.p1().y() - e->y());
                    }
                }else{
                    x = e->x();
                    y = e->y();
                }

    Abbath, 14 Октября 2013

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

    +13

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    TAbstractMessageFrame * SwitchIfNeedReceivePackets = create_switch(
    		fnc_ext::bind(this,
    					  fnc_ext::compose2(std::greater<WORD>(),
    										fnc_ext::get_mem(&TThisClass::_totalDataLength),
    										fnc_ext::compose1(std::bind1st(std::minus<WORD>(), static_cast<WORD>(TByteBuffer::MaxCapacity)),
    														  fnc_ext::compose1(fnc_ext::get_mem_func_ref(&TThisClass::TByteBuffer::length),
    																			fnc_ext::get_mem(&TThisClass::_receivedBuffer))))),
    //										fnc_ext::get_mem_func(&TThisClass::FreeBufferSpace))),
    		DataByPackets, DataByLength, "Switch If Need Receive Packets" );

    Говногость, 04 Сентября 2013

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

    +139

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if ((ObjectType)value == ObjectType.Undefined)
    {
        return string.Empty;
    }
    {
        return ((ObjectType)value).GetDescriptionAttribute();
    }

    Как будто не хватает чего-то..

    save2love, 03 Сентября 2013

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

    +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
    <?php
    class Json_Encode {
        public function Encode($obj) {
            $str = "";
            $type = gettype($obj);
            if ($type == "array") {
                $fst = 1;
                
                if (array_keys($obj) !== range(0, count($obj) - 1)) {
                    $str .= "{";
                    foreach($obj as $id=>$el) {
                        if ($fst) {
                            $fst = 0;
                        } else {
                            $str .= ",";
                        }
                        $str .= "\"$id\":";
                        $str .= $this->Encode($el);
                    }
                    $str .= "}";            
                } else {
                    $str .= "[";
                    foreach($obj as $el) {
                        if ($fst) {
                            $fst = 0;
                        } else {
                            $str .= ",";
                        }
                        $str .= $this->Encode($el);
                    }
                    $str .= "]";            
                }
            } else if ($type == "string") {
                $str .= "\"$obj\"";
            } else if ($obj == null) {
                $str .= "null";
            } else {
                $str .= "$obj";
            }
            return $str;
        }
    }

    Листинг файла json_encode.php
    От души посмеялся.

    businessduck, 28 Августа 2013

    Комментарии (34)
  7. JavaScript / Говнокод #13515

    +163

    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 sound = 0;
    		
    		function chooseSound(x) {
    			if(x == 0)	sound = 0;
    			else if(x == 1) sound = 1;
    			else if(x == 2) sound = 2;
    			else if(x == 3) sound = 3;
    			else if(x == 4) sound = 4;
    			else if(x == 5) sound = 5;
    			else if(x == 6) sound = 6;
    			else if(x == 7) sound = 7;
    			else if(x == 8) sound = 8;
    			else if(x == 9) sound = 9;
    			else if(x == 10) sound = 10;
    			else if(x == 11) sound = 11;
    			else if(x == 12) sound = 12;
    			else if(x == 13) sound = 13;
    			else if(x == 14) sound = 14;
    			else sound = 15;
    		}

    отакота

    padonak, 31 Июля 2013

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

    +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
    //программист
            private void work7_Click(object sender, EventArgs e)
            {
                if ((player.CompLevel > 50) & (player.GamedevLevel > 20))
                {
                    work1.Enabled = true;
                    work2.Enabled = true;
                    work3.Enabled = true;
                    work4.Enabled = true;
                    work5.Enabled = true;
                    work6.Enabled = true;
                    work7.Enabled = false;
                    player.Salary = 20000;
                    player.Levels = 50;
                    player.HealthWork = 0;
                    Game_Update();
                }
                else MessageBox.Show("Ты еще плохо знаешь программирование и компьютер");
            }

    Оттуда ж.

    tirinox, 03 Мая 2013

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

    +23

    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
    struct mystream: public std::ostream 
    {
        mystream(std::ostream & o): std::ostream(o.rdbuf()) {}
    
        template <class T>
        mystream & operator << (T const & arg)
        {
            if (enabled_) as_std_ostream() << arg;
            return *this;
        }
    
        // дерьмо STX
        mystream & operator << (std::ostream & (*f)(std::ostream &))
        {
            if (enabled_) as_std_ostream() << f;
            return *this;
        }
    
        mystream & operator << (std::ios & (*f)(std::ios &))
        {
            if (enabled_) as_std_ostream() << f;
            return *this;    
        }
    
        mystream & operator << (std::ios_base & (*f)(std::ios_base &))
        {
            if (enabled_) as_std_ostream() << f;
            return *this;
        }
        // дерьмо ETX
    
        void enable() { enabled_ = true; }
        void disable() { enabled_ = false; }
    
    protected:
        bool enabled_;
        std::ostream & as_std_ostream() { return *this; }
    };

    а так хотелось хоть сегодня рыбки поесть захерачить вместо трёх перегрузок
    template <class O>
    mystream & operator << (O & (*f)(O &)) { ...

    defecate-plusplus, 13 Марта 2013

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

    +140

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    #!/bin/bash
    #
    # Поздравляю с 8 марта! 
    # Желаю море любви, блядь.
    #

    8===o

    bot-minurast, 07 Марта 2013

    Комментарии (34)
  11. Си / Говнокод #12653

    +135

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    // где-то в коде нашлось
    PRIVATE IdxArray* idx_array_append_val_dyn(IdxArray* arr, PlmIndex idx)
    
    // private.h
    #ifdef PLM_TEST
    #define PRIVATE extern
    #else
    #define PRIVATE static
    #endif

    внезапно...

    Try, 26 Февраля 2013

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