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

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

    +153

    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
    function strum($text, $simb)
    {
    if(mb_strlen($text, 'UTF-8') > $simb){
    
    }
    if(mb_strlen($text, 'UTF-8') > $simb)
      {
    	$start = 0;
    	for($i = 0; $i <= (ceil(mb_strlen($text, 'UTF-8') / $simb)); $i++)
    	{
    
    		$tmp = mb_strpos($text, '. ', $start + $simb, 'UTF-8');
    		if(is_numeric($tmp))
    		{
    			$num[] = $tmp;
    
    		}
    		$tmp = mb_strpos($text, '! ', $start  + $simb, 'UTF-8');
    				if(is_numeric($tmp))
    		{
    			$num[] = $tmp;
    
    		}
    		$tmp = mb_strpos($text, '? ', $start  + $simb, 'UTF-8');
    				if(is_numeric($tmp))
    		{
    			$num[] = $tmp;
    
    		}
    		if($num != '')
    		{
    		$end = min($num) + 1;
    		}
    		if($end <= $start)
    		{
    			$end = mb_strlen($text, 'UTF-8');
    		}
    		$str = mb_substr($text, $start, $end, 'UTF-8');
    		$string[] = mb_substr($str, 0, ($end - $start), 'UTF-8');
    
    	$start = $end;
    	unset($num);
    	unset($str);
    	unset($tmp);
    	if($end == mb_strlen($text, 'UTF-8'))
    		{
    			break;
    		}
    	}
      }
      else
      {
      $string[] = $text;
      }
      return $string;
    
    }

    Функция для умной разбивки

    Arrim, 15 Августа 2009

    Комментарии (1)
  3. Perl / Говнокод #1530

    −117.2

    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
    my $cache_sql="SELECT `content`, `insertTime` FROM _cache WHERE `confid`='$$conf{confid}'";
    ...
        $cache_sql.=" AND `location`=".$self->{dbh}->quote($url);
    ...
        $cache_sql.=" AND `cgiparams`=".$self->{dbh}->quote($cgi_hash);
    ...
        $cache_sql.=" AND `callparams`=".$self->{dbh}->quote($callp_hash);
    ...
        $cache_sql.=" AND `userid`=".int($$params{userid});
    ...
        $cache_sql.=" AND `groupid`=".int($$params{groupid});
    
       my $replace_sql=$cache_sql;
       $replace_sql=~s/SELECT.*?FROM\s+_cache\s+WHERE/REPLACE INTO _cache SET/s;

    perl+sql

    poltora, 11 Августа 2009

    Комментарии (1)
  4. Perl / Говнокод #1529

    −101

    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
    my $iref=$self->{ditems}->_get_item({itemid=>$weather_itemid, set=>'Weather', fields=>['MinT', 'MaxT', 'Precip', 'Cloud', 'twater'], prefix=>$$p{prefix}});
        if ($$iref{$$p{prefix}.'MinT'}<0 && $$iref{$$p{prefix}.'MaxT'}<=0) {
            my $tmp=$$iref{$$p{prefix}.'MaxT'};
            $$iref{$$p{prefix}.'MaxT'}=$$iref{$$p{prefix}.'MinT'};
            $$iref{$$p{prefix}.'MaxT'}=$tmp;
        };
        #warn $$iref{$$p{prefix}.'MinT'} if !$$iref{$$p{prefix}.'MinT'}>0;
        $$iref{$$p{prefix}.'T'}=int( ($$iref{$$p{prefix}.'MinT'}+$$iref{$$p{prefix}.'MaxT'})/2 );
        $$iref{$$p{prefix}.'T'}='+'.$$iref{$$p{prefix}.'T'} if $$iref{$$p{prefix}.'T'}>0;
        #$$iref{$$p{prefix}.'T'}=~s/\-/\&\#150\;/gs;
        $$iref{$$p{prefix}.'MinT'}='+'.$$iref{$$p{prefix}.'MinT'} if ($$iref{$$p{prefix}.'MinT'}>0);
        $$iref{$$p{prefix}.'MaxT'}='+'.$$iref{$$p{prefix}.'MaxT'} if ($$iref{$$p{prefix}.'MaxT'}>0);
        $$iref{$$p{prefix}.'twater'}='+'.$$iref{$$p{prefix}.'twater'} if ($$iref{$$p{prefix}.'twater'}>0);
        
        $$iref{$$p{prefix}.'time'}=$$p{daystart}+$$p{hour}*3600;

    poltora, 11 Августа 2009

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

    +132.5

    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
    public Image ResultImage
            {
                get
                {
                    return GetCut();
                }
            }
    
            private Image GetCut()
            {
                Bitmap b1 = new Bitmap(border.Width, border.Height);
    
                Bitmap b = new Bitmap(pictureBox1.Image.GetThumbnailImage(pictureBox1.Width, pictureBox1.Height, new Image.GetThumbnailImageAbort(fff), IntPtr.Zero));
                int x = border.Location.X;
                int y = border.Location.Y;
    
                int x1 = border.Location.X + border.Width;
                int y1 = border.Location.Y + border.Height;
    
                for (int i = x; i < x1; i++)
                {
                    for (int j = y; j < y1; j++)
                    {
                        b1.SetPixel(i - x, j - y, b.GetPixel(i, j));
                    }
                }
                return b1;
            }
    
            public bool fff()
            {
                return false;
            }

    Вырезка прямоугольника из битмапа.

    guest, 08 Августа 2009

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

    +143

    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
    (12:30:38) * Joins: skimer ([email protected])
    (12:38:37) * Joins: snaky ([email protected])
    (12:39:30) * Viktor-S http://radio.XF.lv:8000/listen.pls RADIO EFIR 1x1 duality- vS b0rm 150 LS NA KANU!!!!!!!!!!!!! V EFIRE Viktor-S !!!!!!!!!!!!!!!!!!!!
    (12:39:32) * Viktor-S http://radio.XF.lv:8000/listen.pls RADIO EFIR 1x1 duality- vS b0rm 150 LS NA KANU!!!!!!!!!!!!! V EFIRE Viktor-S !!!!!!!!!!!!!!!!!!!!
    (12:42:12) * Joins: gErayke ([email protected])
    (12:43:09) * Quits: snaky ([email protected]) (Quit: snaky)
    (12:43:48) * Viktor-S http://radio.XF.lv:8000/listen.pls RADIO EFIR 1x1 duality vS b0rm. 150 LS NA KANU!!!!!!!!!!!!! V EFIRE Viktor-S !!!!!!!!!!!!!!!!!!!!
    (12:48:14) * Quits: z1Pp0- ([email protected]) (Quit: z1Pp0-)
    (12:51:26) * TheDimmy /Y\ ???? ?? ???????: Tuc-Tuc*. /Y\ ?????: 12:51:40 /Y\
    (12:51:45) * Viktor-S http://radio.XF.lv:8000/listen.pls RADIO EFIR 1x1 duality vS b0rm. 150 LS NA KANU!!!!!!!!!!!!! V EFIRE Viktor-S !!!!!!!!!!!!!!!!!!!!
    (12:53:57) * Viktor-S http://radio.XF.lv:8000/listen.pls RADIO EFIR 1x1 duality vS b0rm. 150 LS NA KANU!!!!!!!!!!!!! V EFIRE Viktor-S !!!!!!!!!!!!!!!!!!!!
    (12:53:58) * Viktor-S http://radio.XF.lv:8000/listen.pls RADIO EFIR 1x1 duality vS b0rm. 150 LS NA KANU!!!!!!!!!!!!! V EFIRE Viktor-S !!!!!!!!!!!!!!!!!!!!
    (12:54:23) * Viktor-S http://radio.XF.lv:8000/listen.pls RADIO EFIR 1x1 duality vS b0rm. 150 LS NA KANU!!!!!!!!!!!!! V EFIRE Viktor-S !!!!!!!!!!!!!!!!!!!!
    (12:59:41) * Viktor-S http://radio.XF.lv:8000/listen.pls RADIO EFIR 1x1 duality vS b0rm. 150 LS NA KANU!!!!!!!!!!!!! V EFIRE Viktor-S !!!!!!!!!!!!!!!!!!!!
    (12:59:41) * Viktor-S http://radio.XF.lv:8000/listen.pls RADIO EFIR 1x1 duality vS b0rm. 150 LS NA KANU!!!!!!!!!!!!! V EFIRE Viktor-S !!!!!!!!!!!!!!!!!!!!

    da

    guest, 07 Августа 2009

    Комментарии (1)
  7. Куча / Говнокод #1486

    +153

    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
    #! /bin/sh
    if [ ! -d $4 ]
    then
    echo Creating $4
    mkdir "$4"
    fi
    export url1="\/$2/src\/\d{1,30}\.[^ ]{1,3}"
    export url2="\/$2\/"/"http\:\/\/$1\/$2\/"
    #echo $url1 $url2
    echo Entering $4
    cd "$4" && rm -f $3.html && wget http://$1/$2/res/$3.html -O $3.html && cat $3.html |pcregrep -o -e "$url1" |sed s/$url2/g|uniq >get.txt && wget -nc -i get.txt --referer="http://$1/$2" -U "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 (.NET CLR 3.5.30729)"
    
    rm -f get.txt
    echo Done!

    запуск сприпт сайт борда #_темы куда_сохранять

    guest, 07 Августа 2009

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

    +139.3

    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
    <?
    
    $num=2.324;
    $nll=$num%1;
    
    $pnt=234;
    $ine=$pnt*$nll+1;
    
    if($currentstate==$ine){
     $acceptedstate=1;
    }
    else if($currentstate==$nll){
     $acceptedstate=0;
    }
    else return "NaN";
    ?>

    Кусок кода одной из "Мего-ЦМСок", найденной на woweb-e.

    guest, 05 Августа 2009

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

    +148

    1. 1
    2. 2
    3. 3
    SetPixel (GetPixel (GetPixel (GetPixel (GetPixel (GetPixel ((COLORREF) rand(), (int) rand(), (int) rand());
    
    #define SetPixel(GetPixel(GetPixel(GetPixel(GetPixel(GetPixel((COLORREF)rand(),(int)rand(),(int)rand());

    GetPixel возвращает преведущее значение пикселя.
    Так что этот код павильный, и ничего не делает.
    А 3 строчка защищает от таких ошибок!

    guest, 05 Августа 2009

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

    +139.6

    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
    class db
    {
    	public function __call($m,$args)
    	{
    		$export = array_map(function($v) { return var_export($v,1);},$args);
    		$str = $m."(".implode(',',$export).");";
    		$str = escapeshellarg($str);
    		$str = "/home/robot/db.class.php {$str};";
    		$answer = `$str`;
    		eval('$res = '.$answer.';');
    		@array_walk_recursive($res,function(&$v) { $v = iconv('cp1251','utf-8',$v); });
    		return $res;
    	}
    }
    
    //сам db.class.php
    
    $db = new db($host,$db,$user,$pass);
    eval('$res = $db->'.$argv[1]);
    var_export($res);

    интерпрайз

    guest, 05 Августа 2009

    Комментарии (1)
  11. PHP / Говнокод #1440

    +140

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if (!isset($GLOBALS['ISC_CLASS_CART'])) {
      $GLOBALS['ISC_CLASS_CART'] = GetClass('ISC_CART');
    }
    
    $GLOBALS['ISC_CLASS_CART'] = GetClass('ISC_CART');

    Отрывок кода из Interspire Shopping Cart
    Пунктуация сохранена...

    guest, 29 Июля 2009

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