- 1
- 2
- 3
- 4
- 5
- 6
if (coms->Strings[1]=="install") {
if (GetFile("localhost",WinDir+comms->Strings[3]) {
execCommand=true;
}else{
execCommand=false;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+156
if (coms->Strings[1]=="install") {
if (GetFile("localhost",WinDir+comms->Strings[3]) {
execCommand=true;
}else{
execCommand=false;
}
вот такое вот чудо нашел в одном проЭкте предыдущего програмера, который до меня работал)
вместо localhost передавалось имя файла на сервере
+997
char* CFastSmtp::_formatHeader()
{
// check for at least one recipient
if(Recipients.size() <= 0 ) {
printf("Please add a message recipient!\r\n");
return NULL;
}
int s=0;
char *msgHeader = new char[16385];
//char to[1024];
for (unsigned int i=s=0;i<Recipients.size();i++) {
s+=strlen(Recipients.at(i)->GetEmail())+1;
} if (s==0) s=1; char *to = new char[s];
//char cc[1024];
for (i=s=0;i<CCRecipients.size();i++) {
s+=strlen(CCRecipients.at(i)->GetEmail())+1;
} if (s==0) s=1; char *cc = new char[s];
//char bcc[1024];
for (i=s=0;i<BCCRecipients.size();i++) {
s+=strlen(BCCRecipients.at(i)->GetEmail())+1;
} if (s==0) s=1; char *bcc = new char[s];
TCHAR szDate[500];
TCHAR sztTime[500];
// create the recipient string, cc string, and bcc string
to[0] = '\0';
for (i=0;i<Recipients.size();i++) {
i > 0 ? strcat(to,","):strcat(to,"");
strcat(to,Recipients.at(i)->GetEmail());
}
cc[0] = '\0';
for (i=0;i<CCRecipients.size();i++) {
i > 0 ? strcat(cc,","):strcat(cc,"");
strcat(cc,CCRecipients.at(i)->GetEmail());
}
bcc[0] = '\0';
for (i=0;i<BCCRecipients.size();i++) {
i > 0 ? strcat(bcc,","):strcat(bcc,"");
strcat(bcc,BCCRecipients.at(i)->GetEmail());
}
// get the current date and time
SYSTEMTIME st={0};
::GetSystemTime(&st);
::GetDateFormat(LOCALE_SYSTEM_DEFAULT,0,&st,"ddd',
' dd MMM yyyy",szDate,sizeof(szDate));
::GetTimeFormat(LOCALE_SYSTEM_DEFAULT,TIME_FORCE24HOURFORMAT,&st,
"HH':'mm':'ss tt",sztTime,sizeof(sztTime));
// here it is...the main data of the message
wsprintf(msgHeader,"DATE: %s %s\r\n", szDate, sztTime);
if (m_pcFromName != NULL) {
strcat(msgHeader,"FROM: ");
strcat(msgHeader, m_pcFromName);
strcat(msgHeader, "\r\n");
}
strcat(msgHeader,"To: ");
strcat(msgHeader, to);
strcat(msgHeader, "\r\n");
strcat(msgHeader,"Cc: ");
strcat(msgHeader, cc);
strcat(msgHeader, "\r\n");
if (m_pcSubject != NULL) {
strcat(msgHeader, "Subject: ");
strcat(msgHeader, m_pcSubject);
strcat(msgHeader, "\r\n");
}
if (m_pcXMailer != NULL) {
strcat(msgHeader,"X-Mailer: ");
strcat(msgHeader, m_pcXMailer);
strcat(msgHeader, "\r\n");
}
// start optional fields
if (m_pcReplyTo != NULL) {
strcat(msgHeader, "Reply-To: ");
strcat(msgHeader, m_pcReplyTo);
strcat(msgHeader, "\r\n");
}
// start MIME versions
strcat(msgHeader,
"MIME-Version: 1.0\r\nContent-type: text/plain; charset=US-ASCII\r\n");
// send header finish command
strcat(msgHeader, "\r\n");
// clean up
delete to;
delete cc;
delete bcc;
// done
return msgHeader;
}
аццкий говнокодер
http://www.codeproject.com/Articles/623/CFastSmtp-Fast-and-easy-SMTP-class
+153
function fnCheckNetwork($intNetworkId)
{
if (intval($intNetworkId) == 0)
{
return false;
}
if ($intNetworkId != $this->fnGetNetworkId())
{
return false;
}
return true;
}
Замечу, что функция использовалась как приватная, а $intNetworkId никогда не мог быть 0.
Вобщем оригинальный способ проверить на равентсво два числа ))
+130
public void GetLocalUsers(out List<string> members) { ... }
Первый раз вижу что-то подобное.
+197
this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.an)!==-1;},ctype_alpha:function(text){if(typeof text!=='string'){return false;}
this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.al)!==-1;},ctype_cntrl:function(text){if(typeof text!=='string'){return false;}
this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.ct)!==-1;},ctype_digit:function(text){if(typeof text!=='string'){return false;}
this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.dg)!==-1;},ctype_graph:function(text){if(typeof text!=='string'){return false;}
this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.gr)!==-1;},ctype_lower:function(text){if(typeof text!=='string'){return false;}
this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.lw)!==-1;},ctype_print:function(text){if(typeof text!=='string'){return false;}
this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.pr)!==-1;},ctype_punct:function(text){if(typeof text!=='string'){return false;}
this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.pu)!==-1;},ctype_space:function(text){if(typeof text!=='string'){return false;}
this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.sp)!==-1;},ctype_upper:function(text){if(typeof text!=='string'){return false;}
this.setlocale('LC_ALL',0);return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.up)!==-1;},ctype_xdigit:function(text){if(typeof text!=='string'){return false;}
При беглом просмотре бросился мне тут в глаза кусочек из http://phpjs.org/downloads/php.common.min.js
−85
http://pastebin.com/UaTdN6K2
А выложу ка я это тут.
Гуано трёхлетней выдержки. Фрагментации не поддаётся. Ныне отправлено на удобрения.
+158
function SetCeilingType(Txt) {
if (Txt == "1") {
document.getElementById("сeilType").value = Txt //"Одноуровневый";
}
else {
document.getElementById("сeilType").value = Txt //"Двухуровневый";
}
createLink();
}
Сраная школота уходит в буддизм.
Вот такая сентенция была найдена за flash-кодером, хуже всего что функция глобальна, так как дергается ИЗ ФЛЕША при изменении в нем данных. Творческое прочтение паттерна инверсии зависимости, сцуко!
+78
Drawable d = getResources().getDrawable(R.drawable.screen_width);
int width = d.getMinimumWidth();
switch (width) {
case 1024:
CAMERA_WIDTH = 1024;
CAMERA_HEIGHT = 600;
break;
case 800:
CAMERA_WIDTH = 800;
CAMERA_HEIGHT = 480;
break;
case 480:
CAMERA_WIDTH = 480;
CAMERA_HEIGHT = 320;
break;
case 320:
CAMERA_WIDTH = 320;
CAMERA_HEIGHT = 240;
break;
default:
CAMERA_WIDTH = 800;
CAMERA_HEIGHT = 480;
break;
}
Вот так автор определял размер экрана в Android...по размеру загруженной картинки в ресурсах
Про getResources().getConfiguration().screen Layout наверное он не знал...
−111
-(void)handleNotification:(id<INotification>)notification
{
NSLog(@"NOTIFICATION:%@", [notification description]);
if ([[notification name] isEqualToString:ShowMetronomeInTab])
{
[self.viewComponent showMetronomeInTab];
}
else if ([[notification name] isEqualToString:AlertOnScreen])
{
isShowRateAlert = YES;
}
else if ([[notification name] isEqualToString:NoAlertOnScreen])
{
isShowRateAlert = NO;
}
else if ([[notification name] isEqualToString: ShowHowToEnter])
{
id body = [notification body];
[self.viewComponent showHowToEnter:body];
}
else if ([[notification name] isEqualToString:ShowResultView])
{
[self.viewComponent showResultView:[notification body] Animated:YES];
}
else if ([[notification name] isEqualToString:ShowIndicatorView])
{
if ([[notification body] isKindOfClass:[NSString class]])
{
[self.viewComponent showLoadingIndicator:[notification body]];
}
else
{
if ([[notification body] isKindOfClass:[NSArray class]])
{
[self.viewComponent showLoadingIndicator:[[notification body] objectAtIndex:0] WithSecondString:[[notification body]objectAtIndex:1]];
}
}
}
else if ([[notification name] isEqualToString:ShowBlackIndicatorView])
{
[self.viewComponent showBlackLoadingIndicator:[notification body]];
}
else if ([[notification name] isEqualToString:RemoveIndicatorView])
{
[self.viewComponent removeLoadingIndicator];
}
else if ([[notification name] isEqualToString:ShowTimeOutAlert])
{
[self.viewComponent displayAlertOnConnectionTimeOut];
}
else if ([[notification name] isEqualToString:ShowNetworkUnavailableAlert])
{
[self.viewComponent displayAlertOnNetworkError];
}
else if ([[notification name] isEqualToString:ShowServiceUnavailableAlert])
{
[self.viewComponent displayAlertOnConnectionError];
}
else if ([[notification name] isEqualToString:ShowHomeView])
{
[self.viewComponent showHomeView];
}
else if ([[notification name] isEqualToString:ShowProcessingView])
{
[self.viewComponent showProcessingView:[notification body]];
} else if ([[notification name] isEqualToString:ShowResultViewNotAnimated])
{
[self.viewComponent showResultView:[notification body] Animated:NO];
} else if ([[notification name] isEqualToString:ShowTimeOutAlertWithParent])
{
[self.viewComponent displayAlertOnConnectionTimeOutWithParent:notification.body];
}
else if ([[notification name] isEqualToString:ShowNetworkUnavailableAlertWithParent])
{
[self.viewComponent displayAlertOnNetworkErrorWithParent:notification.body];
}
else if ([[notification name] isEqualToString:ShowServiceUnavailableAlertWithParent])
{
[self.viewComponent displayAlertOnConnectionErrorWithParent:notification.body];
}
else if ([[notification name] isEqualToString:RotationIndicator])
{
[self.viewComponent rotationIndicator];
}
else if ([[notification name] isEqualToString:StartMusic])
{
if (applicationProxy.mediaPlayerWasPlaying)
{
applicationProxy.mediaPlayerIsPlaying = YES;
[self sendNotification:MediaPlayerChangeState];
MPMusicPlayerController *mpPlayer = [MPMusicPlayerController iPodMusicPlayer];
[mpPlayer play];
}
}
else if ([[notification name] isEqualToString:StopMusic])
{
applicationProxy.mediaPlayerIsPlaying = NO;
[self sendNotification:MediaPlayerChangeState];
И так 50 elseif'ов. И, сцуко, все разные. И в последней трети отформатированы лесенкой.
Местное видение PureMVC
−100
@type('inline hack', (object,), {'__new__':lambda cls, fnc: wraps(lambda request, *args, **kwargs: setattr(request, 'holder', None) and fnc(request, *args, **kwargs))})
def create_receiver(request, id):
pass
Отсутствие инлайновых декораторов предыдущему фрилансеру не помеха