- 1
- 2
put = "hello"
put put # Гениально!
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+126
put = "hello"
put put # Гениально!
Ну что же, открылся онлайн интерпретатор Lapis-а на отдельном сайте!
http://lapis.at.ua/Lapis.htm
+12
AttachmentService::MimeType AttachmentService::mimeTypeByCodeKey(const QString &codeKey) const
{
if(codeKey.toLower() == QString("MimeType_PDF").toLower()) return MimeType_PDF;
if(codeKey.toLower() == QString("MimeType_JPEG").toLower()) return MimeType_JPEG;
if(codeKey.toLower() == QString("MimeType_PNG").toLower()) return MimeType_PNG;
if(codeKey.toLower() == QString("MimeType_HTML").toLower()) return MimeType_HTML;
if(codeKey.toLower() == QString("MimeType_ZHTML").toLower()) return MimeType_ZHTML;
if(codeKey.toLower() == QString("MimeType_TEXT").toLower()) return MimeType_TEXT;
if(codeKey.toLower() == QString("MimeType_XLS").toLower()) return MimeType_XLS;
if(codeKey.toLower() == QString("MimeType_DOC").toLower()) return MimeType_DOC;
if(codeKey.toLower() == QString("MimeType_PPT").toLower()) return MimeType_PPT;
if(codeKey.toLower() == QString("MimeType_GIF").toLower()) return MimeType_GIF;
if(codeKey.toLower() == QString("MimeType_BMP").toLower()) return MimeType_BMP;
if(codeKey.toLower() == QString("MimeType_MPEG").toLower()) return MimeType_MPEG;
if(codeKey.toLower() == QString("MimeType_MP4").toLower()) return MimeType_MP4;
if(codeKey.toLower() == QString("MimeType_MP3").toLower()) return MimeType_MP3;
return MimeType_UNKNOWN;
}
Коллега откопал в моём коде, написанном под какими-то веществами по ходу.
Изначально было сравнение строк как есть, без приведения в нижний регистр, а потом понадобилось подстраховаться от левого регистра символов.
+146
.text:08104D0B mov ebx, [ebp+arg_0]
.text:08104D0E mov ecx, [ebp+var_C]
.text:08104D11 mov eax, 51EB851Fh
.text:08104D16 imul ecx
.text:08104D18 sar edx, 4
.text:08104D1B mov eax, ecx
.text:08104D1D sar eax, 1Fh
.text:08104D20 sub edx, eax
.text:08104D22 mov [ebp+var_C], edx
.text:08104D25 mov ecx, [ebx+38h]
.text:08104D28 mov eax, 51EB851Fh
.text:08104D2D imul ecx
.text:08104D2F sar edx, 4
.text:08104D32 mov eax, ecx
.text:08104D34 sar eax, 1Fh
.text:08104D37 sub edx, eax
.text:08104D39 mov [ebx+38h], edx
.text:08104D3C cmp [ebp+var_C], 0
.text:08104D40 jg short loc_8104D55
.text:08104D42 mov [ebp+var_C], 1
.text:08104D49 nop
.text:08104D4A nop
.text:08104D4B nop
.text:08104D4C nop
.text:08104D4D nop
.text:08104D4E nop
.text:08104D4F nop
.text:08104D50 nop
.text:08104D51 nop
.text:08104D52 nop
.text:08104D53 nop
.text:08104D54 nop
.text:08104D55
.text:08104D55 loc_8104D55: ; CODE XREF: session_skill::StartSession(bool)+222j
.text:08104D55 mov eax, [ebp+arg_0]
.text:08104D58 cmp byte ptr [eax+29h], 0
.text:08104D5C jz short loc_8104D74
.text:08104D5E mov ebx, [ebp+arg_0]
.text:08104D61 sub esp, 0Ch
.text:08104D64 push offset g_timer
.text:08104D69 call _ZN5abase5timer8get_tickEv ; abase::timer::get_tick(void)
.text:08104D6E add esp, 10h
.text:08104D71 mov [ebx+40h], eax
.text:08104D74
.text:08104D74 loc_8104D74: ; CODE XREF: session_skill::StartSession(bool)+23Ej
.text:08104D74 sub esp, 0Ch
.text:08104D77 push [ebp+var_C]
.text:08104D7A push 0
.text:08104D7C push 14h
.text:08104D7E push offset g_timer
.text:08104D83 mov eax, [ebp+arg_0]
.text:08104D86 add eax, 10h
.text:08104D89 push eax
.text:08104D8A call _ZN5abase10timer_task8SetTimerERNS_5timerEiii ; abase::timer_task::SetTimer(abase::timer &,int,int,int)
.text:08104D8F add esp, 20h
.text:08104D92 sub esp, 8
.text:08104D95 sub esp, 4
.text:08104D98 push 18h ; size
.text:08104D9A call _ZN5abase12ASmallObjectnwEj ; abase::ASmallObject::operator new(uint)
.text:08104D9F add esp, 8
.text:08104DA2 mov [ebp+ptr], eax
.text:08104DA5 mov [ebp+var_19], 1
.text:08104DA9 sub esp, 8
.text:08104DAC push 0Dh
.text:08104DAE mov eax, [ebp+arg_0]
.text:08104DB1 push dword ptr [eax+8]
.text:08104DB4 mov eax, [ebp+arg_0]
.text:08104DB7 push dword ptr [eax+4]
.text:08104DBA push [ebp+ptr]
.text:08104DBD call _ZN22skill_interrupt_filterC1EP11gactive_impii ; skill_interrupt_filter::skill_interrupt_filter(gactive_imp *,int,int)
.text:08104DC2 add esp, 18h
.text:08104DC5 mov [ebp+var_19], 0
.text:08104DC9 mov eax, [ebp+ptr]
.text:08104DCC push eax
.text:08104DCD mov eax, [ebp+arg_0]
.text:08104DD0 mov eax, [eax+4]
.text:08104DD3 add eax, 100h
.text:08104DD8 push eax
.text:08104DD9 call _ZN10filter_man9AddFilterEP6filter ; filter_man::AddFilter(filter *)
.text:08104DDE add esp, 10h
.text:08104DE1 jmp short loc_8104E13
вот собсно
+153
if (!empty($_POST["favoriteColor"])) {
switch($_POST["favoriteColor"]) {
case "Lightred":
$strBackgroundColor = "#FFDAB9";
break;
case "Lightgreen":
$strBackgroundColor = "Lightgreen";
break;
case "Lightblue":
$strBackgroundColor = "Lightblue";
break;
case "Lightgray":
$strBackgroundColor = "Lightgray";
break;
default:
$strBackgroundColor = "Gray";
break;
}
} else {
$strBackgroundColor = "Gray";
}
+117
int mainCRTStartup()
{
int argc = 0;
char* argv[MAX_CMD_ARGS + 1];
char** pargv = argv;
char* cmdLine = strdup(GetCommandLineA());
int result = 0;
g_module = GetModuleHandle(NULL);
g_process = GetCurrentProcess();
g_thread = GetCurrentThread();
g_heap = GetProcessHeap();
for (*pargv = strtok(cmdLine, " "); *pargv && argc < MAX_CMD_ARGS; *pargv = strtok(NULL, " "))
{
++argc;
++pargv;
}
*pargv = NULL;
result = main(argc, argv);
free(cmdLine);
return result;
}
+92
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
with message1 do
begin
Subject:='Test subject';
From := '[email protected]';
To := '[email protected]';
Textbody:='Text body';
[. . .]
Configuration.Fields.Update;
Send;
end;
Лососнул тунца.
with message1 do
begin
Subject:='Test subject';
From := '[email protected]';
To := '[email protected]';
Textbody:='Text body';
+153
php_sapi_name() === 'cli' or exit('Only CLI mode allowed');
getenv('API_HOST') or exit(<<<EOT
To run tests you should setup "API_HOST" environment variable.
Try follow in bash command line:
$ export API_HOST=<api_host>
cd path/to/tests
php direct_report_problem.php
EOT
);
defined('API_ENDPOINT') || define('API_ENDPOINT', getenv('API_HOST') . '/webservice/index.php');
$method = API_ENDPOINT . '?op=...';
$describe = function ($msg, $test) {
printf("\n\n[%s]\n\n%s\n\n", $msg, shell_exec($test()));
sleep(2);
};
$describe('Cannot upload empty report', function() use ($method) {
return 'curl'
. ' -F user_id=61'
. ' ' . $method;
});
$describe('Can upload only direct report note', function() use ($method) {
return 'curl'
. ' -F user_id=61'
. ' -F problem_note=NOTE'
. ' ' . $method;
});
$describe('Can upload only direct report sound', function() use ($method) {
return 'curl'
. ' -F user_id=61'
. ' -F [email protected]'
. ' ' . $method;
});
$describe('Can upload only direct report image', function() use ($method) {
return 'curl'
. ' -F user_id=61'
. ' -F [email protected]'
. ' ' . $method;
});
$describe('Can upload all data direct report note, image, sound', function() use ($method) {
return 'curl'
. ' -F user_id=61'
. ' -F problem_note=NOTE'
. ' -F [email protected]'
. ' -F [email protected]'
. ' ' . $method;
});
+122
Не смог выделить 100 строк, объединённых общей логикой, да и всей картины это бы не передавало.
Для любителей покопаться в.
Ссылка в описании.
https://github.com/KustoSoft/ru2ch-toolset
© Корпорация KustoSoft
+137
catch(Exception ex)
{
try
{
insertAction(TXTextControl.StringStreamType.PlainText);
GcmExceptionHandlerForm.ShowException(ex);
}
catch (Exception ex2)
{
GcmExceptionHandlerForm.ShowException(ex2);
}
}
Что-то пошло не так...
+169
?><tr><?
?><script><?
?>$(function(){<?
?>$('tr[_hash]').find('#smalllinks').click(function(){<?
?>$(this).parent(0).html($(this).parent(0).find('#fulllinks').html());<?
?>});<?
?>$('tr[_hash] #rm').click(function(){<?
?>var _hash=$(this).parent(0).parent(0).attr('_hash');<?
?>$.ajax({<?
?>url:'?a&st&rm='+_hash,<?
?>success:function(data){<?
?>if(data=='1')get('st');<?
?>}<?
?>});<?
?>});<?
?>$('tr[_hash]').find('#stat_domain').click(function(){<?
?>P_domain=$(this).html();<?
?>get('st');<?
?>});<?
?>});<?
?>function rm_all()<?
?>{<?
?>if(confirm('Удалить всю статистику?'))<?
?>{<?
?>$.ajax({<?
?>url:'?a&st&rmall',<?
?>success:function(data){<?
?>if(data=='1')get('st');<?
?>}<?
?>});<?
?>}<?
?>}<?
?>function refresh_dom()<?
?>{<?
?>var _i='<img src="?i=ld"> ';_i+=_i;_i+=_i;_i+=_i;<?
?>$('table#c').prepend('<td class=n align=center colspan=999>'+_i+'</td>');<?
?>$.ajax({<?
?>url:'?a&st&rdom',<?
?>success:function(data){<?
?>if(data=='1')get('st');<?
?>}<?
?>});<?
?>}<?
?>function update_pr_tic()<?
?>{<?
?>var _i='<img src="?i=ld"> ';_i+=_i;_i+=_i;_i+=_i;<?
?>$('table#c').prepend('<td class=n align=center colspan=999>'+_i+'</td>');<?
?>$.ajax({<?
?>url:'?a&st&upd_pr_tic',<?
?>success:function(data){<?
?>if(data=='1')get('st');<?
?>}<?
?>});<?
?>}<?
?></script><?
?><td class=n colspan=5><?
?><input type=button value=' Обновить домены ' onclick='refresh_dom()'/> <?
?><input type=button value=' Удалить все ' onclick='rm_all()'/> <?
?><input type=button value=' Обновить PR, тИЦ ' onclick='update_pr_tic()'/> <?
?>(доменов: <b><?=$result_domains_count?></b>) <?
?>Количество: <b><?=$result_count?></b><?
if (!empty($domain))
{
?>, домен <b><?=$domain?></b><?
}
?></td><?
?><td class=n><?
if ($pages_count > 1)
{
?><select id="selpage"><?
for($i=1; $i<=$pages_count; $i++)
{
?><option <?=$i==($page_num+1)?'selected':''?>><?=$i?></option><?
}
?></select><?
}
?></td><?
?></tr><?
Такой вот необычный код мне попался в одном скрипте.