- 1
- 2
- 3
- 4
- 5
- 6
- 7
function IsTrue(Value: boolean): boolean;
begin
if Value <> true then result := false
else if Value <> false then result := true
else // внимание!
result := (not true) and (not false);
end;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−34.5
function IsTrue(Value: boolean): boolean;
begin
if Value <> true then result := false
else if Value <> false then result := true
else // внимание!
result := (not true) and (not false);
end;
+136.4
// string prefix = ...
query.Parameters[string.Format("{0}", prefix)].Value = m_Values[0];
из того же класса что и #2011
+160.8
function my_conv_date($ddate)
{
$d=$ddate;
$a=strpos($d,".");
$dd=substr($d,0,$a);
$d=substr($d,$a+1,10);
$a=strpos($d,".");
$mm=substr($d,0,$a);
$yy=substr($d,$a+1,10);
return ($yy."-".$mm."-".$dd);
}
перевод даты из формата d.m.Y в Y-m-d
+155.3
function gp($gp){
$gp_res=$_GET[$gp];
if ($gp_res == ''){
$gp_res=$_POST[$gp];
}
return $gp_res;
}
а поидее можно было юзать $_REQUEST[$gp]
+75.2
boolean isCustomerWMIDExists = containParameterWithName( request, CUSTOMER_WMID_PARAM_NAME );
boolean isSellerWMIDExists = containParameterWithName( request, SELLER_WMID_PARAM_NAME );
boolean isPurseExists = containParameterWithName( request, PURSE_PARAM_NAME );
boolean isDescriptionExists = containParameterWithName( request, BasePaymentSystem.DESCRIPTION_PARAM_NAME );
boolean isInvAddressExists = containParameterWithName( request, INVADDRESS_PARAM_NAME );
boolean isPeriodExists = containParameterWithName( request, PERIOD_PARAM_NAME );
boolean isExperationExists = containParameterWithName( request, EXPERATION_PARAM_NAME );
boolean isDateCrtExists = containParameterWithName( request, DATECRT_PARAM_NAME );
boolean isDateUpdExists = containParameterWithName( request, DATEUPD_PARAM_NAME );
boolean isWmInvIdExists = containParameterWithName( request, INVID_PARAM_NAME );
boolean isRequestNExists = containParameterWithName( request, REQUESTN_PARAM_NAME );
boolean isProjectIdExists = containParameterWithName( request, BasePaymentSystem.PROJECTID_PARAM_NAME );
boolean isUserIdExists = containParameterWithName( request, BasePaymentSystem.USERID_PARAM_NAME );
boolean isCurrencyExists = containParameterWithName( request, CURRENCY_PARAM_NAME );
if (isCustomerWMIDExists && isSellerWMIDExists && isPurseExists && isDescriptionExists && isInvAddressExists && isPeriodExists
&& isExperationExists && isDateCrtExists && isDateUpdExists && isWmInvIdExists && isRequestNExists && isProjectIdExists
&& isUserIdExists && isCurrencyExists)
{
wminfo.setCustomerWMID( request.getParameter( CUSTOMER_WMID_PARAM_NAME ) );
wminfo.setSellerWMID( request.getParameter( SELLER_WMID_PARAM_NAME ) );
wminfo.setPurse( request.getParameter( PURSE_PARAM_NAME ) );
wminfo.setDescription( request.getParameter( BasePaymentSystem.DESCRIPTION_PARAM_NAME ) );
wminfo.setInvAddress( request.getParameter( INVADDRESS_PARAM_NAME ) );
wminfo.setPeriod( Byte.parseByte( request.getParameter( PERIOD_PARAM_NAME ) ) );
wminfo.setExperation( Byte.parseByte( request.getParameter( EXPERATION_PARAM_NAME ) ) );
wminfo.setDateCrt( ( getWebMoneyDateString( Long.parseLong( request.getParameter( DATECRT_PARAM_NAME ) ) ) ) );
wminfo.setDateUpd( ( getWebMoneyDateString( Long.parseLong( request.getParameter( DATEUPD_PARAM_NAME ) ) ) ) );
wminfo.setWmInvID( request.getParameter( INVID_PARAM_NAME ) );
wminfo.setRequestN( Long.parseLong( request.getParameter( REQUESTN_PARAM_NAME ) ) );
wminfo.setCurrency( Currency.getInstance( request.getParameter( CURRENCY_PARAM_NAME ) ) );
...
}
Разбор параметров GET-запроса, переданных из http://govnokod.ru/2015
// не дай бог, начальство заметит, что я рабочий код публикую
+80.4
StringBuilder sb = new StringBuilder();
sb.append( "?" + BasePaymentSystem.CHECKPAYMENT_PARAM_NAME + "=true&" + WebMoneyXmlSystem.CUSTOMER_WMID_PARAM_NAME + "="
+ getCustomerWMID() + "&" + WebMoneyXmlSystem.CURRENCY_PARAM_NAME + "=" + getCurrency().toString() + "&"
+ WebMoneyXmlSystem.SELLER_WMID_PARAM_NAME + "=" + _sellerWMID + "&" + WebMoneyXmlSystem.PURSE_PARAM_NAME + "=" + _purse
+ "&" + WebMoneyXmlSystem.DESCRIPTION_PARAM_NAME + "=" + getDescription() + "&" + WebMoneyXmlSystem.INVADDRESS_PARAM_NAME
+ "=" + _invAddress + "&" + WebMoneyXmlSystem.PERIOD_PARAM_NAME + "=" + _period + "&"
+ WebMoneyXmlSystem.EXPERATION_PARAM_NAME + "=" + _experation + "&" + WebMoneyXmlSystem.DATECRT_PARAM_NAME + "="
+ dateCreateMills.toString() + "&" + WebMoneyXmlSystem.DATEUPD_PARAM_NAME + "=" + dateUpdateMills.toString() + "&wmInvId="
+ _wmInvId + "&requestN=" + String.valueOf( _requestn ) + "&" + BasePaymentSystem.PROJECTID_PARAM_NAME + "="
+ _projectId.toString() + "&" + BasePaymentSystem.USERID_PARAM_NAME + "=" + _userId.toString() );
return new String( sb );
Формирование строки GET запроса.
+133.7
try
{
var st = ((JsonString)options["tribes"]).Value.Split(',');
foreach (var s in st)
{
if (s != string.Empty)
{
ShowTribes.Add(s);
}
}
}
catch (KeyNotFoundException)
{ }
try
{
ShowNotes = ((JsonString)options["show_comments"]).Equals("true") || (url.IndexOf("#note_id=") != -1);
}
catch (KeyNotFoundException)
{ }
try
{
Rating = ((JsonString)options["eye"]).Value;
}
catch (KeyNotFoundException)
{ }
+77.5
//devPin и pin - массивы байт, а сравниваем мы их так :
if (Utils.bytesToHex(devPin).equals(Utils.bytesToHex(pin))) {
....
:)))
+138.7
$ИF$_PIZDEC()==PIZDEC().eahc(fucntion)({
dacumetn .gэt elementbyid["id"}.stile.displey=none
else{
stile displey=blok
] <\govnosrciptiГГГ}
ыыы
+99
new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
Создание даты