- 1
http://www.tm-delo.ru/portfolio/
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+147
http://www.tm-delo.ru/portfolio/
Вот Вам сайт, который делает Говно-сайты. Слов нет, печально.
+147
function RandomName($length,$type)
{
$signs = array('0','1','2','3','4','5','6','7','8','9','q','w','e','r','t','y','u','i','o','p','a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m');
if ($type==0) {$z=9;} else {$z=35;}
$word='';
for ($i=0; $i<$length; $i++)
{
$word = $word.$signs[rand(0,$z)];
}
return $word;
}
Генератор случайного имени :D
+147
datatypes.Float = function(inString)
{
var fBytes = [];
for (var i=0;i<4;i++)
{
var curByte = (inString.charCodeAt(i)&255).toString(2);
var byteLen = curByte.length;
if (byteLen<8)
{
for (var bit=0;bit<(8-byteLen);bit++)
curByte = '0'+curByte;
}
fBytes[i] = curByte;
}
var fBits = fBytes[3]+fBytes[2]+fBytes[1]+fBytes[0];
var fSign = parseInt(fBits[0]) ? -1 : 1;
var fExp = parseInt(fBits.substring(1,9),2)-127;
var fMan;
if (fExp == -127)
fMan = 0;
else
{
fMan = 1;
for (i=0;i<23;i++)
{
if (parseInt(fBits[9+i])==1)
fMan = fMan + 1/Math.pow(2,i+1);
}
fMan = fMan.toFixed(7);
}
return(parseFloat((fSign*Math.pow(2,fExp)*fMan).toFixed(3)));
}
Вчера накодил, оцените говнистость.
+147
public class Person {
private final int id;
private final String name;
private final int age;
public Person(int i, String s, int a)
{
id = i;
name = s;
age = a;
}
public int getId()
{
return id;
}
public String getName()
{
return name;
}
public int getAge()
{
return age;
}
}
Примерно такой код был найден мною совсем недавно, сразу же скажу это не точный код, это то, как выглядел тот класс.
+147
public static function prepareHTML ($inStr) {
return htmlspecialchars(htmlspecialchars_decode($inStr));
}
+147
$em = '';
foreach(array_unique(explode(',', $ae)) as $u) {
if(!$u)
continue;
if($em)
$em .= ',';
$em .= $u;
}
Кому сколько времени понадобилось, чтоб понять, что делает этот код?
+147
String classToType(Class cls) {
if (cls == Point.class) {
return "int2";
} else if ((cls == Integer.TYPE) || (cls == Integer.class)) {
return "int";
} else if ((cls == Double.TYPE) || (cls == Double.class)) {
return "double";
} else if (cls == String.class) {
return "String";
} else if ((cls == Boolean.TYPE) || (cls == Boolean.class)) {
return "boolean";
} else {
return null;
}
}
+147
{
//-----------------------------------------
// Declare and initialize variables
WSADATA wsaData;
int iResult = 0;
int iError = 0;
INT iNuminfo = 0;
int i;
// Allocate a 16K buffer to retrieve all the protocol providers
DWORD dwBufferLen = 16384;
LPWSAPROTOCOL_INFO lpProtocolInfo = NULL;
// variables needed for converting provider GUID to a string
int iRet = 0;
WCHAR GuidString[40] = { 0 };
// Initialize Winsock
iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
if (iResult != 0) {
wprintf(L"WSAStartup failed: %d\n", iResult);
return 1;
}
lpProtocolInfo = (LPWSAPROTOCOL_INFO) MALLOC(dwBufferLen);
if (lpProtocolInfo == NULL) {
wprintf(L"Memory allocation for providers buffer failed\n");
WSACleanup();
return 1;
}
iNuminfo = WSAEnumProtocols(NULL, lpProtocolInfo, &dwBufferLen);
if (iNuminfo == SOCKET_ERROR) {
iError = WSAGetLastError();
if (iError != WSAENOBUFS) {
wprintf(L"WSAEnumProtocols failed with error: %d\n", iError);
if (lpProtocolInfo) {
FREE(lpProtocolInfo);
lpProtocolInfo = NULL;
}
WSACleanup();
return 1;
} else {
wprintf(L"WSAEnumProtocols failed with error: WSAENOBUFS (%d)\n",
iError);
wprintf(L" Increasing buffer size to %d\n\n", dwBufferLen);
if (lpProtocolInfo) {
FREE(lpProtocolInfo);
lpProtocolInfo = NULL;
}
lpProtocolInfo = (LPWSAPROTOCOL_INFO) MALLOC(dwBufferLen);
if (lpProtocolInfo == NULL) {
wprintf(L"Memory allocation increase for buffer failed\n");
WSACleanup();
return 1;
}
iNuminfo = WSAEnumProtocols(NULL, lpProtocolInfo, &dwBufferLen);
if (iNuminfo == SOCKET_ERROR) {
iError = WSAGetLastError();
wprintf(L"WSAEnumProtocols failed with error: %d\n", iError);
if (lpProtocolInfo) {
FREE(lpProtocolInfo);
lpProtocolInfo = NULL;
}
WSACleanup();
return 1;
}
}
}
wprintf(L"WSAEnumProtocols succeeded with protocol count = %d\n\n",
iNuminfo);
for (i = 0; i < iNuminfo; i++) {
wprintf(L"Winsock Catalog Provider Entry #%d\n", i);
--- skipped ---
wprintf(L"\n");
}
if (lpProtocolInfo) {
FREE(lpProtocolInfo);
lpProtocolInfo = NULL;
}
WSACleanup();
return 0;
}
http://msdn.microsoft.com/en-us/library/ms741574(v=VS.85).aspx
Я считаю это говнокодом, т.к. автор данного примера страдает сильнейшие паранойей. Всем переменным он присваивает нолики, например перед return строки 87, 52 и т.д. ... Даже iResult, lpProtocolInfo и т.д. в начале...
+147
// выше код метода и проверки... переменная $tmp выше не встречалась
else
{
$tmp = NULL; return $tmp;
}
}
else
{
$tmp = NULL; return $tmp;
}
я сегодня за ваганыча.
+147
$page->WantsChildren();
в раздел "юмор", что ли?
обнаружил забавный метод в
cms made simple
почему бы не "isLeaf"