- 1
- 2
- 3
- 4
function all_sorting(
$ids, //!< Массив ID элемента в карте сайта
$_POST //!< Значения сортировки элементов
) {
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+69
function all_sorting(
$ids, //!< Массив ID элемента в карте сайта
$_POST //!< Значения сортировки элементов
) {
Определение локальной переменной с именем суперглобального массива вызывает ошибку "Fatal error: Cannot re-assign auto-global variable _POST in" в PHP 5.4
−146
public function FooClass() {
if (!_isConstructing) throw new Error("Singleton, use FooClass.instance");
}
public static function get instance():FooClass {
if (_instance == null) {
_isConstructing = true;
_instance = new FooClass();
_isConstructing = false;
}
return _instance;
}
Новое слово в создании синглтонов.
+96
string AutoWait;
int AutoStop;
/*...*/
RegistryKey sKey = Registry.LocalMachine.OpenSubKey("Platform\\Settings");
AutoStop=(int)Key.GetValue("AutoStop");
if (AutoStop == 1) { AutoWait = "yes"; wait.Enabled = false; } else { AutoWait = "no"; }
/*...*/
if ((km4<=2)&(onTheWay)&(AutoWait=="yes"))
{
Waiting=true;
label3.BackColor = Color.Red;
label4.BackColor = Color.Black;
}else
if ((km4 > 2) & (onTheWay))
/*...*/
Классика жанра - использование переменной String в качестве bool. Про ООП автор вообще не слышал, весь код оформлен одной большой портянкой с кучей повторений сброса/установки подобных "флажков".
+73
public static function ParseContainer($s,$be,$en,$cb,$ret_beg=false,$re=false)
{
if(!is_callable($cb))
return$s;
$bl=strlen($be);
$el=strlen($en);
for(;;)
{
if(false===$bp=strpos($s,$be) or false===$ep=strpos($s,$en,$bp+1+$bl))
break;
$brp=strrpos(substr($s,0,$ep-$bp+1),$be);
if($brp>$bp)
$bp=$brp;
$ns=substr($s,$bp+($ret_beg ? 0 : $bl),$ep-$bp-($ret_beg ? 0 : $bl)+($re ? $el : 0));
$ns=call_user_func($cb,$ns);
$s=substr_replace($s,$ns,$bp,$ep-$bp+$el);
}
return$s;
}
−116
select cunt(*) from users
Опечаточка по фрейду :)
−122
my (@data) = $content =~ m#href="/show/\d+.*?">(.*?)</a>.*?(Ep: \d+).*?(at \d{2}:\d{2}).*?</small>#gsi;
for (my $i; $i < @data;){
$data .= $data [$i++].' '.$data [$i++].' '.$data [$i++];
$data .= "\n" unless $i == @data;
}
Распарсил.
+77
if (eventInfo.getQuoteList().size() == 0) {
lineInfo.getEventList().add(eventInfo);
} else {
lineInfo.getEventList().add(eventInfo);
}
Тебе никуда не деться от добавления!
−117
For t = 3 To u
If Cells(t, 204).Text = " " Or Cells(t, 204).Text = "" Then
If Cells(t + 1, 204).Text = " " Or Cells(t + 1, 204).Text = "" Then
If Cells(t + 2, 204).Text = " " Or Cells(t + 2, 204).Text = "" Then
If Cells(t + 3, 204).Text = " " Or Cells(t + 3, 204).Text = "" Then
If Cells(t + 4, 204).Text = " " Or Cells(t + 4, 204).Text = "" Then
If Cells(t + 5, 204).Text = " " Or Cells(t + 5, 204).Text = "" Then
If Cells(t + 6, 204).Text = " " Or Cells(t + 6, 204).Text = "" Then
If Cells(t + 7, 204).Text = " " Or Cells(t + 7, 204).Text = "" Then
If Cells(t + 8, 204).Text = " " Or Cells(t + 8, 204).Text = "" Then
If Cells(t + 9, 204).Text = " " Or Cells(t + 9, 204).Text = "" Then
If Cells(t + 10, 204).Text = " " Or Cells(t + 10, 204).Text = "" Then
If Cells(t + 11, 204).Text = " " Or Cells(t + 11, 204).Text = "" Then
If Cells(t + 12, 204).Text = " " Or Cells(t + 12, 204).Text = "" Then
If Cells(t + 13, 204).Text = " " Or Cells(t + 13, 204).Text = "" Then
If Cells(t + 14, 204).Text = " " Or Cells(t + 14, 204).Text = "" Then
If Cells(t + 15, 204).Text = " " Or Cells(t + 15, 204).Text = "" Then
If Cells(t + 16, 204).Text = " " Or Cells(t + 16, 204).Text = "" Then
If Cells(t + 17, 204).Text = " " Or Cells(t + 17, 204).Text = "" Then
If Cells(t + 18, 204).Text = " " Or Cells(t + 18, 204).Text = "" Then
If Cells(t + 19, 204).Text = " " Or Cells(t + 19, 204).Text = "" Then
If Cells(t + 20, 204).Text = " " Or Cells(t + 20, 204).Text = "" Then
If Cells(t + 21, 204).Text = " " Or Cells(t + 21, 204).Text = "" Then
If Cells(t + 22, 204).Text = " " Or Cells(t + 22, 204).Text = "" Then
If Cells(t + 23, 204).Text = " " Or Cells(t + 23, 204).Text = "" Then
If Cells(t + 24, 204).Text = " " Or Cells(t + 24, 204).Text = "" Then
If Cells(t + 25, 204).Text = " " Or Cells(t + 25, 204).Text = "" Then
If Cells(t + 26, 204).Text = " " Or Cells(t + 26, 204).Text = "" Then
If Cells(t + 27, 204).Text = " " Or Cells(t + 27, 204).Text = "" Then
If Cells(t + 28, 204).Text = " " Or Cells(t + 28, 204).Text = "" Then
If Cells(t + 29, 204).Text = " " Or Cells(t + 29, 204).Text = "" Then
If Cells(t + 30, 204).Text = " " Or Cells(t + 30, 204).Text = "" Then
If Cells(t + 31, 204).Text = " " Or Cells(t + 31, 204).Text = "" Then
If Cells(t + 32, 204).Text = " " Or Cells(t + 32, 204).Text = "" Then
If Cells(t + 33, 204).Text = " " Or Cells(t + 33, 204).Text = "" Then
If Cells(t + 34, 204).Text = " " Or Cells(t + 34, 204).Text = "" Then
GoTo zan4:
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
Next t
zan4:
Кусок реально используемого "проэкта", используется у нас на призводстве.
И вот-такого штук 10 в коде.
ноу коментс.
+89
<?php
/* Посоветовали делать так, чтобы решить проблемы с выводом на страницу чисел. Всё зависло */
$x=0;
echo "Пожалуйста, подождите 1 минуту. Сейчас напечатаем";
while ($x++) echo $x."_";
?>
Хм... Что-то тут не так.
−97
-(int)randomNumber
{
return (arc4random() % 5001) + 5000; //Generates Number from 1 to 100.
}
Индусы получают числа от 1 до 100 О_О