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

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

    +162

    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
    ModuleManagerImpl::ModuleManagerImpl()
    {
    	ModuleManager::loadPlugins();
    	Config config = ProfileDialog::profilesInfo();
    #ifdef QUTIM_SINGLE_PROFILE
    	bool singleProfile = true;
    #else
    	bool singleProfile = false;
    #endif
    	singleProfile = config.value("singleProfile", singleProfile);
    	if (singleProfile) {
    		if (!config.hasChildGroup("profile")) {
    			QWidget *wizard = new ProfileCreationWizard(this, QString(), QString(), true);
    			wizard->setAttribute(Qt::WA_DeleteOnClose, true);
    			wizard->setAttribute(Qt::WA_QuitOnClose, false);
    			SystemIntegration::show(wizard);
    		} else {
    			config.beginGroup("profile");
    			if(ProfileDialog::acceptProfileInfo(config, QString())) {
    				QTimer::singleShot(0, this, SLOT(initExtensions()));
    			} else {
    				qWarning("Can't login");
    				QDialog *dialog = new ProfileDialog(config, this);
    				SystemIntegration::show(dialog);
    			}
    			config.endGroup();
    		}
    	} else {
    		QDialog *dialog = new ProfileDialog(config, this);
    		SystemIntegration::show(dialog);
    	}
    }

    не знаю как вам, а мне не нравится объявление singleProfile.
    qutim/core/src/modulemanagerimpl.cpp

    POPSuL, 25 Июня 2011

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

    +116

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    if ( check < 50000 ) {
        primaryAnimation = primaryAnimation;
    } else {
        int ani = (check - 50000) / 100;
        primaryAnimation = _OptionalAnimations["Run"][ani];
     }

    Найдено в недрах загрузчика MD2-моделек для XNA.

    RaZeR, 23 Июня 2011

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

    +155

    1. 1
    2. 2
    3. 3
    $pageController = new PageController();
    $photo = $pageController->getPhoto($pageRecord->id);
    $photo =  $photo ;

    А вдруг ПХП с первого раза не понял что в переменной должно быть фото? Повторение мать учения.

    Kos, 19 Июня 2011

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

    +86

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    public static String hello()
    	{
    		String s = "";
    		s += "Добро пожаловать на наш сайт.";
    		return s;
    	}

    redenemy, 16 Июня 2011

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

    +154

    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
    public function setIndex() {
    		$lang = '';
    		switch($this->data['find_in']) {
    			case '1' :
    				$this->indexes = Indexes::COMPANIES.$lang;
    			break;
    
    			case '2' :
    				$this->indexes = Indexes::PRODUCTS.$lang;
    			break;
    
    			case '3' :
    				$this->indexes = Indexes::PROMOS.$lang;
    			break;
    
    			default:
    				$this->indexes = Indexes::COMPANIES.$lang;
    			break;
    		}
    	}

    hellow, 14 Июня 2011

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

    +162

    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
    <html>
    <head>
    <title>Vargo</title>
    <script type="text/javascript">
    var c=0;
    var t;
    var timer_is_on=0;
    function timedCount()
    {
    var pict=document.getElementById('picture');
    pict.innerHTML="<center><IMG align=center src=\""+get_random(55)+".jpg></center>";
    t=setTimeout("timedCount()",1000);
    }
    function doTimer()
    {
    if (!timer_is_on)
      {
      timer_is_on=1;
      timedCount();
      }
    }
    function get_random(a)
    {
        var ranNum= Math.floor(Math.random()*a);
        return ranNum;
    }
    </script> 
    </head>

    Показывает разные картинки меняя через секунду http://netelis.narod.ru/cnv.html

    AliceGoth, 12 Июня 2011

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

    +159

    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
    class Template{
    	var $result,$template_dir="templates";
    	function ParseTemplate($template,$var_name,$value){
    		$out=preg_replace("/$var_name/i","$value",$template);
    		return $out;
    	}
    	function ClearTemplate($var){
    		$var=str_replace("\n","",$var);
    		$var=str_replace("\t","",$var);
    		$var=str_replace("\r","",$var);
    		$var=str_replace("   "," ",$var);
    		$var=str_replace(">  <","><",$var);
    		return $var;
    	}
    	function Template ($values=array(),$template_name="body.html",$body="",$dir="") {
    		$this->template_dir=PATH_TO_TEMPLATES;
    		if (!$body) $body=file_get_contents($this->template_dir."/".$template_name);
    		if ($values) foreach ($values as $name => $value) {
    			$body=$this->ParseTemplate($body,$name, $value);
    		}
    		$this->result=$body;
    	}
    }

    Пришел к нам сайт на обслуживание... Как-бы шаблонизатор... )))

    nethak, 10 Июня 2011

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

    +157

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    foreach($nodes as $xm){
        $arr[count($arr)] = new StdClass();
        $arr[count($arr)-1]->id = $xm->title;
        $arr[count($arr)-1]->nid = $xm->id;
    }

    Lowezar, 10 Июня 2011

    Комментарии (9)
  10. ActionScript / Говнокод #6906

    −109

    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
    var q=0.15
    var w=false
    stroka.alpha=0
    knopka.addEventListener(MouseEvent.MOUSE_OVER,qwe)
    function qwe(e:MouseEvent){
    w=true
    }
    knopka.addEventListener(MouseEvent.MOUSE_OUT,qwe2)
    function qwe2(e:MouseEvent){
    w=false
    }
    stage.addEventListener(Event.ENTER_FRAME,qw)
    function qw(e:Event):void{
    if(w==true){
     stroka.alpha+=q
    }
    if(w==false){
     stroka.alpha-=q
    }
    if(stroka.alpha>=1){
     stroka.alpha=1
    }
    if(stroka.alpha<=0){
     stroka.alpha=0
    }
    }

    Поделка все-того же любителя ENTER_FRAME'а. На этот раз попытка сделать плавное появление/исчезновение объекта при наведении на него мышкой.

    KirAmp, 09 Июня 2011

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

    +84

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    if(obj instanceof TreeDictEntry) {
             TreeDictEntry tde = (TreeDictEntry) obj;
             Integer index = hm_IdDocs_idVectors.get(tde.getId());
             if(index == null) {
                Exception ex =
                   new Exception("Epic Faile в хэш мапе элементов не найден индекс в векторе");
                ex.printStackTrace();
             }
             vecElements.removeElementAt(index);
             return;
          }

    к этому я даже название придумал: "Эпичный говнокод"

    maxt, 08 Июня 2011

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