1. Objective C / Говнокод #7916

    −104

    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
    - (IBAction)actionCancel {
        if (delegate && [delegate respondsToSelector:@selector(dismissPopover)]) {
            [delegate performSelector:@selector(dismissPopover)];
            return;
        }
     
        ///<Фамилия> блять - убей себя об стенку
        // +1 !
    	if (parentTasks)
    		[parentTasks actionAddCommentDismiss];
    	if (parentNewsfeed)
    		[parentNewsfeed actionPopoverDismiss];
    	if (parentCompanies)
    		[parentCompanies actionPopoverDismiss];
    	if (parentProjects)
    		[parentProjects actionPopoverDismiss];
        if (parentContacts)
    		[parentContacts actionPopoverDismiss];
    }

    Комментарии для того, чтобы комментировать :)

    Kessler, 21 Сентября 2011

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

    +161

    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
    function checkEmail(form){	
        var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
        if(pattern.test(form.email.value)  &&  (!((form.fio.value=="")||(form.email.value=="")||(form.message.value=="")) ))
    	{   
    	//Возвращаем правду
    	return true;  
        }
    	
    	else
    	{   
    	//Выводим на экран сообщение
    	alert("Вы заполнили не все поля и/или неверно заполнили поле e-mail");
        //Возвращаем ложь
        return false;
        }
    }

    Валидаторы валидируют. Форматирование сохранено.

    telnet, 21 Сентября 2011

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

    +103

    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
    ...
    var count: integer;
          summ: integer;
    begin
     try
      case count of
        1: summ:=StrToInt(EditBox1.Text);
        2: summ:=StrToInt(EditBox1.Text)+StrToInt(EditBox2.Text);
        3: summ:=StrToInt(EditBox1.Text)+StrToInt(EditBox2.Text)+StrToInt(EditBox3.Text);
        4: summ:=StrToInt(EditBox1.Text)+StrToInt(EditBox2.Text)+StrToInt(EditBox3.Text)+StrToInt(EditBox4.Text);
        5: summ:=StrToInt(EditBox1.Text)+StrToInt(EditBox2.Text)+StrToInt(EditBox3.Text)+StrToInt(EditBox4.Text)+StrToInt(EditBox5.Text);
        6: summ:=StrToInt(EditBox1.Text)+StrToInt(EditBox2.Text)+StrToInt(EditBox3.Text)+StrToInt(EditBox4.Text)+StrToInt(EditBox5.Text)+StrToInt(EditBox6.Text);
        7: summ:=StrToInt(EditBox1.Text)+StrToInt(EditBox2.Text)+StrToInt(EditBox3.Text)+StrToInt(EditBox4.Text)+StrToInt(EditBox5.Text)+StrToInt(EditBox6.Text)++StrToInt(EditBox7.Text);
        8: summ:=StrToInt(EditBox1.Text)+StrToInt(EditBox2.Text)+StrToInt(EditBox3.Text)+StrToInt(EditBox4.Text)+StrToInt(EditBox5.Text)+StrToInt(EditBox6.Text)++StrToInt(EditBox7.Text)++StrToInt(EditBox8.Text);
        9: summ:=StrToInt(EditBox1.Text)+StrToInt(EditBox2.Text)+StrToInt(EditBox3.Text)+StrToInt(EditBox4.Text)+StrToInt(EditBox5.Text)+StrToInt(EditBox6.Text)++StrToInt(EditBox7.Text)++StrToInt(EditBox8.Text)+StrToInt(EditBox9.Text);
        10: summ:=StrToInt(EditBox1.Text)+StrToInt(EditBox2.Text)+StrToInt(EditBox3.Text)+StrToInt(EditBox4.Text)+StrToInt(EditBox5.Text)+StrToInt(EditBox6.Text)++StrToInt(EditBox7.Text)++StrToInt(EditBox8.Text)+StrToInt(EditBox9.Text)+StrToInt(EditBox9.Text);
        0: summ:= 0;
      end;
     except
       ShowMessage('Error');
     end;
    end;

    Сегодня увидал у однокурсника в универе.
    Самый оптимальные метод подсчета суммы элементов EditBox, не правдали???

    alexprey, 20 Сентября 2011

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

    +164

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    if ( $fldType[$i] == 10) { 
          eval("\$fldValue[\$i] = \$f_".$fld[$i].";");
        }
        else if ( $fldType[$i] != 6 )  {
          eval("\$fldValue[\$i] = trim((is_array(\$f_".$fld[$i].")?\$_FILES['f_".$fld[$i]."']['tmp_name']:stripslashes(\$f_".$fld[$i].")));");
        }
          
    		if ($fldType[$i]==8) {
    			eval("if (\$f_".$fld[$i]."_day || \$f_".$fld[$i]."_month || \$f_".$fld[$i]."_year || \$f_".$fld[$i]."_hours || \$f_".$fld[$i]."_minutes || \$f_".$fld[$i]."_seconds) \$fldValue[\$i] = sprintf(\"%04d-%02d-%02d %02d:%02d:%02d\",\$f_".$fld[$i]."_year,\$f_".$fld[$i]."_month,\$f_".$fld[$i]."_day,\$f_".$fld[$i]."_hours,\$f_".$fld[$i]."_minutes,\$f_".$fld[$i]."_seconds);");
    		}

    NetCat, я это даже прокомментировать не могу

    nex2hex, 20 Сентября 2011

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

    +171

    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
    static void tm_to_systemtime(const tm* pTime, LPSYSTEMTIME pSysTime )
    {
    	time_t timeT = mktime((tm*)pTime);
    	FILETIME fTime = {0},lTime = {0};
    	LONGLONG ll = Int32x32To64(timeT, 10000000) + 116444736000000000;
    	fTime.dwLowDateTime = (DWORD) ll;
    	fTime.dwHighDateTime = ll >>32;
    	FileTimeToLocalFileTime(&fTime,&lTime);
    	FileTimeToSystemTime(&lTime,pSysTime);
    }
    
    static std::string GetDateTimeString(const tm& activ)
    {
    	SYSTEMTIME sysTime = {0};
    	tm_to_systemtime(&activ,&sysTime);
    	char str[256];
    	//format to <YYYYMMDDHHMMSS>
    	sprintf_s(str,sizeof(str),"%04d%02d%02d%02d%02d%02d",sysTime.wYear,sysTime.wMonth,sysTime.wDay,sysTime.wHour,sysTime.wMinute,sysTime.wSecond);
    	return std::string(str);
    }

    далеко не самый скучный способ отформатировать ::tm в виде YYYYMMDDHHmmss

    defecate-plusplus, 20 Сентября 2011

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

    +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
    <select name="ctrlCompareSearchFrame:lstDuration" id="ctrlCompareSearchFrame_lstDuration" class="inputStyle">
    			<option <?php save_dur(1);?>value="1">1 week</option>
    			<option <?php save_dur(2);?>value="2">2 weeks</option>
    			<option <?php save_dur(3);?>value="3">3 weeks</option>
    			<option <?php save_dur(4);?>value="4">4 weeks</option>
    			<option <?php save_dur(5);?>value="5">6 weeks</option>
    			<option <?php save_dur(6);?>value="6">2 months</option>
    			<option <?php save_dur(7);?>value="7">3 months</option>
    			<option <?php save_dur(8);?>value="8">4 months</option>
    			<option <?php save_dur(9);?>value="9">5 months</option>
    			<option <?php save_dur(10);?>value="10">6 months</option>
    			<option <?php save_dur(11);?>value="11">9 months</option>
    			<option <?php save_dur(12);?>value="12">12 months</option>
    		</select>

    "зачем мне цикл ,если платят за обьем кода" думал программер

    Rubaka, 20 Сентября 2011

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

    +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
    function Parsing($raw)
    {
    
    	$RawProperty=array();
    	$Property=array();
    	$raw=str_ireplace("\n","",$raw);
    	$raw=str_replace("\r","<br/>",$raw);
    
    	preg_match_all("|<Policy>(.*)</Policy>|U",$raw,$RawProperty,PREG_OFFSET_CAPTURE);
    //print_r($RawProperty);
    	for ($k=0;$k<count($RawProperty[0]);$k++){
    
    		$Property[$k]['Insurer']=str_cut_btw_substrs("<InsurerLogoURL>","</InsurerLogoURL>",$RawProperty[0][$k][0]);
    		$Property[$k]['InsurerName']=str_cut_btw_substrs("<InsurerName>","</InsurerName>",$RawProperty[0][$k][0]);
    		$Property[$k]['Underwriter']=str_cut_btw_substrs("<UnderwriterName>","</UnderwriterName>",$RawProperty[0][$k][0]);
    		$Property[$k]['LinkURL']=str_cut_btw_substrs("<LinkURL>","</LinkURL>",$RawProperty[0][$k][0]);
    		$Property[$k]['Productname']=str_cut_btw_substrs("<ProductName>","</ProductName>",$RawProperty[0][$k][0]);
    		$Property[$k]['PremiumText']=str_cut_btw_substrs("<PremiumText>","</PremiumText>",$RawProperty[0][$k][0]);
    		$Property[$k]['PremiumEXText']=str_cut_btw_substrs("<PremiumEXText>","</PremiumEXText>",$RawProperty[0][$k][0]);
    		$Property[$k]['ExcessText']=str_cut_btw_substrs("<ExcessText>","</ExcessText>",$RawProperty[0][$k][0]);
    		$Property[$k]['LuggageText']=str_cut_btw_substrs("<LuggageText>","</LuggageText>",$RawProperty[0][$k][0]);
    		$Property[$k]['MedicalText']=str_cut_btw_substrs("<MedicalText>","</MedicalText>",$RawProperty[0][$k][0]);
    		$Property[$k]['CancelationText']=str_cut_btw_substrs("<CancelationText>","</CancelationText>",$RawProperty[0][$k][0]);
    		$Property[$k]['LiabilityText']=str_cut_btw_substrs("<LiabilityText>","</LiabilityText>",$RawProperty[0][$k][0]);
    		$Property[$k]['AdditionalFeatures']=str_cut_btw_substrs("<AdditionalFeatures>","</AdditionalFeatures>",$RawProperty[0][$k][0]);
    
    		//add fields "ExplanationText" and "IsShaded"
    		$Property[$k]['IsShaded']=str_cut_btw_substrs("<IsShaded>","</IsShaded>",$RawProperty[0][$k][0]);
    		$Property[$k]['ExplanationText']=str_cut_btw_substrs("<ExplanationText>","</ExplanationText>",$RawProperty[0][$k][0]);
    		$Property[$k]['IsBasicCover']=str_cut_btw_substrs("<IsBasicCover>","</IsBasicCover>",$RawProperty[0][$k][0]);
    		$Property[$k]['IsComprCover']=str_cut_btw_substrs("<IsComprCover>","</IsComprCover>",$RawProperty[0][$k][0]);
    
    								}
    	return $Property;
    }

    разбор xml ответа от сервера

    Rubaka, 20 Сентября 2011

    Комментарии (16)
  8. Куча / Говнокод #7909

    +128

    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
    <th style='border-left: 1px solid #97cbee;'>Premium<br />without<br />excess<span><img src='Artog/Images/empty/empty.gif' /></span>
    					<div style='position: relative; top: 0'>
    						<IMG class='str3' width='16' heigth='16' title='The excess can be removed from some plans in return for a higher premium.<br/>You can select this option when purchasing the plan from the insurer.' src="Artog/Images/Icons/InfoIcon28x28.png" />
    					</div>
    				</th>
    				<th style='border-left: 1px solid #97cbee'>Luggage/<br />Personal<br />effects<span><img src='Artog/Images/empty/empty.gif' /></span>
    					<div style='position: relative'>
    						<IMG class='str3' width='16' heigth='16' title='Coverage on luggage (typically important for people with a lot of good quality travel gear)' src="Artog/Images/Icons/InfoIcon28x28.png" />
    					</div>
    				</th>
    				<th style='border-left: 1px solid #97cbee'>Medical<br />expenses<span><img src='Artog/Images/empty/empty.gif' /></span>
    					<div style='position: relative'>
    						<IMG class='str2' width='16' heigth='16' title='How much will be contributed to any doctor's bills, emergency surgery etc. (for obvious reasons this is generally important for all travelers)' src="Artog/Images/Icons/InfoIcon28x28.png" />
    					</div>
    				</th>
    				<th style='border-left: 1px solid #97cbee'>Cancellation<br />costs<span><img src='Artog/Images/empty/empty.gif' /></span>
    					<div style='position: relative'>
    						<IMG class='str2' width='16' heigth='16' title='How much will be paid from inconvenience due to cancellation of flights etc. (typically important for people with a complex itinerary)' src="Artog/Images/Icons/InfoIcon28x28.png" />
    					</div>
    				</th>

    разбираю тут 1 проект
    <th style='border-left: 1px solid #97cbee'> <---------- индусы не знают ,что такое класс в css

    Rubaka, 20 Сентября 2011

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

    +74

    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
    public class Statuses {
        protected List<String> id;
        protected List<String> name;
    
        public List<String> getId() {
            if (id == null) {
                id = new ArrayList<String>();
            }
            return this.id;
        }
    
        public List<String> getName() {
            if (name == null) {
                name = new ArrayList<String>();
            }
            return this.name;
        }
    }
    
    Statuses statuses = new Statuses();
    List<String> statusesString = statuses.getId();

    Создание пустого списка.

    Art, 20 Сентября 2011

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

    +178

    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
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    <?
    $g_menu=0;
    if(isset($_GET['A']))
     {
    	// это реализация ЧПУ - бля, работает...
       if($_GET['A']=='oi'){$i=1;}
        if($_GET['A']=='po'){$i=2;}
          if($_GET['A']=='pt'){$i=3;}
            if($_GET['A']=='ko'){$i=5;}
         if($_GET['A']=='sl'){$i=9;}
          if($_GET['A']=='ml'){$i=11;}
          if($_GET['A']=='pd'){$i=12;}
            if($_GET['A']=='da'){$i=13;}
            if($_GET['A']=='sa'){$i=14;}
            if($_GET['A']=='na'){$i=15;}
            if($_GET['A']=='da'){$i=16;}
            if($_GET['A']=='dn'){$i=17;}  
            if($_GET['A']=='dk'){$i=18;} 
            if($_GET['A']=='im'){$i=6;} 
          if($_GET['A']=='articles'){$i=19;}   
    	  if($_GET['A']=='du'){$i=20;}   
    	   if($_GET['A']=='dz'){$i=21;}  
    	   if($_GET['A']=='ii'){$i=22;}  
    	   if($_GET['A']=='dy'){$i=23;}
    	    if($_GET['A']=='ct'){$i=24;}
    	    if($_GET['A']=='ti'){$i=25;}  
      }
    else
    {
      if (!isset($_GET['i'])){$i=0;}
      else
      {
      $i=$_GET['i'];
      if($i!=1 && $i!=2 && $i!=3  && $i!=4 && $i!=5 && $i!=6 && $i!=7 && $i!=8 && $i!=9 && $i!=11 && $i!=12 && $i!=13 
      && $i!=14 && $i!=15 && $i!=16 && $i!=17 && $i!=18 && $i!=19 && $i!=20 && $i!=21 && $i!=22 && $i!=23 && $i!=24 && $i!=25    ){$i=0;}
      }
     }
    print"
    <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
    <html>
    <head>
    ";
    print"
    <META http-equiv=Content-Type content='text/html; charset=windows-1251'>
    ";
      if($i==1 || $i==0)
    {
    print"
    <title>xxx</title>
    <meta name=Description content='xxx'>
    <meta name=Keywords content='xxx'>
    ";
    }
     if($i==2)
    {
    print"
    <title>yyy</title>
    <meta name=Description content='yyy'>
    <meta name=Keywords content='yyy'>
    ";
    }
     if($i==3)
    {
    print"
    <title>zzz</title>
    <meta name=Description content='zzz'>
    <meta name=Keywords content='zzz'>
    ";
    } 
    // далее сокращу
    if($i==5)
    {
    print"...";
    }
     if($i==9)
    {
    print"...";
    }
     if($i==11)
    {
    print"...";
    }
     if($i==12)
    {
    print"...";
    }
    // много говна, числа иногда не по порядку: реализует титлы, кейвордс и дескрипшн
     if($i==25)
    {
    print"...";
    }
    //  внезапно
    if($i==7 || $i==8 || $i==3)
    {
    print"...";
    }
    /* дальше хтмл-говно со вставками типа: <? if($g_menu==1) { print"блок хтмл-говна"; } ?> */

    Открыл я значит исходники одного сайта...

    deep, 20 Сентября 2011

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