- 1
- 2
- 3
- 4
- 5
<?php
if(!@isset($_POST[submit]))
{
...
?>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+144.8
<?php
if(!@isset($_POST[submit]))
{
...
?>
+144.8
/**
* Helper classes for computing window query on rectangles
*/
class VerticalSegmentIntersect : public std::unary_function < PRGlyph, ptrdiff_t > {
ptrdiff_t m_Lhs;
ptrdiff_t m_Rhs;
public:
VerticalSegmentIntersect ( ptrdiff_t top, ptrdiff_t bottom ) throw() : m_Lhs(top+top), m_Rhs(bottom+bottom) {}
ptrdiff_t operator() ( PRGlyph inpGlyph ) const throw() {
QRect const* area = inpGlyph->GetGlyphArea();
ptrdiff_t x = area->bottom() + area->top(), y = area->bottom() - area->top();
if (y < x - m_Rhs ) return 0;
if (y < m_Lhs - x ) return 0;
return 1;
}
};
class HorisontalSegmentIntersect : public std::unary_function < PRGlyph, ptrdiff_t > {
ptrdiff_t m_Lhs;
ptrdiff_t m_Rhs;
public:
HorisontalSegmentIntersect ( ptrdiff_t left, ptrdiff_t right ) throw() : m_Lhs(left+left), m_Rhs(right+right) {}
ptrdiff_t operator() ( PRGlyph inpGlyph ) const throw() {
QRect const* area = inpGlyph->GetGlyphArea();
ptrdiff_t x = area->right() + area->left(), y = area->right() - area->left();
if (y < x - m_Rhs ) return 0;
if (y < m_Lhs - x ) return 0;
return 1;
}
};
/**
* Helper classes for computing containment query on rectangles
*/
class VerticalSegmentContains : public std::unary_function < PRGlyph, ptrdiff_t > {
ptrdiff_t m_Lhs;
ptrdiff_t m_Rhs;
public:
VerticalSegmentContains ( ptrdiff_t top, ptrdiff_t bottom ) throw() : m_Lhs(top+top), m_Rhs(bottom+bottom) {}
ptrdiff_t operator() ( PRGlyph inpGlyph ) const throw() {
QRect const* area = inpGlyph->GetGlyphArea();
ptrdiff_t x = area->bottom() + area->top(), y = area->bottom() - area->top();
if ( y > x - m_Lhs ) return 0;
if ( y > m_Rhs - x ) return 0;
return 1;
}
};
class HorisontalSegmentContains : public std::unary_function < PRGlyph, ptrdiff_t > {
ptrdiff_t m_Lhs;
ptrdiff_t m_Rhs;
public:
HorisontalSegmentContains ( ptrdiff_t left, ptrdiff_t right ) throw() : m_Lhs(left+left), m_Rhs(right+right) {}
ptrdiff_t operator() ( PRGlyph inpGlyph ) const throw() {
QRect const* area = inpGlyph->GetGlyphArea();
ptrdiff_t x = area->right() + area->left(), y = area->right() - area->left();
if ( y > x - m_Lhs ) return 0;
if ( y > m_Rhs - x ) return 0;
return 1;
}
};
// compute the window query on m_GlyphData rectangles
QVector<PRGlyph> :: iterator windowq = m_Selection.isValid() ?
std::partition ( m_GlyphData.begin(),
std::partition ( m_GlyphData.begin(), m_GlyphData.end(), VerticalSegmentIntersect ( m_Selection.top(), m_Selection.bottom() ) ),
HorisontalSegmentIntersect ( m_Selection.left(), m_Selection.right() )
) : m_GlyphData.begin();
// compute the containment query on window query rectangles (the containment query resuls is always subset of window query )
QVector<PRGlyph> :: iterator containq = std::partition ( m_GlyphData.begin(),
std::partition ( m_GlyphData.begin(), windowq, VerticalSegmentContains ( m_Selection.top(), m_Selection.bottom() ) ),
HorisontalSegmentContains ( m_Selection.left(), m_Selection.right() )
);
Способ быстренько находить прямоугольники, пересекающиеся с входным и содержимые им же. Применимо для прямоугольных параллелепипедов любой размерности.
+167.8
function returnDate($stamp){
global $settings;
$day = strftime("%d",$stamp+($settings['timeoffset']*3600));
$month = strftime("%m",$stamp+($settings['timeoffset']*3600));
$year = strftime("%Y",$stamp+($settings['timeoffset']*3600));
switch ($month){
case 01 : $month = "01"; break;
case 02 : $month = "02"; break;
case 03 : $month = "03"; break;
case 04 : $month = "04"; break;
case 05 : $month = "05"; break;
case 06 : $month = "06"; break;
case 07 : $month = "07"; break;
case 08 : $month = "08"; break;
case 09 : $month = "09"; break;
case 10 : $month = "10"; break;
case 11 : $month = "11"; break;
case 12 : $month = "12"; break;
}
return "$day.$month.$year";
}
Взято из чешского шаблона под одну цмску. Автору, наверно, платят как Маяковскому - за каждую строчку :-)
+109.3
<script type="text/javascript">
<!--
if (window.screen)
{
if (screen.width < 1024)
{
document.write('<td height="35" width="11"><img src="img0800/indx/indx_0_0.png" title="" alt="" style="width: 11px; height: 35px;"></td>\n');
document.write('<td height="35" width="43"><a href="en/index.html"><img src="img0800/indx/indx_1_0.png" title="" alt="" style="width: 43px; height: 35px;"></a></td>\n');
document.write('<td height="35" width="76"><img src="img0800/indx/indx_2_0.png" title="" alt="" style="width: 76px; height: 35px;"></td>\n');
document.write('<td height="35" width="32"><img src="img0800/indx/indx_3_0.png" title="" alt="" style="width: 32px; height: 35px;"></td>\n');
document.write('<td height="35" width="27"><img src="img0800/indx/indx_4_0.png" title="" alt="" style="width: 27px; height: 35px;"></td>\n');
document.write('<td height="35" width="39"><img src="img0800/indx/indx_5_0.png" title="" alt="" style="width: 39px; height: 35px;"></td>\n');
document.write('<td height="35" width="103"><img src="img0800/indx/indx_6_0.png" title="" alt="" style="width: 103px; height: ................
document.write('<td height="31" width="21"><img src="img1024/indx/indx_15_19.png" title="" alt="" style="width: 21px; height: 31px;"></td>\n');
}
else if (screen.width < 1600)
{
document.write('<td height="59" width="18"><img src="img1280/indx/indx_0_0.png" title="" alt="" style="width: 18px; height: 59px;"></td>\n');
document.write('<td height="59" width="72"><a href="en/index.html"><img src="img1280/indx/indx_1_0.png" title="" alt="" style="width: 72px; height: 59px;"></a></td>\n');
document.write('<td height="59" width="127"><img src="img1280/indx/indx_2_0.png" title="" alt="" style="width: 127px; height: 59px;"></td>\n');
document.write('<td height="59" width="53"><img src="img1280/indx/indx_3_0.png" title="" alt="" style="width: 53px; height: 59px;"></td>\n');
document.write('<td height="59" width="46"><img src="img1280/indx/indx_4_0.png" title="" alt="" style="width: 46px; height: 59px;"></td>\n');
document.write('<td height="59" width="64"><img src="img1280/indx/indx_5_0.png" title="" alt="" style="width: 64px; height: 59px;"></td>\n');
.......
Сайт с фоном из таблицы с картинками. Картинки нарезаны на мелкие кусочки и, внимание, сайт подстраивается под разные разрешения мониторов! Есть наборы картинок для ширины 800, 1024, 1280 и 1600. Посмотреть можно на http://old.abvi.redsolution.ru/
+167.7
$('div[id="myid"]')
+150
var currentDate = new Date();
var currentDay = currentDate.getDay();
var currentMonth = currentDate.getMonth();
var currentYear = currentDate.getYear();
var currentHour = currentDate.getHours();
var currentMinute = currentDate.getMinutes();
var currentSecond = currentDate.getSeconds();
if (currentMonth < 10) {
currentMonth = '0' + currentMonth;
}
if (currentDay < 10) {
currentDay = '0' + currentDay;
}
if (currentHour < 10) {
currentHour = '0' + currentHour;
}
if (currentMinute < 10) {
currentMinute = '0' + currentMinute;
}
if (currentSecond < 10) {
currentSecond = '0' + currentSecond;
}
говно
+53.4
void (* signal(int __sig, void (* __func)(int))) (int)
Объявление типа, представляющего собой указатель на функцию, возращающей указатель на функцию (может я не так понял?) из хедера signal.h.
+136
procedure Button1Click(Sender:TObject)
begin
if (TreeView1.Selected<>Nil) then
if (TreeView1.Selected.ImageIndex = 5) then
begin
{выбран лист дерева - обрабатываем}
........
end;
end;
Написано мною на втором курсе. Тип узла в дереве определялся по ImageIndex - узел каждого типа имел свою картинку.
+11.2
Сделайте пожалуйста в RSS полный вариант кода,
а то обрезается и приходится лезть на сайт, а это не удобно.
Спасибо.
Простите, не нашел формы обратной связи, поэтому пишу тут.
+15.3
#define begin {
#define end }
....
//==================================
// put a big character on the screen
// c is index into bitmap
void video_putchar(char x, char y, char c)
begin
v7 = x;
for (v6=0;v6<7;v6++)
begin
v1 = bitmap[c][v6];
v8 = y+v6;
...
end
end
паскалист пишет на си