1. JavaScript / Говнокод #9390

    +166

    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 (
    		(((a[0][0] < a[1][0] && (x >= a[0][0] && x <= a[1][0])) ||
    		(a[0][0] > a[1][0] && (x <= a[0][0] && x >= a[1][0]))) &&
    		((b[0][0] < b[1][0] && (x >= b[0][0] && x <= b[1][0])) ||
    		(b[0][0] > b[1][0] && (x <= b[0][0] && x >= b[1][0])))) ||
    		(a[0][0] == a[1][0] && ((a[0][1] < a[1][1] && (y >= a[0][1] && y <= a[1][1])) ||
    								(a[0][1] > a[1][1] && (y <= a[0][1] && y >= a[1][1])))
    		) || (
    		b[0][0] == b[1][0] && ((b[0][1] < b[1][1] && (y >= b[0][1] && y <= b[1][1])) ||
    								(b[0][1] > b[1][1] && (y <= b[0][1] && y >= b[1][1])))
    		)) {
    			return [x, y];
    	} else {
    		return false;
    	}

    akim, 11 Февраля 2012

    Комментарии (17)
  2. PHP / Говнокод #9389

    +160

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    $rcn = 0;
    					foreach ($cites as $cite)
    					{
    						$rcn++;
    					}
    					if ($rcn == 0)
    					{
    						// we banned or network error!
    						
    					}

    Проверка не пустоты массива. Пpосто лень читать мануал(& Google too)! Главное что работает!

    increazon, 10 Февраля 2012

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

    +192

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    public Matrix3d(double m00,
                    double m01,
                    double m02,
                    double m10,
                    double m11,
                    double m12,
                    double m20,
                    double m21,
                    double m22)

    [color=blue]http://docs.oracle.com/cd/E17802_01/j2se/javase/technologies/desktop/java3d/forDevelopers/J3D_1_3_API/j3dapi/javax/vecmath/Matrix3d.html[color]

    3.14159265, 10 Февраля 2012

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

    +164

    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
    /////////////Название ссылок (меню и тд) ////////////////
    $file=str_replace('{text_about}',$sph_messages["text_about"],$file); // О нас
    $file=str_replace('{text_main}',$sph_messages["text_main"],$file); //
    $file=str_replace('{text_news}',$sph_messages["text_news"],$file);
    $file=str_replace('{text_web}',$sph_messages["text_web"],$file);
    $file=str_replace('{text_pog_gorod}',$sph_messages["text_pog_gorod"],$file);
    $file=str_replace('{text_catigor}',$sph_messages["text_catigor"],$file);
    $file=str_replace('{text_logo}',$sph_messages["text_logo"],$file);
    $file=str_replace('{text_searc}',$sph_messages["text_searc"],$file);
    $file=str_replace('{text_img}',$sph_messages["text_img"],$file);
    $file=str_replace('{text_add}',$sph_messages["text_add"],$file);
    $file=str_replace('{text_help}',$sph_messages["text_help"],$file);
    $file=str_replace('{text_search_all}',$sph_messages["text_search_all"],$file);
    $file=str_replace('{text_feedback}',$sph_messages["text_feedback"],$file);
    $file=str_replace('{text_send}',$sph_messages["text_send"],$file);
    $file=str_replace('{text_start}',$sph_messages["text_start"],$file);
    $file=str_replace('{text_reg_mail}',$sph_messages["text_reg_mail"],$file);
    $file=str_replace('{text_kurs}',$sph_messages["text_kurs"],$file);
    $file=str_replace('{text_mail}',$sph_messages["text_mail"],$file);
    $file=str_replace('{text_pass}',$sph_messages["text_pass"],$file);
    $file=str_replace('{text_lang}',$sph_messages["text_lang"],$file);
    $file=str_replace('{text_zapomnit}',$sph_messages["text_zapomnit"],$file);
    $file=str_replace('{text_vhod}',$sph_messages["text_vhod"],$file);
    $file=str_replace('{text_pogoda}',$sph_messages["text_pogoda"],$file);
    $file=str_replace('{text_friend}',$sph_messages["text_friend"],$file);
    $file=str_replace('{text_music}',$sph_messages["text_music"],$file);
    $file=str_replace('{text_foto}',$sph_messages["text_foto"],$file);
    $file=str_replace('{text_video}',$sph_messages["text_video"],$file);
    $file=str_replace('{text_search_ras}',$sph_messages["text_search_ras"],$file);
    $file=str_replace('{text_add_code}',$sph_messages["text_add_code"],$file);
    $file=str_replace('{text_add_des}',$sph_messages["text_add_des"],$file);
    $file=str_replace('{text_add_url}',$sph_messages["text_add_url"],$file);
    $file=str_replace('{text_add_name}',$sph_messages["text_add_name"],$file);
    $file=str_replace('{text_add_ost}',$sph_messages["text_add_ost"],$file);
    $file=str_replace('{text_add_znak}',$sph_messages["text_add_znak"],$file);
    //////////КАТЕГОРИИ////////
    $file=str_replace('{cat}',$sph_messages["cat"],$file);
    $file=str_replace('{cat_all}',$sph_messages["cat_all"],$file);
    $file=str_replace('{cat_avto}',$sph_messages["cat_avto"],$file);
    $file=str_replace('{cat_web}',$sph_messages["cat_web"],$file);
    $file=str_replace('{cat_znakom}',$sph_messages["cat_znakom"],$file);
    $file=str_replace('{cat_games}',$sph_messages["cat_games"],$file);
    $file=str_replace('{cat_komp}',$sph_messages["cat_komp"],$file);
    $file=str_replace('{cat_story}',$sph_messages["cat_story"],$file);
    $file=str_replace('{cat_soft}',$sph_messages["cat_soft"],$file);
    $file=str_replace('{cat_music}',$sph_messages["cat_music"],$file);
    $file=str_replace('{cat_sport}',$sph_messages["cat_sport"],$file);
    $file=str_replace('{cat_dom}',$sph_messages["cat_dom"],$file);
    $file=str_replace('{cat_business}',$sph_messages["cat_business"],$file);
    $file=str_replace('{cat_zarabotok}',$sph_messages["cat_zarabotok"],$file);
    и так еще over9000 cтрок

    мои глаза...

    TBoolean, 10 Февраля 2012

    Комментарии (13)
  5. SQL / Говнокод #9386

    −121

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    CASE st.testmode_order_active
    WHEN NULL THEN '1'
    WHEN '1' THEN '0'
    WHEN '0' THEN '1'
    as testmode_product_active

    кусок sql запроса с реального проекта. логика в БД одна, в приложении - обратная.

    codename, 10 Февраля 2012

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

    +997

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    for (int z=NewArray[y-1];z<(NewArray[y]-1);z++)
                    {
                      AnsiString ts = IntToStr(z+1);
                      int inum = -1;
                      try{
                        inum = StrToInt(ts);
                      } catch(...) {}
    ..... //дальше inum не используется
                    }

    Завис надолго. Так и не понял, зачем автор преобразовывает ts обратно

    dm-ua, 10 Февраля 2012

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

    +158

    1. 1
    if( !( $users['align'] > 1 AND $users['align'] < 3 ) ) die();

    laplay, 10 Февраля 2012

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

    +154

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    foreach($files as $k => $obj){
    	foreach($obj as $key => $val){
    		$temp[$val['file_sort']]=$key;	
    	}
    	ksort($temp);
    	foreach($temp as $key => $val){
    		$temp2[$val]=$obj[$val];
    	}
    	$files[$k]=$temp2;
    }

    не осилил usort(), удаляет ключи... =((

    Zyets, 10 Февраля 2012

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

    +141

    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
    private void tlistObject_SelectedIndexChanged(object sender, EventArgs e)
    {
    	IMapObject oTarget = this.tlistObjects.SelectedItem as IMapObject;
    
    	if (oTarget != null)
    	{
    		if (this.SelectedObject != null)
    		{
    			this.SelectedObject.ObjectMode = ObjectModeElements.None;
    		}
    		this.SelectedObject = this.tlistObjects.SelectedItem as IMapObject;
    		this.SelectedObject.ObjectMode = ObjectModeElements.Selected;
    	}
    }

    (Is + Explicit приведение) или (As + проверка на Null)?
    Ход конём.
    ОБЯЗАТЕЛЬНОЕ использование this при обращении к полям, свойствам и методам текущего класса - отдельная тема. Это одна из особенностей неповторимого стиля, присущего аффтару. Весь код забит thisами под завязку.

    ICELedyanoj, 10 Февраля 2012

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

    +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
    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
    function mydebug($arr1=array(), $narr1='', $arr2=array(), $narr2='', $arr3=array(),$narr3='',$arr4=array(),$narr4='',$arr5=array(),$narr5='',$arr6=array(),$narr6='',$arr7=array(),$narr7='' ) {
    	$var = 'arr';
    	$nvar =  'narr';
    	$quit = false;
    	for($i=1; $i<8; $i++) {
    		if(${$var.$i} == 'exit' ) {
    				$quit = true;
    				continue;
    			}
    			 
    			elseif( !is_array(${$var.$i}) || is_array(${$nvar.$i})) {
    				${$var.$i} = false;
    				${$nvar.$i} = false;
    			}
    			 
    			elseif(!empty(${$var.$i})) {
    				echo ${$nvar.$i}.'<br>';
    				var_dump(${$var.$i});
    				echo "<hr>";
    			}
    			 
    			else continue;
    	}
    	if($quit == true) {
    		exit;
    	}
    }

    breathe, 10 Февраля 2012

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