- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
function init() {
if (!document.body) return;
var body = document.body;
var html = document.documentElement;
// ...
}
// ...
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+152
function init() {
if (!document.body) return;
var body = document.body;
var html = document.documentElement;
// ...
}
// ...
https://gist.github.com/galambalazs/6477177/
Плавный скролл, я вот только не пойму, почему "if (!document.body) return;"?
Типа <body> тэга может не существовать?!
+156
for($i = 1; $i < $conf->nb_images + 1; $i++)
{
$ext_name = chr(ord('a')+$i-1);
?>
<label for="ad_picture<?php echo $i;?>"><?php echo ADSMANAGER_FORM_AD_PICTURE." ".$i; ?></label>
<input id="ad_picture<?php echo $i;?>" type="file" name="ad_picture<?php echo $i;?>" />
<?php
if ($isUpdateMode) {
$pic = $mosConfig_absolute_path."/images/$option/projects/".$ad_id.$ext_name."_t.jpg";
if ( file_exists( $pic)) {
echo "<img src='".$mosConfig_live_site."/images/$option/projects/".$ad_id.$ext_name."_t.jpg' align='top' border='0' alt='image$ad_id' />";
echo "<input type='checkbox' name='cb_image$i' value='delete' />".ADSMANAGER_AD_DELETE_IMAGE;
}
}
echo "<br />";
}
Угадайте что за CMS :)))
+57
if (!this) return;
+135
Public CallGridRowModel(CallView callView)
{
. . .
Caller = GetCallerOrCalleeNameColumn(callView, true)
Callee = GetCallerOrCalleeNameColumn(callView, false)
. . .
}
private object GetCallerOrCalleeNameColumn(CallView callView, bool isCallerNameColumn)
{
if(isCallerNameColumn)
{
if(. . .) return . . .;
}
if(!isCallerNameColumn)
{
if(. . .) return . . .;
}
if(isCallerNameColumn)
{
return . . .;
}
else
{
return . . .;
}
}
+87
public BarrierAssessment(int id, Client client, int homephone, int mobile, int email, int transport, int licence, boolean notInWorkForce, boolean unpaidWork, boolean cdeProgram, boolean notWorkingBut, int paidWork,
String employerOcc, String reason, int highlevel, String further, int stableAccomodation, int loneParent, int livingWith, int policeProblems, int courtPending, int preventFrom, int medical, int drugTest, int currentBusy,
String scurrentBusy, String reasonForNotGettingJob, int startTomorrow, String jobGoals, int currentResume, int canvasLetter, int referees, int interviewClothing, String otherBarriers, int ec, LastModified lastModified,
Date datestamp, Date bupdated, String disabilityBarriers, Date licenceDueToExpire, Date licenceDueBack, String currentSkills, String possibleSkills) {
...
}
Мать всех конструкторов!
−132
Выборка = Запрос.Выполнить().Выбрать();
Если Выборка.Следующий() И Выборка.Количество() > 0 Тогда
Возврат Выборка.ПлощадьДома;
Иначе
Возврат 0;
КонецЕсли;
проверка пустая ли выборка по одному из принципов:
"больше лучше, чем меньше", "доверяй, но проверяй", "семь раз отмерь, один отрежь"
+153
window.onload = function()
{
m1 = new Matrix('matrix1', 20, 20);
m1.create();
var square = new Square(1, 2, 'right');
square.create();
setInterval(square.move, 50);
}
function Square(row, col, course)
{
this.body = [row, col];
this.course = course;
var that = this; // <-- 100500 iopta !!!
this.create = function()
{
m1.setCell(that.body[0], that.body[1], true);
}
this.move = function()
{
var last_body = that.body;
switch(that.course)
{
case 'right':
that.body[1]++;
break;
case 'left':
break;
case 'down':
break;
case 'up':
break;
}
m1.setCell(last_body[0], last_body[1], false);
m1.setCell(that.body[0], that.body[1], true);
}
}
здесь вам не тут, понял, да !
+154
if(sel.ToInt()==1){
Form1->NumberOfIndexes = 1;
}else if(sel.ToInt()==2){
...
//еще 11 таких же кучек
...
}else if(sel.ToInt()==13){
Form1->NumberOfIndexes = 13;
}else{
Form1->NumberOfIndexes = 1;
}
+14
string modify( const string & str )
{
if( str.size() == 0 ) return "00";
if( str.size() == 1 ) return "0" + str;
return string( str.end() - 2, str.end() );
}
string modify4( const string & str )
{
if( str.size() == 0 ) return "0000";
if( str.size() == 1 ) return "000" + str;
if( str.size() == 2 ) return "00" + str;
if( str.size() == 3 ) return "0" + str;
return string( str.end() - 4, str.end() );
}
string TimeISOFormat( time_t cur )
{
char buf[32];
struct tm * timeinfo;
timeinfo = localtime ( &cur );
strftime(buf, 32, "%y", timeinfo);
string year(buf);
strftime(buf, 32, "%m", timeinfo);
string month(buf);
strftime(buf, 32, "%d", timeinfo);
string day(buf);
strftime(buf, 32, "%H", timeinfo);
string hour(buf);
strftime(buf, 32, "%M", timeinfo);
string minute(buf);
strftime(buf, 32, "%S", timeinfo);
string second(buf);
return modify4( year ) + "-" + modify( month ) + "-" + modify( day ) + "T" + modify( hour )+ ":" + modify( minute )+ ":" + modify( second );
}
string CurrentTimeISOFormat()
{
time_t cur = CurrentTime();
char buf[32];
struct tm * timeinfo;
timeinfo = localtime ( &cur );
strftime(buf, 32, "%y", timeinfo);
string year(buf);
strftime(buf, 32, "%m", timeinfo);
string month(buf);
strftime(buf, 32, "%d", timeinfo);
string day(buf);
strftime(buf, 32, "%H", timeinfo);
string hour(buf);
strftime(buf, 32, "%M", timeinfo);
string minute(buf);
strftime(buf, 32, "%S", timeinfo);
string second(buf);
return modify4( year ) + "-" + modify( month ) + "-" + modify( day ) + "T" + modify( hour )+ ":" + modify( minute )+ ":" + modify( second );
}
time_t CurrentTime()
{
time_t rawtime = 0;
time(&rawtime);
return rawtime;
}
+131
#ifndef _AVRECORD_H__INCLUDED_
#define _AVRECORD_H__INCLUDED_
#include
//! Структура сигнатуры
typedef struct SAVSignature{
SAVSignature(){
this->Offset = 0;
this->Lenght = 0;
memset(this->Hash, 0, sizeof(this->Hash));
}
DWORD Offset; // - Смещение файле
DWORD Hash[4]; // - MD5 хэш
DWORD Lenght; // - Размер данных
} * PSAVSignature;
//! Структура записи о зловреде
typedef struct SAVRecord{
SAVRecord(){
this->Name = NULL;
this->NameLen = 0;
}
~SAVRecord(){
if(this->Name != NULL) this->Name;
}
//! Выделение памяти под имя
void allocName(BYTE NameLen){
if(this->Name == NULL){
this->NameLen = NameLen;
this->Name = new CHAR[this->NameLen + 1];
memset(this->Name, 0, this->NameLen + 1);
}
}
PSTR Name; // - Имя
BYTE NameLen; // - Размер имени
SAVSignature Signature; // - Сигнатура
} * PSAVRecord;
#endif
Пишем антивирус на аццкой помеси Си, ООП-стайла, говнокода и синтаксических ошибок.
http://hack-academy.ru/programming/system/361-pishem-svoj-antivirus-na-c.html