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

    В номинации:
    За время:
  2. Куча / Говнокод #8809

    +137

    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
    function ShowRubricThread(parent_id)
    		{
     
    		myArray = new Array('menu1_child_of_0','menu2_child_of_1','menu3_child_of_2','menu4_child_of_2','menu18_child_of_2','menu21_child_of_2','menu23_child_of_21','menu25_child_of_21','menu28_child_of_21','menu200_child_of_21','menu30_child_of_21','menu32_child_of_21','menu33_child_of_2','menu180_child_of_2','menu202_child_of_2','menu46_child_of_1','menu131_child_of_46','menu132_child_of_131','menu137_child_of_131','menu138_child_of_131','menu47_child_of_46','menu48_child_of_46','menu50_child_of_46','menu51_child_of_46','menu52_child_of_51','menu53_child_of_51','menu54_child_of_51','menu55_child_of_46','menu59_child_of_1','menu61_child_of_59','menu62_child_of_59','menu17_child_of_0','menu184_child_of_17','menu185_child_of_184','menu186_child_of_184','menu187_child_of_184','menu188_child_of_184','menu189_child_of_184','menu190_child_of_184','menu191_child_of_184','menu192_child_of_184','menu197_child_of_184','menu194_child_of_184','menu63_child_of_17','menu64_child_of_63','menu65_child_of_63','menu66_child_of_63','menu67_child_of_63','menu68_child_of_63','menu69_child_of_63','menu70_child_of_63','menu71_child_of_63','menu84_child_of_63','menu73_child_of_63','menu74_child_of_17','menu77_child_of_17','menu81_child_of_17','menu124_child_of_0','menu125_child_of_124','menu126_child_of_124','menu129_child_of_124','menu130_child_of_124','menu182_child_of_124','menu198_child_of_124','menu141_child_of_0','menu142_child_of_141','menu143_child_of_141','menu144_child_of_141','menu146_child_of_141','menu177_child_of_141','menu147_child_of_141','menu148_child_of_141','menu149_child_of_141','menu150_child_of_141','menu151_child_of_141','menu152_child_of_141','menu153_child_of_141','menu154_child_of_141','menu155_child_of_141','menu156_child_of_141','menu157_child_of_141','menu201_child_of_141','menu8_child_of_0','menu160_child_of_8','menu161_child_of_8','menu162_child_of_8','menu163_child_of_8','menu164_child_of_8','menu165_child_of_8','menu166_child_of_8','menu203_child_of_0','menu204_child_of_203','menu11_child_of_0','menu105_child_of_11','menu181_child_of_11','menu108_child_of_11','menu109_child_of_11','menu110_child_of_11','menu111_child_of_11','menu12_child_of_0','menu199_child_of_12','menu168_child_of_12','menu179_child_of_12','menu115_child_of_12','menu116_child_of_12','menu117_child_of_12','menu170_child_of_117','menu167_child_of_12','menu178_child_of_12','menu13_child_of_0','menu174_child_of_13','menu14_child_of_0','menu120_child_of_14','menu121_child_of_14','menu122_child_of_14','menu123_child_of_14');
    					for(var i=0; i < myArray.length; i++)
    					{
     
    							reg_string = "_child_of_" + parent_id + "$";
    							reg = new RegExp(reg_string);
    							newArray = myArray[i].match(reg);
    							if( newArray != null)
    							{
    							document.getElementById(myArray[i]).style.display = "block";
    							}
     
    					}
     
    		ShowTread = true;
     
    		}

    http://chechnya.gov.ru/page.php?day=102&month=13&year=2222
    Формат мой.    и говнокода

    dos_, 13 Декабря 2011

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

    +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
    // Крон скрипт
    set_time_limit(0);
    ini_set('memory_limit', 2548576000);
    
    // проверим запущен ли скрипт
    $shell_script = __FILE__;
    $grep_name = substr(basename($shell_script), 0, -4);
    exec("ps ax | grep {$grep_name} | grep -v grep | grep -v flock", $process);
    
    if (count($process) > 1) {
        die("\n Ошибка! Еще не отработал запущенный ранее скрипт! \n");
    }
    
    
    //... код клонирования базы с миллонами строк

    Halfi, 09 Декабря 2011

    Комментарии (5)
  4. ActionScript / Говнокод #8745

    −119

    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
    private function pathfindingOfHell(begin:Point, to:Point, delPoint:Point):Boolean
    		{
    			var aop:Vector.<GameFigure> = new Vector.<GameFigure>();
    			aop.push(arr[begin.x][begin.y]);
    			var i:uint = 0;
    			while (i != count * 2 - 1)
    			{
    				for (var x_:int = -1;x_ < 2;x_++)
    					for (var y_:int = -1;y_ < 2;y_++)
    					{
    						if (x_ != 0 && y_ != 0)
    						{
    							var tP:Point = new Point(aop[aop.length - 1].x_pos + x_, aop[aop.length - 1].y_pos + y_);
    							var target:GameFigure = arr[tP.x][tP.y];
    
    							if (!target.isFreedom && !searchInArray(aop, target) && delPoint != tP)
    							{
    								aop.push(target);
    								if (target == arr[to.x][to.y])
    								{
    									aop = null;
    									return true;
    								}
    							}
    						}
    					}
    				i++;
    			}
    			aop = null;
    			return false;
    		}

    KirAmp, 06 Декабря 2011

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

    +127

    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
    //1
               if (EdgePoints[X + 1, Y] == 2)
                {
                    EdgeMap[X + 1, Y] = 1;
                    VisitedMap[X + 1, Y] = 1;
                    Travers(X + 1, Y);
                    return;
                }
                //2
                if (EdgePoints[X + 1, Y - 1] == 2)
                {
                    EdgeMap[X + 1, Y - 1] = 1;
                    VisitedMap[X + 1, Y - 1] = 1;
                    Travers(X + 1, Y - 1);
                    return;
                }
    
               //3
    
                if (EdgePoints[X, Y - 1] == 2)
                {
                    EdgeMap[X , Y - 1] = 1;
                    VisitedMap[X , Y - 1] = 1;
                    Travers(X , Y - 1);
                    return;
                }
    
               //4
    
                if (EdgePoints[X - 1, Y - 1] == 2)
                {
                    EdgeMap[X - 1, Y - 1] = 1;
                    VisitedMap[X - 1, Y - 1] = 1;
                    Travers(X - 1, Y - 1);
                    return;
                }
                //5
                if (EdgePoints[X - 1, Y] == 2)
                {
                    EdgeMap[X - 1, Y ] = 1;
                    VisitedMap[X - 1, Y ] = 1;
                    Travers(X - 1, Y );
                    return;
                }
                //6
                if (EdgePoints[X - 1, Y + 1] == 2)
                {
                    EdgeMap[X - 1, Y + 1] = 1;
                    VisitedMap[X - 1, Y + 1] = 1;
                    Travers(X - 1, Y + 1);
                    return;
                }
                //7
                if (EdgePoints[X, Y + 1] == 2)
                {
                    EdgeMap[X , Y + 1] = 1;
                    VisitedMap[X, Y + 1] = 1;
                    Travers(X , Y + 1);
                    return;
                }
                //8
    
                if (EdgePoints[X + 1, Y + 1] == 2)
                {
                    EdgeMap[X + 1, Y + 1] = 1;
                    VisitedMap[X + 1, Y + 1] = 1;
                    Travers(X + 1, Y + 1);
                    return;
                }

    Разворот циклов ручками
    Автор кода из Индии.
    http://www.codeproject.com/KB/cs/Canny_Edge_Detection.aspx

    killerDJO, 01 Декабря 2011

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

    +146

    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
    if ($url=='/news/index.html')
    {
    	$data = $this->dbf->execute('select * from news where status=1 order by date_add desc,id desc limit 10');
    	$object->smarty->assign('news_body',$data);
    	$object->smarty->assign('title','Новости');
    } elseif(preg_match('@/news/([0-9]+?)/@i',$url,$out)){
    			$data = $this->dbf->execute('select * from news where status=1 and id='.intval($out[1]).' order by date_add desc limit 1');
    			$object->smarty->assign('news_body',$data);
    			$object->smarty->assign('title','Новости');			
    } elseif($url=='/search/') {
    	$data = array();
    			
    	if ($_POST['search']!='' && strlen($_POST['search'])>6)
    	{
    		$data = $this->dbf->execute('select * from pages where content like "%'.mysql_real_escape_string($_POST['search'],$this->dbh->conn).'%" limit 10');
    	}
    	$object->smarty->assign('search',$data);
    	$object->smarty->assign('title','Поиск');
    	$object->smarty->assign('news',$this->dbh->execute('select * from news where status=1 order by date_add desc limit 3'));
    			
    } else {
    	$data = $this->dbf->execute('select * from pages where link="'.mysql_real_escape_string($url,$this->dbh->conn).'"');
    	$this->data = $data[0];
    	$object->smarty->assign('title',$this->data['title']);
    	$object->smarty->assign('news',$this->dbh->execute('select * from news where status=1 order by date_add desc limit 3'));
    }

    laplay, 29 Ноября 2011

    Комментарии (5)
  7. ActionScript / Говнокод #8623

    −92

    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
    var num = 100000;
    function setArray(num){
        var arr = new Array();
        var i:Number = 0;
        for (i=0;i<num;i++){
            arr[i] = 'ytrjnjht pyfxtybt';
        }
    }// 422
    function setArray2(num){
        for (i=0;i<num;i++){
            arr[i] = 'ytrjnjht pyfxtybt';
        }
    }//562
    function setArray3(num){
        for (var i=0;i<num;i++){
            arr[i] = 'ytrjnjht pyfxtybt';
        }
    }//344
    function setArray4(num){
        var arr:Array = new Array();
        var i:Number = 0;
        for (i=0;i<num;i++){
            arr.push('ytrjnjht pyfxtybt');
        }
    }//516
    function setArray5(num){
        var arr:Array = new Array();
        for (var i=0;i<num;i++){
            arr.push('ytrjnjht pyfxtybt');
        }
    }//531
    function setArray6(num){
        for (var i=0;i<num;i++){
            arr.push('ytrjnjht pyfxtybt');
        }
    }//188
    function setArray7(num){
        arr = null;
        for (var i=0;i<num;i++){
            arr.push('ytrjnjht pyfxtybt');
        }
    }//141

    Любопытный тест производительности.

    Govnocoder#0xFF, 23 Ноября 2011

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

    +168

    1. 1
    $_SESSION['lang_code'] = isset($_GET['lang_code']) ? file_exists("languages/lang_".$_GET['lang_code'].".php") ? $_GET['lang_code'] : isset($_SESSION['lang_code']) ? $_SESSION['lang_code'] : 'ru' : 'ru';

    LmSys, 23 Ноября 2011

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

    −100

    1. 1
    2. 2
    3. 3
    4. 4
    class SomeThing(object)
        def _get_value(self):
            return #return some value
        get_value = property(_get_value)

    Декораторы? не не слышал.

    Zapix, 23 Ноября 2011

    Комментарии (5)
  10. Python / Говнокод #8603

    −85

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    def __getattr__(self,name):
            if name == '_creator':
                 return 'Article'
            else:
                 raise AttributeError

    H1D, 22 Ноября 2011

    Комментарии (5)
  11. Куча / Говнокод #8598

    +146

    1. 1
    http://rondo-pizza.kiev.ua/menu-order 14к с чертом строк говна

    по ссылке 14к с чертом строк говна в исходниках страницы

    ageron, 22 Ноября 2011

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