- 1
- 2
string a = "Hello World!";
printf("%s", a);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+142
string a = "Hello World!";
printf("%s", a);
+73
progress = progress != null ? progress + "%" : progress;
Да, давно я не смеялся...
+111
public static byte[] Length_Hex(long _Length)
{
byte[] Buf = { (byte)(_Length >> 0), (byte)(_Length >> 8), (byte)(_Length >> 16), (byte)(_Length >> 24) };
return Buf;
}
Кривой велик
+165
// Color and text
// -- Безупречный
if (nScore >= 90)
{
var strText = "Отличный пароль! Главное не забыть его :) ";
var strColor = "#0ca908";
}
// -- Очень хороший
else if (nScore >= 80)
{
var strText = "Очень хороший";
vstrColor = "#7ff67c";
}
// -- Хороший
else if (nScore >= 70)
{
var strText = "Хороший";
var strColor = "#1740ef";
}
// -- Давольно нормальный
else if (nScore >= 60)
{
var strText = "Достаточно неплохо";
var strColor = "#5a74e3";
}
// -- Нормальный
else if (nScore >= 50)
{
var strText = "Нормально";
var strColor = "#e3cb00";
}
// -- Слабый
else if (nScore >= 25)
{
var strText = "Слабенько";
var strColor = "#e7d61a";
}
// -- Очень плохой
else
{
var strText = "Ужас. (qwerty и то лучше :) ) ";
var strColor = "#e71a1a";
}
else if (nScore >= 25)
{
var strText = "Слабенько";
var strColor = "#e7d61a"; // -- Слабенько?WTF???????
}
Взято с блога великого кодера darkoff.ru
+166
switch(count($Args)) {
case 0:
$Result = new $ClassName; break;
case 1:
$Result = new $ClassName($Args[0]); break;
case 2:
$Result = new $ClassName($Args[0], $Args[1]); break;
case 3:
$Result = new $ClassName($Args[0], $Args[1], $Args[2]); break;
case 4:
$Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3]); break;
case 5:
$Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3], $Args[4]); break;
case 6:
$Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3], $Args[4], $Args[5]); break;
case 7:
$Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3], $Args[4], $Args[5], $Args[6]); break;
case 8:
$Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3], $Args[4], $Args[5], $Args[6], $Args[7]); break;
default:
throw new Exception();
}
Взято из форума Vanilla 2...
И еще в одном файле подобное library/core/class.dispatcher.php (со строки 267).
+139
inline Gdiplus::Color colorrefToGdiColor(COLORREF col, char alpha)
{
return (static_cast<unsigned long>(static_cast<unsigned char>((col & Gdiplus::Color::RedMask) >> Gdiplus::Color::RedShift)) << Gdiplus::Color::BlueShift) | (static_cast<unsigned long>(static_cast<unsigned char>((col & Gdiplus::Color::GreenMask) >> Gdiplus::Color::GreenShift)) << Gdiplus::Color::GreenShift) | (static_cast<unsigned long>(static_cast<unsigned char>((col & Gdiplus::Color::BlueMask) >> Gdiplus::Color::BlueShift)) << Gdiplus::Color::RedShift) | (static_cast<unsigned long>(alpha) << Gdiplus::Color::AlphaShift);
}
Тихо себя ненавижу. Слава Б-г'у это всё выкидывается.
+176
function NDS($poisk)
{
preg_match('#БЕЗ НДС#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#без НДС#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#НДС НЕТ#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#НДС нет#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#НДС не облагается#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#НДС НЕ ОБЛАГАЕТСЯ#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#НДС НЕ ПРЕДУСМОТРЕН#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#Без налога (НДС)#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#НДС: БЕЗ НАЛОГА#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#Без НДС#', $poisk, $matches);
if(empty($matches[0]))
{
preg_match('#без налога (НДС)#', $poisk, $matches);
if(empty($matches[0]))
{}
else return true;
}
else return true;
}
else return true;
}
else return true;
}
else return true;
}
else return true;
}
else return true;
}
else return true;
}
else return true;
}
else return true;
}
else return true;
}
Обнаружено в старом проекте заказчика
+160
m_lActiveTab = GetCurSel();
for (int i = 0; i < GetItemCount(); i++)
m_cItemSelected[m_lActiveTab] = false;
m_cItemSelected[m_lActiveTab] = true;
Вот так говнокодят в крупных проектах
+174
function disconnect_db($link) {
mysql_close($link);
unset($link);
$link = null;
}
а ты уверен, что ты отключился от ДБ?
+144
07.07.2010 14:49:14 com.mchange.v2.c3p0.C3P0Registry banner
INFO: Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace:
10]
07.07.2010 14:49:15 com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoo
lManager
INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acqu
ireIncrement -> 5, acquireRetryAttempts -> 0, acquireRetryDelay -> 500, autoComm
itOnClose -> true, automaticTestTable -> connection_test_table, breakAfterAcquir
eFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null,
connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, d
ataSourceName -> mo0lz2891bvagwh7rwflk|11e1e67, debugUnreturnedConnectionStackTr
aces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factor
yClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToke
n -> mo0lz2891bvagwh7rwflk|11e1e67, idleConnectionTestPeriod -> 3600, initialPoo
lSize -> 10, jdbcUrl -> jdbc:mysql://localhost/mysql, maxAdministrativeTaskTime
-> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0
, maxPoolSize -> 10, maxStatements -> 0, maxStatementsPerConnection -> 100, minP
oolSize -> 10, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0
, preferredTestQuery -> null, properties -> {user=******, password=******}, prop
ertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> fa
lse, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false
]
07.07.2010 14:49:15 com.l2scoria.loginserver.LoginController <init>
INFO: Loading LoginContoller...
07.07.2010 14:49:21 com.l2scoria.loginserver.LoginController <init>
INFO: Cached 10 KeyPairs for RSA communication
Exception in thread "main" java.lang.NullPointerException
at com.l2scoria.util.random.MTRandom.next(MTRandom.java:355)
at java.util.Random.nextDouble(Random.java:438)
at com.l2scoria.util.random.Rnd.nextInt(Rnd.java:55)
at com.l2scoria.loginserver.LoginController.generateBlowFishKeys(LoginCo
ntroller.java:176)
at com.l2scoria.loginserver.LoginController.<init>(LoginController.java:
138)
at com.l2scoria.loginserver.LoginController.load(LoginController.java:10
3)
at com.l2scoria.loginserver.L2LoginServer.<init>(L2LoginServer.java:117)
at com.l2scoria.loginserver.L2LoginServer.main(L2LoginServer.java:61)
LoginServer terminated abnormaly
Send you bug to : http://la2.100nt.ru
LoginServer terminated
Send you bug to : http://la2.100nt.ru
Restart(r) or Quit(q)^CTerminate batch job (Y/N)?