1. bash / Говнокод #3164

    −135

    1. 1
    find $PWD -maxdepth 0 2>/dev/null

    Вместо "ls"...

    13thslayer, 06 Мая 2010

    Комментарии (4)
  2. Pascal / Говнокод #3163

    +98

    1. 1
    dmauto.tout.FieldByName('nomer').AsString:=       inttostr(inc(strtoint(dmauto.tout.FieldByName('nomer').AsString)));

    max4d, 05 Мая 2010

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

    +183

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    private static function IIf($itr, $truu, $falss) {
      if($itr)
          return $truu;
      else
         return $falss;
    }

    Думаю, такое надо вносить в coding conventions...

    maxikar, 05 Мая 2010

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

    +167

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    $fileContent=file_get_contents($this->rootPath.'app/'.$this->interface.$this->handler.$this->p_h.'.php');
                	if (preg_match('/class\s{1,}\b'.$this->handler.$this->p_h.'\b/i', $fileContent,$matches)) {
                        .............
                        if (preg_match('/function\s{1,}\b'.$this->action.$this->p_a.'\b/i', $fileContent,$matches)) {
                			$class=$this->handler.$this->p_h;
    				$action=$this->action.$this->p_a;
                			$this->includeClass($class,$action);
                            return;
    
                         .............

    Так мы проверяем наличие медота в классе ((

    minisot, 05 Мая 2010

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

    +163

    1. 1
    2. 2
    3. 3
    if(preg_match("#puid=(\d+)#si",$_SERVER['REQUEST_URI'],$m)) {
                     $parent_user_id = $m[1]; 
                     ................

    Получаем $_GET

    minisot, 05 Мая 2010

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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    function summArray($arr) 
    {
        $summ = 0;
        foreach($arr as $a) {
            $summ += intval($a);
        }
        
        return $summ;
    }

    minisot, 05 Мая 2010

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

    +166

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    function trimzero($i){
    	$i=trim($i);
    	if(is_string($i) && strlen($i)>1){
    		while(ereg("^0",$i))
    			$i=ereg_replace("^0",'',$i);
    	}
    	return $i;
    }

    minisot, 05 Мая 2010

    Комментарии (14)
  8. C++ / Говнокод #3157

    +100

    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
    int wmain()
    {
                    _rmCfg rmCfg;
                    double tt;
                    int i;
    
                            String *filePath=S"C:\\rm\\rm.cfg";
                            String * sqlstr;
                            rmCfg.isread=0;
                            String * dir[];
                            DateTime dt;
                            if (File::Exists(filePath))
                            {
                                    StreamReader *sr= new StreamReader(filePath);
                                    rmCfg.gosanPath=sr->ReadLine();
                                    rmCfg.iakServer=sr->ReadLine();
                                    rmCfg.iakUser=sr->ReadLine();
                                    rmCfg.iakPassword=sr->ReadLine();
                                    rmCfg.trackId=sr->ReadLine()->ToInt32(0);
                            //      rmCfg.trName=sr->ReadLine();
    
                                    Console::WriteLine(S"Viewing directory: ");
                                    Console::Write(rmCfg.gosanPath);
                                    Console::WriteLine();

    Писано было на втором фреймворке. Так бы и продолжал писать, если бы товарищ не намекнул про сериализацию.

    ursus, 05 Мая 2010

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

    +164

    1. 1
    2. 2
    3. 3
    <?php
    $count =300;
    define('MAXPROCESS',$count);

    $count дальше естественно нигде не используется..

    null, 05 Мая 2010

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

    +130

    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
    //Сам скрипт
    #!/bin/sh
    cat /opt/chtag/truechars > /opt/chtag/tf
    printf " $1@" >> /opt/chtag/tf
    mp3info -p "%t" "$1">> /opt/chtag/tf
    /opt/chtag/a.out < /opt/chtag/tf > /opt/chtag/t3
    sh /opt/chtag/t3
    
    //truechars
    абвгдеёжзийклмнопрстуфхцчшщьыъэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯ
    
    //Исходники a.out
    #include <iostream>
    using namespace std;
    int main()
    {
        int i,j;
        string name,s,as="",truec;
        cin >> truec;
        cin >> s;
        while(!cin.eof()) {as+=" "+s; cin >> s;}
        name=as.substr(1,as.find("@",0)-1);
        as=as.substr(as.find("'")+1);
        for(i=0; i<truec.size(); i++)
        {
    	if(as.find(truec[i],0)<truec.size())
    	{
    	    cout << "printf \"" << name << " OK!\\n\"" << endl;
    	    return 0;
    	}
        }
        cout << "printf \""<<name<<"\\'s tags will be changed...\\nBefore\\n\";\n"
    	    "mp3info \""<< name << "\";\n"
    	    "mid3iconv -e CP1251 -d --remove-v1 \""<< name << "\";\n"
    	    "printf \"Now\\n\"\nmp3info \"" << name << "\""
    	 << endl;
        return 0;
    }

    Вообще должен кодировку в русских тэгах в mp3 нормальной делать...

    Tanger, 04 Мая 2010

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