- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
$output_array = array();
foreach( $list as $key => $value ) {
if( $a >= $GLOBALS['start'] && ($a - $GLOBALS['start'] < $GLOBALS['limit'] )) {
$output_array[$key] = $value;
}
$a++;
}
$list = $output_array;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+155
$output_array = array();
foreach( $list as $key => $value ) {
if( $a >= $GLOBALS['start'] && ($a - $GLOBALS['start'] < $GLOBALS['limit'] )) {
$output_array[$key] = $value;
}
$a++;
}
$list = $output_array;
Вдогонку к №1727. Аналог array_splice в стороннем компоненте к Joomla!
+127
if (CProducts.UpdateProductByPartNumber(row.Cells[2].Text, row.Cells[3].Text, Convert.ToDecimal(row.Cells[4].Text), curId, pgId, vendId) != -1)
{
// ...
}
Эх... первый месяц работы программистом я думал что экономить место - это круто :о)
+83.6
procedure TForm1.WMNCHitTest(var M: TWMNCHitTest);
var
P: TPoint;
Left, Right, Top, Bottom: Boolean;
begin
P := ScreenToClient(SmallPointToPoint(M.Pos));
Left := (P.X < 5) and not (akLeft in Anchors);
Right := (P.X > Width - 5) and not (akRight in Anchors);
Top := (P.Y < 5) and not (akTop in Anchors);
Bottom := (P.Y > Height - 5) and not (akBottom in Anchors);
M.Result := HTCLIENT;
if Left then
if Top then
M.Result := HTTOPLEFT
else
if Bottom then
M.Result := HTBOTTOMLEFT
else
M.Result := HTLEFT
else
if Right then
if Top then
M.Result := HTTOPRIGHT
else
if Bottom then
M.Result := HTBOTTOMRIGHT
else
M.Result := HTRIGHT
else
if Top then
M.Result := HTTOP
else
if Bottom then
M.Result := HTBOTTOM;
end;
изменяем размеры формы с BorderStyle = bsNone.
−115.5
#Region "КОНСТАНТЫ ЭЛЕМЕНТОВ И АТТРИБУТОВ EXCEL"
Public Const STYLE_DEFAULT As String = "Default"
Public Const STYLE_ROW_VAC As String = "RvaC"
Public Const STYLE_COLUMN As String = "Column"
Public Const STYLE_f7I_bN_vaC_haL_n As String = "f7IbNvaChaL"
Public Const STYLE_f7_bN_vaC_haL_nS As String = "f7bNvaChaLnS"
Public Const STYLE_f7_bN_vaC_haR_nS As String = "f7bNvaChaRnS"
Public Const STYLE_f7U_bl1r1Dt2_vaC_haL_n As String = "f7Ubl1t2r1DvaChaL"
Public Const STYLE_f7_bl1Dr1t2_vaC_haL_n As String = "f7bl1Dr1t2vaChaL"
Public Const STYLE_f7_br1D_vaC_haL_n As String = "f7br1DvaChaL"
Public Const STYLE_f7_bl1Dr1_vaC_haL_nP As String = "f7bl1Dr1vaChaLnP"
Public Const STYLE_f12B_bN_vaC_haL_n As String = "f11BbNvaChaL"
Public Const STYLE_f12_bN_vaC_haL_n As String = "f11bNvaChaL"
Public Const STYLE_f7_bN_vaT_haL_n As String = "f7bNvaThaL"
Public Const STYLE_f12B_bl1r1t2_vaC_haL_n As String = "f11Bbl1r1t2vaChaL"
Public Const STYLE_f7B_bN_vaC_haR_nS As String = "f7BvaChaRnS"
Public Const STYLE_f7_bN_vaC_haC_n As String = "f7bNvaChaC"
Public Const STYLE_f7B_bN_vaC_haL_nS As String = "f7BbNvaChaLnS"
Public Const STYLE_f7B_bN_vaC_haC_n As String = "f7BbNvaChaC"
Public Const STYLE_f7B_bl1r1t1b1_vaC_haC_n As String = "f7Bbl1r1t1b1vaChaC"
Public Const STYLE_f7B_bl1_vaC_haL_n As String = "f7bl1vaChaL"
Public Const STYLE_f7B_bt2_vaC_haL_nS As String = "f7Bbt2vaChaLnS"
Public Const STYLE_f7B_bt2_vaC_haC_n As String = "f7Bbt2vaChaC"
Public Const STYLE_f7B_bt2_vaC_haR_nS As String = "f7Bbt2vaChaRnS"
Public Const STYLE_f7_bl1r1t2b1_vaC_haC_nS As String = "f7bl1r1t2b1vaChaCnS"
Public Const STYLE_f7_bl1r1t2_vaC_haR_nS As String = "f7bl1r1t2vaChaRnS"
Public Const STYLE_f7B_bl1r1t2b1_vaC_haR_nS As String = "f7Bbl1r1t2b1vaChaRnS"
Public Const STYLE_f7_bl1r1t2b1_vaC_haR_nS As String = "f7bl1r1t2b1vaChaRnS"
Public Const STYLE_f7_bl1r1b1_vaC_haR_nS As String = "f7bl1r1b1vaChaRnS"
Public Const STYLE_f7B_bl1r1t1b1_vaC_haR_nS As String = "f7Bbl1r1t1b1vaChaRnS"
Public Const STYLE_f7_bl1r1t1b1_vaC_haR_nS As String = "f7bl1r1t1b1vaChaRnS"
Public Const STYLE_f7U_bl1r1t1b1_vaC_haL_n As String = "f7Ubl1r1t1b1vaChaL"
Public Const STYLE_f7I_bl1r1t1b1_vaC_haC_n As String = "f7Ibl1r1t1b1vaChaC"
Public Const STYLE_f7_bl1r1t1b1_vaC_haL_nS As String = "f7bl1r1t1b1vaChaLnS"
Public Const STYLE_f7_bl1r1t1b1_vaC_haC_nS As String = "f7bl1r1t1b1vaChaCnS"
Public Const STYLE_f7I_bl1r1t1b1_vaC_haR_n As String = "f7Ibl1r1t1b1vaChaR"
Public Const STYLE_f7_bl1r1t2b1_vaC_haC_nN As String = "f7bl1r1t2b1vaChaCnN"
Public Const STYLE_f7_bl1r1t1b1_vaC_haC_nN As String = "f7bl1r1t1b1vaChaCnN"
Public Const STYLE_f7B_bl1r1t2b2_vaC_haL_nS As String = "f7Bbl1r1t2b2vaChaLnS"
Public Const STYLE_f7_bl1r1t2b2_vaC_haC_nS As String = "f7bl1r1t2b2vaChaCnS"
Public Const STYLE_f7B_bl1r1t2b2_vaC_haR_nS As String = "f7Bbl1r1t2b2vaChaRnS"
Public Const STYLE_f7B_bl1r1t1b1_vaC_haL_nS As String = "f7Bbl1r1t1b1vaChaLnS"
Public Const STYLE_f12B_bN_vaC_haR_nS As String = "f12BbNvaChaRnS"
Public Const STYLE_f12_bN_vaC_haC_nS As String = "f12bNvaChaCnS"
Public Const STYLE_f7I_bl1r1t1b1_vaC_haL_nS As String = "f7Ibl1r1t1b1vaChaLnS"
Public Const STYLE_f7I_bl1r1t1b1_vaC_haC_nN As String = "f7Ibl1r1t1b1vaChaCnN"
Public Const STYLE_f7B_bl1r1t1b1_vaC_haC As String = "f7BvaChaC" 'STYLE_f7B_bl1r1t1b1_vaC_haC_n ' "f7Bbl1r1t1b1vaChaC"
Public Const STYLE_f7B_bl1r1t1b1_vaC_haL As String = "f7BvaChaL" '"f7Bbl1r1t1b1vaChaL"
Public Const STYLE_f7_bl1r1t1b1_vaC_haL As String = "f7vaChaL" '"f7bl1r1t1b1vaChaL"
Public Const STYLE_f7_bl1r1t1b1_vaT_haLW As String = "f7vaThaLW" '"f7bl1r1t1b1vaChaL"
#End Region
Трудно поверить, но этот кусок кода написан живым человеком. И, что самое странное, этот человек считал, что использовать такие константы очень удобно.
+151.6
var addEventListener = function() {
// Если браузер IE:
if (window.attachEvent)
// Возвращаем функцию для IE:
return function(element, event, callback) {
// Фиксуем callback, чтоб установить правильный
// this, и передавать объект события первым параметром:
callback.__callbackfix = function() {
callback.call(element, window.event);
};
// Устанавливаем обработчик (не забываем про "on")
return element.attachEvent("on" + event, callback.__callbackfix);
}
// Если браузер W3C-совместим:
if (window.addEventListener)
// Возвращаем функцию без фиксов:
return function(element, event, callback) {
// Последний параметр всегда false, для совместимости с IE:
return element.addEventListener(event, callback, false);
}
}();
Найдено на просторах рунета. А теперь пробуем повесить событие на window.
+151.9
$_SEARCH_DATA= JRequest::get($_GET);
$arr_keys=array_keys($_SEARCH_DATA);
for($i=0;$i<count($arr_keys);$i++){
$arr_data[$i]=$_SEARCH_DATA[$arr_keys[$i]];
}
$arr_form=array_combine($arr_keys,$arr_data);
+68
// right now. I can't find how to make fucking @DirectLink
// to necessary book, therefore it'll be a cocksucking crutch.
// from eveel, with love :)
writer.attribute("href",
"?component=%24DirectLink&page=Home&service=direct&session=T&sp=" +
i);
Гоняем Tapestry «на посмотреть».
Действительно, понять сходу каким образому внутри компонента использовать другой компонент (тот же DirectLink) у меня не получилось. Вообще, вопрос в силе.
−119.1
a=['']
b=['']
c=['']
for i in range(0,6):
a.extend(b)
b.extend(c)
c.extend(a)
Нашел в старых скриптах. Я, судя по всему, чего-то не понимал...
+158.9
Нашел в одном индусском скрипте мега аплоадер хендлер
if($_FILES["attach1e"]["name"]){
//@unlink(glob($_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'.*'));
$file_details=pathinfo($_FILES["attach1e"]["name"]);
copy ($_FILES['attach1e']["tmp_name"], $_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$_POST[pid].'-attach1e.'.$file_details['extension']);
}
if($_FILES["attach2"]["name"]){
//@unlink(glob($_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'.*'));
$file_details=pathinfo($_FILES["attach2"]["name"]);
copy ($_FILES['attach2']["tmp_name"], $_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'-attach2.'.$file_details['extension']);
}
if($_FILES["attach3"]["name"]){
//@unlink(glob($_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'.*'));
$file_details=pathinfo($_FILES["attach3"]["name"]);
copy ($_FILES['attach3']["tmp_name"], $_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'-attach3.'.$file_details['extension']);
}
if($_FILES["attach4"]["name"]){
//@unlink(glob($_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'.*'));
$file_details=pathinfo($_FILES["attach4"]["name"]);
copy ($_FILES['attach4']["tmp_name"], $_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'-attach4.'.$file_details['extension']);
}
if($_FILES["attach5"]["name"]){
//@unlink(glob($_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'.*'));
$file_details=pathinfo($_FILES["attach5"]["name"]);
copy ($_FILES['attach5']["tmp_name"], $_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'-attach5.'.$file_details['extension']);
}
if($_FILES["attach6"]["name"]){
//@unlink(glob($_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'.*'));
$file_details=pathinfo($_FILES["attach6"]["name"]);
copy ($_FILES['attach6']["tmp_name"], $_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'-attach6.'.$file_details['extension']);
}
if($_FILES["attach7"]["name"]){
//@unlink(glob($_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'.*'));
$file_details=pathinfo($_FILES["attach7"]["name"]);
copy ($_FILES['attach7']["tmp_name"], $_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'-attach7.'.$file_details['extension']);
}
if($_FILES["attach8b"]["name"]){
//@unlink(glob($_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$pid.'.*'));
$file_details=pathinfo($_FILES["attach8b"]["name"]);
copy ($_FILES['attach8b']["tmp_name"], $_SERVER['DOCUMENT_ROOT'].'/hdb/upload_file/new_files/'.$_POST[pid].'-attach8b.'.$file_details['extension']);
}
−117.8
Если Приказ.Выбран() = 1 Тогда
Если Приказ.Вид() = "Приказ" Тогда
// это все-таки приказ
Если Приказ.ТипПриказа <> Перечисление.ТипыПриказов.НаВнутреннееСовмещение Тогда
// но приказ другой, не внутреннее совмещение
Продолжить;
КонецЕсли;
Иначе
Продолжить;
КонецЕсли;
Иначе
Продолжить;
КонецЕсли;
Долой минимализм!
Наговнокодили: Ингресс-лайн