- 1
- 2
- 3
- 4
- 5
if (array_keys($value) !== array_values(array_keys($value))) {
} else {
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+168
if (array_keys($value) !== array_values(array_keys($value))) {
} else {
}
Встретилось в ядре по работе с БД :)
+115
s.replaceAll("(\\/\\.\\.\\/)+", "/").replaceFirst("^((\\.)+\\/)+", "");
вот такие вот суровые паттерны
как я это увидел - мне сразу вид двух друзей переханных трактором вспомнился
String s="../../../a./../../files/file1.rar"; // надо убрать строки вида "../"
+133
count=15;
a=15;
b=2.5;
...
function addlistbox()
i=1;
while i<=count do
INIFile.SetValue("temp.ini", "temp", i, a);
end
i=1;
while i<=count do
ttt=INIFile.GetValue("temp.ini", "temp", i);
INIFile.SetValue("temp.ini", "temp", i, Math.Pow(ttt, b*i));
end
i=1;
while i<=count do
ttt=INIFile.GetValue("temp.ini", "temp", i);
ListBox.AddItem("stepeni", i, ttt);
end
end
Приятель прислал.
всю эту прелесть можно написать так:
function addlistbox(a,b,count)
for i=1,count do
ListBox.AddItem("stepeni", i, Math.Pow(a, b*i));
end
end
+120
begin
if not directoryexists('input') then createdir('input');
if not directoryexists('output') then createdir('output');
if not directoryexists('temp') then createdir('temp');
if not directoryexists('temp\temp') then createdir('temp\temp');
if not directoryexists('temp\temp_') then createdir('temp\temp_');
if not directoryexists('temp\temp__') then createdir('temp\temp__');
if not directoryexists('temp\temp___') then createdir('temp\temp___');
if not directoryexists('temp\temp____') then createdir('temp\temp____');
if not directoryexists('temp\temp_____') then createdir('temp\temp_____');
if not directoryexists('temp\temp______') then createdir('temp\temp______');
if not directoryexists('temp\temp_______') then createdir('temp\temp_______');
if not directoryexists('temp\temp________') then createdir('temp\temp________');
if not directoryexists('temp\temp_________') then createdir('temp\temp_________');
if not directoryexists('temp\temp__________') then createdir('temp\temp__________');
if not directoryexists('temp\temp___________') then createdir('temp\temp___________');
if not directoryexists('temp\temp____________') then createdir('temp\temp____________');
if not directoryexists('temp\temp_____________') then createdir('temp\temp_____________');
if not directoryexists('temp\temp______________') then createdir('temp\temp______________');
if not directoryexists('temp\temp_______________') then createdir('temp\temp_______________');
if not directoryexists('temp\temp________________') then createdir('temp\temp________________');
print_('Вас приветствует программа для сортировки слвоарей True Sort');
print_('Если у вас есть какие-то вопросы по её работе - нажмите Help');
turbo:=false;
end;
Кинул знаковый в асю=\
+136
recordSize=logicalRecordLength;
BytesToRead=cnt*recordSize;
records=cnt;
while ( ((pos + BytesToRead)>dataSize)&&records )
{
BytesToRead = --records * recordSize;
}
Не думал, что у нас в коде встречу нечто явно похожее на пример №2 из статьи "Индусский код" на Луркморе.
Ну и стоит добавить, что реально logicalRecordLength всегда равен 1.
+172
<script type="text/javascript" src='/wps/CacheProxyServlet/colorPalette/default/browserVendor/Netscape/browserName/Navigator/browserVersion/unknown/locale/ru/forwardurl/wps/themes/html/pgu/./js.jsp'></script>
с сайта http://portal.rosreestr.ru
+66
Link link = new Link( element );
if( !Browser.getBrowser().isElementPresent( link.getLocator() ) )
{
return false;
}
else
{
return true;
}
зачэм так?
+164
<?
class с_self_add_form
{
var $main="<P>
<form name=\"add_form\" ENCTYPE=\"multipart/form-data\" method=post
....HTML...
</table></form></P>";
}
class u_self_add_form
{
var $main="<P class=ttext>
<form name=\"add_form\" ENCTYPE=\"multipart/form-data\" method=post
....Другой HTML...
</table></form></P>";
}
class d_self_add_form
{
var $main="<P class=zag>
<form name=\"add_form\" ENCTYPE=\"multipart/form-data\" method=post
....Третий HTML...
</table></form></P>";
}
/* и так далее, и тому подобное */
самый шикарный формат файла с шаблонами, который я видел.
+165
once = true;
$(document).ready(function () {
$('#Town').change(function () {
if (once) {
if ($(this).val() != $("#TownName").val()) {
alert("При смене города произойдет потеря всех товаров в корзине");
once = false;
}
}
}
})
);
вместо
$('#Town').one('change', function() {})
+131
int newclient(var v, newconn oldconn) {
[...]
}
Ничего особенного, конечно. Просто порадовало "newconn oldconn".