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

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

    +9

    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
    int turn = m_mapObject->getTurnSpeed();
    //НЕ НАДО ТУТ ОПТИМИЗИРОВАТЬ /= 45 !!!!
    if (turn != 0) {
        if (turn > 0) {
        //                    qDebug() << "Turn plus";
            turn /= 45;
            if (turn < 4) turn = 4;
            if (turn > 8) turn = 8;
        } else {
        //                    qDebug() << "Turn minus";
            turn /= 45;
            if (turn > -4) turn = -4;
            if (turn < -8) turn = -8;
        }
        paint.drawLine(QPoint(0,-speed),QPoint(turn,-speed));
    }

    Вы б знали, как руки чешутся...

    Antervis, 05 Октября 2015

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

    +4

    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
    using System;
    namespace project5
    {
        class Program
        {
            static void Main(string[] args)
            {
             
            }
    
            class Petux
            {
                private int petux = "kukareku!";
                
                public Petux():this(5)
                {
                    
                }
    
                public Petux(int i):this()
                {
                    
                }
            }
    
        }
    }

    обратите внимание на строку 13

    При всем при этом код компилится!

    http://ideone.com/XIQDfK

    Внимание вопрос - уважаемые знатоки, почему?

    kegdan, 06 Августа 2015

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

    +161

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    /* ... */
    
    alert(event.target.parentElement.parentElement.parentElement.id);
    
    /* ... */

    Выход из списка и получение id блока-обертки...

    CMTV, 26 Июля 2015

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

    +102

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    public class Permuter                                {
        private static void permute(int n, char[] a)     {
            if (n == 0)                                  {
                System.out.println(String.valueOf(a))    ;}
            else                                         {
                for (int i = 0; i <= n; i++)             {
                    permute(n-1, a)                      ;
                    swap(a, n % 2 == 0 ? i : 0, n)       ;}}}
        private static void swap(char[] a, int i, int j) {
            char saved = a[i]                            ;
            a[i] = a[j]                                  ;
            a[j] = saved                                 ;}}

    "I finally figured out how to get those pesky semicolons and curly braces out of my Java code"

    Xom94ok, 22 Февраля 2015

    Комментарии (36)
  6. Си / Говнокод #17566

    +124

    1. 1
    value += (0<<17);   // PARK bit

    codemonkey, 03 Февраля 2015

    Комментарии (36)
  7. Python / Говнокод #16926

    −97

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    def constant_time_compare(val1, val2):
        """
        Returns True if the two strings are equal, False otherwise.
    
        The time taken is independent of the number of characters that match.
        """
        if len(val1) != len(val2):
            return False
        result = 0
        for x, y in zip(val1, val2):
            result |= ord(x) ^ ord(y)
        return result == 0

    Django.utils.crypto в Django 1.4

    american_idiot, 24 Октября 2014

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

    +101

    1. 1
    удалено

    Кто делает выгрузка в таком формате???
    xml? json? так лучше, епта

    Cascader, 21 Августа 2014

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

    +63

    1. 1
    renderer->SetBackground(.0, .0, .0); // Background color green

    Abbath, 16 Августа 2014

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

    +156

    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
    function tuc1($mensaje)
    		{
    			if (ereg("^[a-zA-Z0-9\-_ ]{1,255}$", $mensaje))
    			{
    				return $mensaje;
    			}else{
    				echo "Сука тебе пиздец мразь,айпи записан менты уже едут.А пока пшел нахуй отсюда.";
    				include('footer.php');
    				exit();
    			}
    		}
    		
    $stana=trim(htmlentities(stripslashes(tuc1($_GET["p"]))));

    //после взлома проснулась у друга параноя

    Reds, 12 Августа 2014

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

    +156

    1. 1
    2. 2
    $user_id = $engine->auth->id;
    $sql = "SELECT `id` FROM `arm_tasks` WHERE (followers_id = '{$user_id}' OR followers_id LIKE '{$user_id},%' OR followers_id LIKE '%,{$user_id},%' OR followers_id LIKE '%,{$user_id}') ";

    Вот так отжигает товарищ по отделу.
    Поле followers_id в виде строки с id-шниками через запятую (что тоже не очень хорошо)

    podvzbzdnul, 11 Августа 2014

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