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

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

    +242

    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
    main:
    	mov a, P0
    	dec a
    	inc a
    	jnz __div_part
    	jmp __mul_part
    __mul_part:
    	// mul
    	mov r0, P1
    	mov r2, P2
    	call __Mul
    	mov P1, r0
    	mov P2, r1
    	jmp __end		
    __div_part:
    	// div
    	mov r0, P1
    	mov r2, P2
    	call __Div
    	mov P1, r0
    	mov P2, r1
    	jmp __end
    __end:	
    end

    процедура main лабы по mcs-51

    valik-32, 08 Апреля 2011

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

    +167

    1. 1
    Перейти на страницу <span onmouseover="this.className='menu_over'" onmouseout="this.className='menu'" class="menu" onClick="window.location='<?echo $arItem["DETAIL_PAGE_URL"]?>'">--></span>

    тег "a" видимо был незнаком.

    Fisher, 30 Марта 2011

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

    +154

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    __int64 timestamp;
    
    	// Get nanoseconds since 1601
    	timestamp = rand() + (((__int64)rand()) << 32);
    	timestamp /= 100;

    очень вольная работа со временем...

    kubrinsky, 16 Марта 2011

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

    +126

    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
    Type window = core.getTypeCreationWindowFromType( this.currentType );
                if (window != null)
                {
                    var cr_window = Activator.CreateInstance( window );
                    if (window == typeof( forms.showWindow ))
                    {
                        ((forms.showWindow)cr_window).setTitle( "Добавить новую позицию" );
                        ((forms.showWindow)cr_window).setType( this.chldrenType );
                        ((forms.showWindow)cr_window).fill( );
                        ((forms.showWindow)cr_window).setSelectionMode( );
                        if (this.isExlusivePositionResolve == true) 
                        {
                            // var new_item = Activator.CreateInstance( this.chldrenType );
                            //new_item = (types.ICovertiablePersist<this.chldrenType>)core.instance().ge
    
                            ((forms.showWindow)cr_window).selectedItem += ( forms.showWindow form ) =>
                            {
                                var new_item = Activator.CreateInstance( this.chldrenType );
                                ///new_item = core.instance().getObject(this, form.selected_id);
    
                                int parent_object_id = -1; // Это номер связанного с 
                                                           //выриьбаемым обектом объекта, 
                                                           //тоесть если окно выбора было 
                                                           //кастомизированна и тип выбираемы 
                                                           //х щзначений другой нежели целевой 
                                                           //то мы ищем звязь между обектом ородите и дитя !!!
                                FieldInfo[] fields = this.chldrenType.GetFields( );
                                
                                int id = ((types.persistent)new_item).id;
                                bool isExists = false;
                                for (int i = 0; i < this.dgv_grid.RowCount; i++) 
                                {
                                    int id_s;
                                    int.TryParse( this.dgv_grid.Rows[i].Cells["id"].Value.ToString( ),out id_s );
                                    if (id_s == id) 
                                    {
                                        int count;
                                        int.TryParse( this.dgv_grid.Rows[i].Cells["count"].Value.ToString( ), out count );
                                        this.dgv_grid.Rows[i].Cells["count"].Value = count++;
                                        isExists = true;
                                    }
                                }
                                if (isExists == false) 
                                {
                                    this.addOnePosition( new_item );
                                }
                            };
                        }
                    }
                    else 
                    {
                        ((Form)cr_window).FormClosed += ( object sender, FormClosedEventArgs e ) => {
                            this.fill( );
                        };                   
                    }
                    ((System.Windows.Forms.Form)cr_window).Show( );
                }
                else
                {
                    MessageBox.Show( "Объекты такого типа создавать запрещено" );
                }

    Нашел его миленкого. Переписываю ))) А коменн то комент

    glilya, 15 Марта 2011

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

    +175

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    //из какого то мануала
    
    Switch($_POST['ingame'])
    {
          case $_POST['ingame']:{
          //тут какая то ебень
         }
    
    }

    Судя по всему - мануал реально удался.. и там в скобках реально какая то ебень!

    Aios, 08 Марта 2011

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

    +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
    template <typename T>
    class Animate : public internal::interval_action
    {
    public:        
    
    	Animate(render::Sprite* target, bool restore_frame, bool repeat, T* animation)
            : m_target(target)
            , m_animation(animation)
            , m_restore(restore_frame)
            , m_time(0.0f)
            , m_current_frame(0)
            , m_done(false)
            , m_frames_count(animation->frames_count())
            , interval_action(animation->delay * m_frames_count)    
        {
    	...
        }
    };

    Это как раз тот случай, когда "one facepalm is not enough". (c)

    Kirinyale, 28 Февраля 2011

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

    +160

    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
    <?php
    //дата и время.
    $date1 = date('d.m.Y');
    $date2 = date('H:i:s');
    //$i - счётчик пользователей, $cnt - то, что будем выводить (в завершении)
    //$uall - Ссылки на пользователей онлайн
    $i = 0;
    $cnt = NULL;
    $uall = NULL;
    $db->query = "SELECT id, nick, timeof, online FROM ".$GLOBALS['pref']."users";
    $qonl = $db->query();
    $cnt .= "Всего участников ";
    
    while ($usronl = $db->farray($qonl)) {
    if ($usronl['online'] == TRUE) {
    $ar = explode("|:|", $usronl['timeof']);
    
    //Если сегодняшняя дата
    if ($ar[0] === $date1) {
    
    $est = explode(":", $ar[1]);
    $tm = explode(":", $date2);
    $m4 = $est[0] - $tm[0];
    $m5 = $tm[1] - $est[1];
    $m6 = "$m5";
    if (($est[0] === $tm[0]) && (($m5 <= 15))) {
    if ($i > 0) { $p = ","; } else { $p = NULL; }
    if ($i == 1) { $s = ","; } else { $s = NULL; }
    $i++;
    $uall .= $s."<a href=\"http://".$GLOBALS['url']."/users/
    profile/".$usronl['id']."/\" title=\"Посмотреть профиль\">".$usronl['nick']."<
    /a>".$p." ";
    
     } elseif (($m4 == -1) && ($m6{0} === "-" && $m5 <= -45)) {
    if ($i > 0) { $p = ","; } else { $p = NULL; }
    if ($i == 1) { $s = ","; } else { $s = NULL; }
    $i++;
    $uall .= $s."<a href=\"http://".$GLOBALS['url']."/users/
    profile/".$usronl['id']."/\" title=\"Посмотреть профиль\">".$usronl['nick']."<
    /a>".$p." ";
     }
      }
       } 
    	} //end while
    if ($i == 0) {
    $uall .= "никого";
    } else {
    
    $co = strlen($uall);
    $uall = substr($uall, 0, $co - 7);
    $uall .= ".";
    }
    $cnt .= "(".$i."):<BR>".$uall;
    
    ?>

    Писал вывод онлайн посетителей на сайте в 2009 году.

    Furry, 21 Февраля 2011

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

    +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
    struct Event
    {
       int priority;
       bool operator<(Event e) const
       {
          return e.priority>priority;
       }
       
       virtual void operator() () = 0;
    };
    
    priority_queue<Event*, deque<Event*> > eventQueue;
    
    template <typename T, void (T::*g)()>
    struct  TEvent : Event
    { 
       T* parent;
       virtual void operator() () 
       {
          (parent->*g)();
       }
       TEvent (T* _parent) : parent(_parent){}
    };
    
    struct Entity
    {
       int foo;
       void AFunc() 
       {
          cout<<foo;
       }
    
       void BFunc() 
       {
          cout<<"Ololo";
       }
               
       typedef TEvent<Entity,&Entity::AFunc> someEvent;
       Entity(int _foo): foo(_foo){}
             
       void addEvent()
       {
          eventQueue.push(new someEvent(this));
       }
    };
    
    int main()
    {
       Entity foo(10);
       foo.addEvent();
       (*eventQueue.top())();
       return 0;
    }

    Один из самых сложных и неочевидных способов вывести в консоль число 10.
    (Этот код - проверка, будет ли работать прототип велосипедного делегата)

    CHayT, 15 Февраля 2011

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

    +172

    1. 1
    var rus_rl = ('А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я-а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я').split('-');

    vugluskr, 15 Февраля 2011

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

    +166

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if(VisabilityOnOff==true){
    	   document.SearchForm.searchoption[0].disabled=true;
    	   document.SearchForm.searchoption[1].disabled=true;
    }else if(VisabilityOnOff==false){
    	   document.SearchForm.searchoption[0].disabled=false;
    	   document.SearchForm.searchoption[1].disabled=false;
    }

    kuku, 09 Февраля 2011

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