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

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

    +144.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
    17. 17
    public class YobaButton : Button
    {
        public YobaButton ()
        {
            this.Click += (s1, e1) =>
            {
                MessageBox.Show ("Оп хуй.");
     
                this.Click -= (EventHandler)Delegate.CreateDelegate (typeof (EventHandler), this, (MethodInfo)MethodBase.GetCurrentMethod ());
     
                this.Click += (s2, e2) =>
                {
                    MessageBox.Show ("Оп тупой хуй.");
                };
            };
        }
    }

    Yurik, 30 Января 2010

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

    +61.8

    1. 1
    2. 2
    CStringA * str = new CStringA; - создает и пашет на ура
    CStringA * str = (CStringA *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CStringA)); часов 5 назад так же пахало на ура, помылся в душе и ... бля мистика возвращает неверный указатель

    был мне задан такой вопрос =)

    tz-lom, 24 Января 2010

    Комментарии (22)
  4. PHP / Говнокод #2267

    +170.7

    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
    if($type=="amulet") {$w=60;$h=20;}
            else if($type=="sergi") {$w=60;$h=20;}
                else if($type=="sword") {$w=60;$h=60;}
                    else if($type=="axe") {$w=60;$h=60;}
                        else if($type=="fail") {$w=60;$h=60;}
                            else if($type=="knife") {$w=60;$h=60;}
                                else if($type=="spear") {$w=60;$h=60;}
                                    else if($type=="armour") {$w=60;$h=80;}
                                        else if($type=="ring1") {$w=20;$h=20;}
                                            else if($type=="ring2") {$w=20;$h=20;}
                                                else if($type=="ring3") {$w=20;$h=20;}
                                                    else if($type=="helmet") {$w=60;$h=60;}
                                                        else if($type=="perchi") {$w=60;$h=40;}
                                                            else if($type=="shield") {$w=60;$h=60;}
                                                                else if($type=="boots") {$w=60;$h=40;}

    про elseif не в курсе

    dicos, 11 Декабря 2009

    Комментарии (22)
  5. PHP / Говнокод #2241

    +153

    1. 1
    2. 2
    3. 3
    4. 4
    $res1 = mysql_query("INSERT INTO tbl_orders
    (date_order,name,id_city,city_text,kod_tel_1,tel_1,kod_tel_2,tel_2,description,subject_text,id_teacher,id_category,category_text,check_student,place_student,check_teacher,place_teacher,price,email,icq,order_close,id_status,to_send,id_whence_came,text_whence_came,one_teacher)
    VALUES ('$ts','$name','$city','$other_city','$kod_tel_1','$tel_1','$kod_tel_2','$tel_2','$prim','$other','$id_rep','$category','$other_cat','$check_uch','$district_uch','$check_prep','$district_prep','$stoim','$email','$icq','0','1','1','$whence_came','$text_whence_came','$one_teacher')")
    or die ("Query failed".mysql_error());

    Услада ума, любящего искать связи. Автор чутка лажанул — некоторые переменные всё же совпадают с полями таблицы.

    defann, 07 Декабря 2009

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

    +175.6

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    <form method="post" enctype="multipart/form-data" action="seach_mob.php">
    <input type="hidden" value="2" name="page"/>
    <input type="hidden" value="0" name="cena_nu9"/>                                                                                                                                                                       
    <input type="hidden" value=" 0 <= p.products_price AND p.products_price <= 2000 " name="cena_nu10"/>                                                                                                                                                                     
    <input type="hidden" value=" AND (1) AND ((p2p.products_parameters_id=152) OR (p2p.products_parameters_id=153) OR (p2p.products_parameters_id=154) OR (p2p.products_parameters_id=155) OR (p2p.products_parameters_id=204) OR (p2p.products_parameters_id=205) OR (p2p.products_parameters_id=206) OR (p2p.products_parameters_id=207) OR (p2p.products_parameters_id=256) OR (p2p.products_parameters_id=257) OR (p2p.products_parameters_id=258) OR (p2p.products_parameters_id=574) OR (p2p.products_parameters_id=575) OR (p2p.products_parameters_id=576) OR (p2p.products_parameters_id=577) OR (p2p.products_parameters_id=632) OR (p2p.products_parameters_id=744) OR (p2p.products_parameters_id=745) OR (p2p.products_parameters_id=746) OR (p2p.products_parameters_id=747) ) " name="para_nu_2"/> 														
    <input type="hidden" value="2" name="fu_flag"/>                                                                                                                                                                            
    <input type="submit" title="Страница: 2" value="2" name="submit2" class="ssulo4ka_listalo4ka"/>                                                                                                                                                           
    </form>

    Конечно не совсем ПХП, но по моему достойно внимания общественности :)!

    ohdesu, 03 Декабря 2009

    Комментарии (22)
  7. C++ / Говнокод #2133

    +73.2

    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
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    99. 99
    /*
        CANON D-SLR cameras core routine
        Property of CANON INC. 1998-2010
        
        v 1.0 made by Radja Tokamoto Goines
        v 1.1 made by Dugwin Yakioto jr.
        
        last changes: 10.11.2009
    */
    
    #include <stdlib.h>
    #include <math.h>
    #include <time.h>
    
    #include "inc/tweakfocus.h"
    #include "inc/radja_filters.h"
    
    bool do_focus(lens, camera) {
        double fp;
        time_t t;
    
        t = init_focus_timer(t);
        
        do {
            fp = measure_focus_point(lens);
            move_focus(lens, fp)
    
            if (timeout(t))
                return false;
    
        } while (!lens.is_focused());
        
        if (!L_LensDetected(lens))
            lens.adjust_focus(rand(10));
            
        return true;
    }
    
    rawdata * scandata(matrix, lens, camera) {
        rawdata *cr;
        double noise, aberrations;
    
        cr = create_cr(matrix);
        
        read_exif_info(cr->exif, lens, camera);
    
        prepare_everything(matrix, lens, camera);
        
        if (!do_focus(lens, camera))
            return NULL;
        else 
            beep();
          
        aberrations = pow(100 - lens.focallength, 2) * sqrt(2) + 10;
    
        if (L_LensDetected(lens))
            aberrations /= 2.0;
          
        scan_sensor(cr, matrix, aberrations);
    
        noise = matrix.iso / 100.0;
        noise *= matrix.cropfactor;
    
        if (camera.model == EOS1000D) {
            noise *= 1.2;
            wait_for_something();
        }
    
        if (camera.model != EOS7D)
            wait_for_something();
        
        if (lens.manufacture != CANON_LENS) {
            corrupt_something(cr);
            apply_random_filter(cr);
        }
        
        if (lens.model == EF_50_F1_4) {
            noise /= 1.2;
            apply_fcb(cr); //fucken cool bokeh
        }
        
        if (lens.model == CANON_L_17_40_F4) {
            blur(cr, 0.8);
            distort(cr, 40 - lens.focallength);
        }
          
        radja_filter(cr, 1.570796326794896619231321691641); //don't touch that!
    
        if (is_eos1d_series(camera.model))
            disable_all_spoiling(cr);
        else
            make_nice_colors(cr);
        // finally...
        apply_noise(cr, noise);    
        apply_barrel_distortion(cr, lens);
        apply_pillow_distortion(cr, lens);  
        
        return cr;
    }

    http://habrahabr.ru/blogs/DSLR/74958/
    Исходные тексты прошивки canon eos.
    Многие, наверное, уже слышали, что на днях была взломана внутренняя сеть компании Canon и в числе прочего в сеть «утёк» кусок ядра исходных текстов прошивки камер серии EOS, который я имею честь эксклюзивно опубликовать на суд общественности.
    Говночитатели без ЧЮ идут в *опу.

    sbb, 11 Ноября 2009

    Комментарии (22)
  8. bash / Говнокод #2080

    −370.1

    1. 1
    id |sed "s/^[^(]*(\([^)]*\)).*/\1/"

    Воссоздал прямо щас, не ручаюсь, что выражение в точности такое, но очень близко.

    nil, 01 Ноября 2009

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

    +52.9

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    void SomeFunction(SomeClass* cls)
    {
        std::auto_ptr<SomeClass> tmp(cls);
        SomeObject.SomeMethod(tmp.release());
    }

    несколько раз видел такое в разных вариациях (поэтому вместо копи-пасты - абстракция).
    смысл сей конструкции упорно ускользает от меня :)

    g26g, 16 Сентября 2009

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

    +57.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
    volatile void* AllocatedMemory;
    
    int AllocateMemoryThread(const int size)
    {
    	char buffer[size];
    	AllocatedMemory=(void*)buffer;
    	AllocatingDone.Signal();
    	Sleep(INFINITY);
    	return 0;
    };
    
    ...
    
    void* MAlloc(const int size)
    {
    	CriticalSection.Lock();
    	if( !CreateThread(AllocateMemoryThread,true,size,0) )
    		return NULL;
    	AllocatingDone.Wait();
    	const void* AllocatedBuffer=AllocatedMemory;
    	CriticalSection.UnLock();
    	return AllocatedBuffer;
    };

    CriticalSection - критическая секция.
    AllocatingDone - какой-то семафор.
    Вообще не могу понять код. Что он этим хотел сказать...

    Говногость, 02 Сентября 2009

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

    +161

    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
    $id_country = 0;
    $id_region = 0;
    $id_city = 0;
    $zip_code = 0;
    if(isset($_REQUEST["id_country"]))
    {
        $id_country=$_REQUEST["id_country"];
    }
    if(isset($_REQUEST["id_region"]))
    {
        $id_region=$_REQUEST["id_region"];
    }
    if(isset($_REQUEST["id_city"]))
    {
        $id_city=$_REQUEST["id_city"];
    }
    if(isset($_REQUEST["zip_code"]))//проверка zip кода
    {
        $zip_code=$_REQUEST["zip_code"];
    }
    
    $id_country=strip_tags(trim(strval($_REQUEST["id_country"])));
    $id_region=strip_tags(trim(strval($_REQUEST["id_region"])));
    $id_city=strip_tags(trim(strval($_REQUEST["id_city"])));
    $zip_code=strip_tags(trim(strval($_REQUEST["zip_code"])));
    
    ..........................
    //переходим на Шаг 2 решистрации
    header("location: ./registration.php?sel=2");
    ..........................

    Индусы среди нас!

    Bartelby, 25 Августа 2009

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