- 1
- 2
- 3
string destination = null;
for (int i = 0; i < 13; i++)
destination += source[i];
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+119.1
string destination = null;
for (int i = 0; i < 13; i++)
destination += source[i];
Копирование строки
+64.6
private static final int LENGHT255 = 255;
private static final int LENGHT450 = 450;
private static final int LENGHT3 = 3;
private static final int LENGHT5 = 5;
Константы для проставления длин в Entity.
−293.6
If (g_manager.isVehicleArrived) Then
....
g_data_layer.registerVehicle( new_vehicle )
Else
'Do Nothing
End If
'и Do Nothing еще в 20 блоках идущих подряд
Кусок кода из одной очень серьезной системы, стоящей >2500$. Изменения несущественны, но суть говнокода не изменилась.
+108.8
...
IEnumerable<Status> Statuses;
public Status GetCurrentStatus1() {
var e = Statuses.GetEnumerator();
e.MoveNext();
return e.Current;
}
public Status GetCurrentStatus2() {
foreach (var e in Statuses)
return e;
return null;
}
public Status GetCurrentStatus3() {
return Statuses.FirstOrDefault();
}
Возник вопрос - что больший говнокод? Или есть вариант лучше? (3 вариант хорош, но только когда .NET 3 есть)
+152.9
if (isset($this->handle) || !isset($this->handle) {
echo "Не правильный тип ресурса... или не тип ресурса не известен..."
}
...
...
...
Проверим дескриптор :D
+148
<script type="text/javascript">
$(document).ready(function(){
$(".in").hover(
function () {
$(this).css("background-color","#EEE7C5");
},
function () {
$(this).css("background-color","#97CAFF");
}
)
});
</script>
<div onclick="location.href='feed2.png';" style="cursor: pointer;" class="in">
Блог
</div>
−346
import time
print time.ctime(1234567890)
Перевод времени из Unix-time формата
+142
require_once ('../classes/class.partners.php');
ГовнокодЛайт:: наверное все так, по непонятным причинам???
Для чего в папке "classes" называть все файлы с "class."??
+89.9
static char DigitToChar(
int _Digit
)
{
switch (_Digit)
{
case 0: return '0';
case 1: return '1';
case 2: return '2';
case 3: return '3';
case 4: return '4';
case 5: return '5';
case 6: return '6';
case 7: return '7';
case 8: return '8';
case 9: return '9';
default: return ':';
}
}
в результате долгих размышлений всетаки заменили на return '0' + _Digit;
+11.6
function SetFileAccessPermission($path, $arPermissions, $bOverWrite=true)
{
CMain::InitPathVars($site, $path);
$DOC_ROOT = CSite::GetSiteDocRoot($site);
if(strlen($path) <= 0)
$path="/";
if(($p = bxstrrpos($path, "/"))!==false)
{
$path_file = substr($path, $p+1);
$path_dir = substr($path, 0, $p);
}
else
return false;
if($path_file=="" && $path_dir=="")
$path_file = "/";
$PERM = Array();
if(file_exists($DOC_ROOT.$path_dir."/.access.php"))
@include($DOC_ROOT.$path_dir."/.access.php");
$FILE_PERM = $PERM[$path_file];
if(!is_array($FILE_PERM))
$FILE_PERM=Array();
if(!$bOverWrite && count($FILE_PERM)>0)
return true;
$bDiff = false;
$str="<?\n";
foreach($arPermissions as $group=>$perm)
{
if(strlen($perm) > 0)
$str.="\$PERM[\"".$path_file."\"][\"".$group."\"]=\"".str_replace("\"", "\\\"", $perm)."\";\n";
if(!$bDiff && $FILE_PERM[$group]!=$perm)
$bDiff=true;
}
foreach($PERM as $file=>$arPerm)
{
if(strval($file) !==$path_file)
foreach($arPerm as $group=>$perm)
$str.="\$PERM[\"".$file."\"][\"".$group."\"]=\"".str_replace("\"", "\\\"", $perm)."\";\n";
}
if(!$bDiff)
{
foreach($FILE_PERM as $group=>$perm)
if($arPermissions[$group]!=$perm)
{
$bDiff==true;
break;
}
}
$str.="?".">";
$this->SaveFileContent($DOC_ROOT.$path_dir."/.access.php", $str);
$GLOBALS["CACHE_MANAGER"]->CleanDir("menu");
unset($this->FILE_PERMISSION_CACHE[$site."|".$path_dir."/.access.php"]);
if($bDiff)
{
$db_events = GetModuleEvents("main", "OnChangePermissions");
while($arEvent = $db_events->Fetch())
ExecuteModuleEvent($arEvent, Array($site, $path), $arPermissions);
}
return true;
}
MegaLolnii bitrix
самое смешное с 32 строчки