- 1
- 2
- 3
- 4
- 5
{{sectionelse}}
<script language="javascript">
window.location = '/megasection/megapage.html?step='+{{if $step eq '2'}}'3'{{else}}'1'{{/if}};
</script>
{{/section}}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+157
{{sectionelse}}
<script language="javascript">
window.location = '/megasection/megapage.html?step='+{{if $step eq '2'}}'3'{{else}}'1'{{/if}};
</script>
{{/section}}
PHP, Smarty, редиректы уже не в моде
+146
Ошибка: unterminated regular expression literal
Источник: http://govnokod.ru/media/ddd20ce56acf1d9ebadd126322495087.js?files=jquery.js,jquery.scrollTo.js,govnokod.js,jshighlight/highlight.pack.js&v=4
Строка 204, символ 158
Исходный код:
return curLoop;};var Expr=Sizzle.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\
Это не код, а баг, из-за которого в Firefox'е комментарии не подгружаются, а открываются на отдельной странице.
Короче, минусуйте.
+136
if (demand.TargetDate == new DateTime())
{
}
+146
/**
* TODO Document HelloWorld
* <p />
*
* @author Vinod.Jayakumar
*/
Если тебя, любознательный читатель, заинтересовала валидность такого тега, то, чтобы облегчить тебе поиски:
http://www.w3.org/TR/html4/struct/text.html#edef-P
> We discourage authors from using empty P elements. User agents should ignore empty P elements.
+167
#include <windows.h>
struct io
{
io()
{
SetConsoleTitle(__FUNCSIG__);
}
~io()
{
DebugBreak();
}
} io_obj;
int main()
{
}
typedef void(fn_t)();
#pragma comment(linker, "/merge:.CRT=.rdata")
#pragma data_seg(".CRT$XCA")
extern "C" fn_t * start[] = {0};
#pragma data_seg(".CRT$XCZ")
extern "C" fn_t * finish[] = {0};
#pragma data_seg()
void call_dtors();
extern "C" void _initterm()
{
fn_t **p = start, **q = finish;
while (p < q)
{
if (*p)
(*p)();
++p;
}
main();
call_dtors();
}
fn_t * dtors[999];
int c_dtors;
void call_dtors()
{
while (c_dtors--)
dtors[c_dtors]();
}
extern "C" int atexit(void (__cdecl *func )( void ))
{
dtors[c_dtors++] = func;
return !"unspecified";
}
если клепаем что то без CRT и хотим чтоб вызывались
конструкторы деструкторы статических объектов и хотим свое то
вот реализация для тех кто этого еще неделал
https://wasm.ru/forum/viewtopic.php?pid=428250#p428250
+165
//
// Занимательное программирование C++
// С.Симонович, Г.Евсеев, 2001
//
// Глава 12. Программа учится сочинять
//
void __fastcall TForm1::FormCreate
(TObject *Sender)
{
randomize();
ComboBox1->ItemIndex = 0;
ComboBox2->ItemIndex = 0;
ComboBox3->ItemIndex = 0;
}
void __fastcall TForm1::Button1Click
(TObject *Sender)
{
ComboBox1->ItemIndex =
random(ComboBox1->Items->Count);
ComboBox2->ItemIndex =
random(ComboBox2->Items->Count);
ComboBox3->ItemIndex =
random(ComboBox3->Items->Count);
}
Это моя первая книгка по Си++
печалько... тт
+149
//
// mainwindow.h
//
#ifndef MAINMDIWINDOW_H
#define MAINMDIWINDOW_H
/* >:0 Эти инклюды хуже, чем говно, чуть менее, чем полностью */
#include <QMainWindow>
#include <QMdiArea>
#include <QMenu>
#include <QAction>
#include <QMenuBar>
#include <QWebView>
#include <QFile>
#include <QSignalMapper>
#include <QDebug>
#include <QDomDocument>
#include <QToolBar>
#include <QButtonGroup>
#include <QLabel>
#include <QMdiSubWindow>
#include <QApplication>
#include "demoviewer.h"
#include "theoryviewer.h"
class MainMDIWindow : public QMainWindow
{ Q_OBJECT
public:
/* >:0 Кэп?! */
//! Выполняет создание и инициализацию окна приложения.
explicit MainMDIWindow(QWidget *parent = 0);
signals:
public slots:
/* >:0 А ты догадался, что значат эти аргументы? */
void openDocument(int); void loadPage(int);
/* >:0 Это невероятно полезные функции */
void toggleTheoryWindow(bool state) { tw->setVisible(state); }
void toggleDemoWindow(bool state) { dw->setVisible(state); }
protected:
/* >:0 Это на винде не работало, я просто закомментировал.
Вероятно, правильнее было бы воспользоваться средствами сборки под разные платформы,
но я невозбранно комметирую-раскомментирую эту строчку каждый раз при сборке */
inline void paintEvent(QPaintEvent *e)
{ // mdiArea->setBackground(QBrush(QImage(":/images/photo/s200.jpg").scaled(this->size(), Qt::KeepAspectRatioByExpanding)));
e->accept();
}
// ...
/* >:0 ЭтаПять! См. тело конструктора */
QString AppWindowTitle;
// Просмотровщики материала
DemoViewer * dv; QMdiSubWindow* dw;
TheoryViewer* tv; QMdiSubWindow* tw;
bool lockTheory, lockDemo;
// Хранение информации о документах
/* >:0 За такое я впредь обещаю безжалостно резать яйца. Даже себе. */
QVector< QVector< QHash< QString, QString > > > documents;
QVector< QHash< QString, QString > > *currentDocument;
// ...
};
#endif // MAINMDIWINDOW_H
//
// mainwindow.cpp
// Далее следуют отдельные вырезки
//
#include "mainmdiwindow.h"
MainMDIWindow::MainMDIWindow(QWidget *parent) : QMainWindow(parent)
{ /* >:0 Вот зачем нам понадобился атрибут QString AppWindowTitle! */
AppWindowTitle = tr("ЦВМ «Пламя-КВ» ЗРК С-200ВЭ");
setWindowTitle(AppWindowTitle);
// ...
// Инициализация окон просмотровщиков
/* >:0 Вы меня понимаете, не? хД */
tv = new TheoryViewer(); tw = mdiArea->addSubWindow(tv); tw->hide(); tv->setParent(tw); lockTheory = true;
dv = new DemoViewer(); dw = mdiArea->addSubWindow(dv); dw->hide(); dv->setParent(dw); lockDemo = true;
// ...
}
void MainMDIWindow::openDocument(int id)
{ // ...
/* >:0 Нижеследующая конструкция читает HTML файл в UTF-8,
заменяет пути на абсолютные и запихвает получивуюся какуху в QWebView */
QFile in(textLink); bool t = in.open(QIODevice::ReadOnly | QIODevice::Text);
tv->setHtml(QString::fromUtf8(in.readAll()).replace(QString("./"), QApplication::applicationDirPath() + '/'));
in.close();
// ...
}
ИМХО, это МЕГОКОД. И я обещаю больше так никогда не делать ^^
Вбросы говн в потоковых комментариях, начинающихся с православного смайла >:0
+177
// Задача "Сложный XOR", олимпиада ACM контестер Украина.
// Есть множество натуральных чисел от 0 до N. Играют двое игроков. Сначала один убирает из множества число,
// потом второй. Если в множестве есть (осталось) число, равное побитовому XOR двух выбранных чисел, убирают
// и его (в условии задачи битность числа не указана, но сказано, что 1 <= N <= 32). Играют пока в множестве
// есть числа. Проигрывает тот, который не может совершить ход (на ком кончились числа).
// Ввод - число N, вывод - игрок, который выиграл (оба игрока придерживаются выгодной стратегии).
#include <iostream>
#include <time.h>
using namespace std;
int main() {
int n;
cin >> n;
// Это очевидно
if (n==1) {
cout << "First";
return 0;
}
if (n==2) {
cout << "Second";
return 0;
}
// Это было в примере
if (n==3) {
cout << "First";
return 0;
}
int s = clock() % 2; // rand() не работал чето :)
if (s==0) {
cout << "First";
} else {
cout << "Second";
}
return 0;
}
Говноолимпиадам - говнорешения!
Скажете, зачем такое постить, это не говнокод... Фишка в том, что это незамысловатое решение *правильно прошло все тесты с первого раза!* :D
−112
this.iconSrc = iconSrc != '' ? iconSrc : iconSrc;
Очевидно, когда-то это было проверкой на пустую ссылку на картинку.
+126
g.Graphics.DrawLine( p, this.pb.Width / 2 + 126, this.pb.Height / 2 + 176, this.pb.Width / 2 + 126, this.pb.Height / 2 + 176 + 20 );
g.Graphics.DrawLine( p, this.pb.Width / 2 - 126, this.pb.Height / 2 + 176, this.pb.Width / 2 - 126, this.pb.Height / 2 + 176 + 20 );
g.Graphics.DrawLine( new Pen( Color.Black ), this.pb.Width / 2 - 126, this.pb.Height / 2 + 176 + 20, this.pb.Width / 2 + 126, this.pb.Height / 2 + 176 + 20 );
g.Graphics.DrawLine( new Pen( Color.Black ), this.pb.Width / 2 - 126, this.pb.Height / 2 + 176 + 20, this.pb.Width / 2 - 126 + 8, this.pb.Height / 2 + 176 + 15 );
g.Graphics.DrawLine( new Pen( Color.Black ), this.pb.Width / 2 - 126, this.pb.Height / 2 + 176 + 20, this.pb.Width / 2 - 126 + 8, this.pb.Height / 2 + 176 + 25 );
g.Graphics.DrawLine( new Pen( Color.Black ), this.pb.Width / 2 + 126, this.pb.Height / 2 + 176 + 20, this.pb.Width / 2 + 126 - 8, this.pb.Height / 2 + 176 + 15 );
g.Graphics.DrawLine( new Pen( Color.Black ), this.pb.Width / 2 + 126, this.pb.Height / 2 + 176 + 20, this.pb.Width / 2 + 126 - 8, this.pb.Height / 2 + 176 + 25 );
g.Graphics.FillRectangle( Brushes.White, this.pb.Width / 2 - 25, this.pb.Height / 2 + 176 + 10, 50, 20 );
g.Graphics.DrawString( this.textBox1.Text + " mm", new Font( "Arial", 8 ), new SolidBrush( Color.Black ), this.pb.Width / 2 - 21, this.pb.Height / 2 + 176 + 12 );
g.Graphics.DrawLine( new Pen( Color.Black ), this.pb.Width / 2 - (int)paint_nozh_fill / 2, this.pb.Height / 2, this.pb.Width / 2 + (int)paint_nozh_fill / 2, this.pb.Height / 2 );
g.Graphics.DrawLine( new Pen( Color.Black ), this.pb.Width / 2 - (int)paint_nozh_fill / 2, this.pb.Height / 2, this.pb.Width / 2 - (int)paint_nozh_fill / 2 + 8, this.pb.Height / 2 - 5 );
g.Graphics.DrawLine( new Pen( Color.Black ), this.pb.Width / 2 - (int)paint_nozh_fill / 2, this.pb.Height / 2, this.pb.Width / 2 - (int)paint_nozh_fill / 2 + 8, this.pb.Height / 2 + 5 );
g.Graphics.DrawLine( new Pen( Color.Black ), this.pb.Width / 2 + (int)paint_nozh_fill / 2, this.pb.Height / 2, this.pb.Width / 2 + (int)paint_nozh_fill / 2 - 8, this.pb.Height / 2 - 5 );
g.Graphics.DrawLine( new Pen( Color.Black ), this.pb.Width / 2 + (int)paint_nozh_fill / 2, this.pb.Height / 2, this.pb.Width / 2 + (int)paint_nozh_fill / 2 - 8, this.pb.Height / 2 + 5 );
g.Graphics.FillRectangle( Brushes.White, this.pb.Width / 2 - 25, this.pb.Height / 2 - 10, 50, 20 );
g.Graphics.DrawString( this.getNozhFill( ).ToString( ) + " mm", new Font( "Arial", 8 ), new SolidBrush( Color.Black ), this.pb.Width / 2 - 21, this.pb.Height / 2 - 8 );
Человек похоже перепутал визул студию с фотошопом, но закрывать не стал )) Этот код рисует чертеж - примем со стрелочками, с откосами и даже(!) с отбрасывает тень. Понятия не имею как преписывать