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

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

    +145

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    $(function(){
        oCatalog=new Catalog();
      });
          
      Catalog = function (){
        
        function test (data){
          alert(data);
        }
        
      }

    exoundeeq, 12 Ноября 2010

    Комментарии (2)
  3. Java / Говнокод #4587

    +145

    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
    /**
         * Returns an array of all the objects currently registered
         * as <code><em>Foo</em>Listener</code>s
         * upon this <code>Component</code>.
         * <code><em>Foo</em>Listener</code>s are registered using the
         * <code>add<em>Foo</em>Listener</code> method.
         *
         * <p>
         * You can specify the <code>listenerType</code> argument
         * with a class literal, such as
         * <code><em>Foo</em>Listener.class</code>.
         * For example, you can query a
         * <code>Component</code> <code>c</code>
         * for its mouse listeners with the following code:
         *
         * <pre>MouseListener[] mls = (MouseListener[])(c.getListeners(MouseListener.class));</pre>
         *
         * If no such listeners exist, this method returns an empty array.
         *
         * @param listenerType the type of listeners requested; this parameter
         *          should specify an interface that descends from
         *          <code>java.util.EventListener</code>
         * @return an array of all objects registered as
         *          <code><em>Foo</em>Listener</code>s on this component,
         *          or an empty array if no such listeners have been added
         * @exception ClassCastException if <code>listenerType</code>
         *          doesn't specify a class or interface that implements
         *          <code>java.util.EventListener</code>
         *
         * @see #getComponentListeners
         * @see #getFocusListeners
         * @see #getHierarchyListeners
         * @see #getHierarchyBoundsListeners
         * @see #getKeyListeners
         * @see #getMouseListeners
         * @see #getMouseMotionListeners
         * @see #getMouseWheelListeners
         * @see #getInputMethodListeners
         * @see #getPropertyChangeListeners
         *
         * @since 1.3
         */
        public <T extends EventListener> T[] getListeners(Class<T> listenerType) { 
            EventListener l = null; 
            if  (listenerType == ComponentListener.class) { 
                l = componentListener;
            } else if (listenerType == FocusListener.class) {
                l = focusListener;
            } else if (listenerType == HierarchyListener.class) {
                l = hierarchyListener;
            } else if (listenerType == HierarchyBoundsListener.class) {
                l = hierarchyBoundsListener;
            } else if (listenerType == KeyListener.class) {
                l = keyListener;
            } else if (listenerType == MouseListener.class) {
                l = mouseListener;
            } else if (listenerType == MouseMotionListener.class) {
                l = mouseMotionListener; 
            } else if (listenerType == MouseWheelListener.class) {
                l = mouseWheelListener; 
            } else if (listenerType == InputMethodListener.class) {
                l = inputMethodListener; 
            } else if (listenerType == PropertyChangeListener.class) {
                return (T[])getPropertyChangeListeners();
            }
            return AWTEventMulticaster.getListeners(l, listenerType);
        }

    как вы думаете, что это? внутренности Java
    java.awt.Component

    Lure Of Chaos, 11 Ноября 2010

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

    +145

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    // The future of the C# or ...
    // Why waste time on trifles, teaching programmers the subtleties of programming !? :)
    
    //...
    CComboBox cb = new Windows7(Windows7Type::wt_combobox);
    for( int i = 0; i < strArray.length(); i++ ) {
    	CComboBoxItem item = new Windows7(Windows7Type::wt_combobox_item, strArr[i]);
    	cb.Add(item);
    }

    nnemo, 09 Ноября 2010

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

    +145

    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
    /**
         * Получаем права на объект.
         *
         * @param  string $fullHref
         * @param  string $method
         * @param  string $params
         * @param  string $type
         * @return object $this
         * @access public
         */
    
        public function getPermsHref( $object, $method = '*', $params = false, $type = 'module', $url = false )
        {
           $registr = URegistry::getInstance();
           $sql     = $registr->SQuery->getAcl();
    
           if ( $type == 'url' && $url )
             {
               $sql['where'] = "`o`.`type` = 'url' and `o`.`href` = '".$url."'";
               $ac_type      = 'url';
             }
           elseif ( $type == 'module' )
             {
                $sql['where'] = "(`o`.`type` = 'module') and `o`.`name` = '".$object."'";
                if ( $method != '*' )
                    $sql['where'] .= ' or `o`.`href` = "'.$object.'/'.$method.'"';
    
                $ac_type = 'module';
             }
           else
             {
                //TODO:wtf?
             }
    
            $registr->db->build_query($sql)->safe_sql($ac_type, $this->gid)->exec();
            $perms = $registr->db->fetch_object();
    
            if ( !$perms || !$perms->permission || !$perms->groupid )
                throw new NotFoundObject();
    
            $this->perms       = $perms->permission;
            $this->groupObject = explode(',', $perms->groupid);
            $this->priv_lengh  = strlen($perms->permission);
    
            return $this;
        }
    
        /**
         * Проверка прав на объект
         *
         * @param  mixed $priv
         * @return array
         * @access public
         */
    
        public function checkPremsObject( $priv = false )
        {
            $pruf = array();
            $priv = empty($priv) ? $this->perms : $priv;
    
            if ( $this->priv_lengh <= 0 or !in_array($this->gid, $this->groupObject) )
                return false;
    
            for ( $gi = 0; $gi < $this->priv_lengh; $gi++ )
            {
                if ( in_array($priv[$gi], $this->privileges['read']) )   $pruf['read'] = true;
                if ( in_array($priv[$gi], $this->privileges['write']) )  $pruf['write'] = true;
                if ( in_array($priv[$gi], $this->privileges['delete']) ) $pruf['delete'] = true;
            }
    
            return $pruf;
        }

    Проверка прав.
    Что скажите?

    ololo, 07 Ноября 2010

    Комментарии (16)
  6. C++ / Говнокод #4554

    +145

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    {
    float y,a,b;
    int x;
    a=StrToFloat(Edit1->Text);
    b=StrToFloat(Edit2->Text);
    for (x=1;x<=10;x+=2);
    {
    y=x*x/(a+b);
    Memo1->Lines->Add("x="+FloatToStr(x)+"\ty="+FloatToStr(y));
    }
    }

    программа вычисления функции , при изменении Х от 1 до 10 .

    samvel13, 07 Ноября 2010

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

    +145

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    switch ($_GET['otdel']) {
    	case null:
    		echo "Название отдела №1";
    		$_GET['otdel'] = 1;
    	break;
    	case 1:
    		echo "Название отдела №1";
    	break;
    
    	case 11:
    // и так далее

    Отдел по умолчанию.
    Вариантов написать толково - тьма. Попробуем?

    AndryG, 07 Ноября 2010

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

    +145

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    <tr>
    <td><td><td><td><td><td><td><td>
    &nbsp;
    </td></td></td></td></td></td></td></td>
    </tr>

    взялся за реконструкцию одного проекта... там есть сводная таблица и она должна быть разделена на 10 частей по вертикали... Предыдущий программист реализовал разделитель так...

    dexif, 07 Ноября 2010

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

    +145

    1. 1
    2. 2
    3. 3
    4. 4
    foreach($new as $key => $value)
    {
    	$config[$key] = $value;
    }

    stasoft, 06 Ноября 2010

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

    +145

    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
    /*Выпадающее меню - рассчитывание координат и выполнение определенных действий при определенных координатах курсора*/
    
    
    
    //document.onmousemove = function(e){
    
    //    var mCur = mousePageXY(e);
    
    //}
    
    //function mousePageXY(e)
    
    //{
    
    //    var x = 0, y = 0;
    
    //
    
    //    if (!e) e = window.event;
    
    //
    
    //    if (e.pageX || e.pageY)
    
    //    {
    
    //        x = e.pageX;
    
    //        y = e.pageY;
    
    //    }
    
    //
    
    //    else if (e.clientX || e.clientY)
    
    //    {
    
    //        x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
    
    //        y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
    
    //    }
    
    //    if ((((screen.width/2-491)>x)||(screen.width/2+409<x))||((screen.width/2-491<x)&&(y<125)&&((screen.width/2-274)>x))||(y>170+height)||(((screen.width/2-274)<x)&&(y<173)))  {
    
    //        document.getElementById("menu").style.display = 'none'
    
    //    }
    
    //    return {
    
    //        "x":x,
    
    //        "y":y
    
    //    };
    
    //}

    minnigaliev-r, 04 Ноября 2010

    Комментарии (4)
  11. Java / Говнокод #4524

    +145

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    private TaskScheduler scheduler;
    
      protected TaskScheduler() {
      }
    
      public final TaskScheduler getScheduler() {
        if (this.scheduler == null) {
          this.scheduler = new TaskScheduler();
        }
        return this.scheduler;
      }

    мелочь, а смешно получилось ))

    Lure Of Chaos, 03 Ноября 2010

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