- 1
- 2
- 3
- 4
- 5
if (!opts.matchCase){
var regx = new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + query + ")(?![^<>]*>)(?![^&;]+;)", "gi");
} else {
var regx = new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + query + ")(?![^<>]*>)(?![^&;]+;)", "g");
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+170
if (!opts.matchCase){
var regx = new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + query + ")(?![^<>]*>)(?![^&;]+;)", "gi");
} else {
var regx = new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + query + ")(?![^<>]*>)(?![^&;]+;)", "g");
}
http://code.drewwilson.com/entry/autosuggest-jquery-plugin
+167
int pm = pm == -2 ? -1 : pm_ == -1 ? mi : pm_;
Фрагмент из функции поиска, определение какого-то индекса.
+132
/// <summary>
/// Конвертирование руского текста в английский.
/// </summary>
/// <param name="russianText">Русский текст.</param>
public static string ConvertToEnglish(string russianText)
{
string englishText = russianText.ToLower();
englishText = englishText.Replace("КПК", "PDA");
englishText = englishText.Replace("ПК", "PC");
englishText = englishText.Replace("Ач ", "Ah");
englishText = englishText.Replace("ПО", "Software");
englishText = englishText.Replace("ОС", "OS");
.
.
.
//далее еще около 300 подобных замен
return englishText;
}
Изюминка этого говнокода заключается в первой строчке функции.
Встретил там же где и http://govnokod.ru/6170
+168
function eto_zifra(symbol)
93{
94var value_1=false;
95if(symbol=='0') value_1=true;
96if(symbol=='1') value_1=true;
97if(symbol=='2') value_1=true;
98if(symbol=='3') value_1=true;
99if(symbol=='4') value_1=true;
100if(symbol=='5') value_1=true;
101if(symbol=='6') value_1=true;
102if(symbol=='7') value_1=true;
103if(symbol=='8') value_1=true;
104if(symbol=='9') value_1=true;
105return value_1
106}
Сайт радиомагазина http://tda2000.ru/home/price
+160
private:
private:
friend class boost::iterator_core_access;
Никому не покажу своего друга-буста
+168
bool SomeFuncrion ()
{
...................................
if (dbAttrList.size())
return true;
else
return false;
scroll( 0 , 0 );
}
А вдруг?
+171
bool BMPTextureLoader::Load (GraphicContent **content, string file_name)
{
int width, height;
int bpp;
unsigned char *pixels;
ifstream file (file_name.c_str());
char temp[4];
long unsigned int data_shift;
//Read BMP identifier (bfType)
file.read(temp,2);
temp[2] = '\0';
if ((temp[0] != 'B') || (temp[1] != 'M'))
{
return false;
}
//Ignore file size and two reserved zero (bfSize, bfReserved1, bfReserved2)
file.ignore(8);
//Read pixel-data shift (bfOffBits)
file.read(temp,4);
data_shift = 0;
for (int i=0; i<4; i++)
{
data_shift += (int)(temp[i]) * pow(256.0,i);
}
if (data_shift < 54)
{
return false;
}
//Ignore information data size (biSize)
file.ignore(4);
//Read image width (biWidth)
file.read(temp,4);
width = 0;
for (int i=0; i<4; i++)
{
width += (int)(temp[i]) * pow(256.0,i);
}
if (width < 0)
{
return false;
}
//Read image height (biHeight)
file.read(temp,4);
height = 0;
for (int i=0; i<4; i++)
height += (int)(temp[i]) * pow(256.0,i);
if (height < 0)
{
return false;
}
//Read mandatory 1 (biPlanes)
file.ignore(2);
//Read bite per pixel (biBitCount)
file.read(temp,2);
int bipp = 0;
bipp += (int)(temp[0]) + (int)(temp[1])*256;
if ((bipp <= 0) || (bipp / 8. != 3))
{
return false;
}
bpp = 3;
//Read compression type (biCompression)
file.read(temp,4);
int c_type = 0;
for (int i=0; i<4; i++)
{
c_type += (int)(temp[i]) * pow(256.0,i);
}
if (c_type != 0)
{
return false;
}
file.close();
file.open(file_name);
file.ignore (data_shift);
//Read pixel data
pixels = new unsigned char[width*height*bpp];
for (int i=height-1; i>=0; i--)
{
for (int j=0; j<width; j++)
{
file.read(reinterpret_cast<char*>(&pixels[i*width*bpp + j*bpp + 2]), 1);
file.read(reinterpret_cast<char*>(&pixels[i*width*bpp + j*bpp + 1]), 1);
file.read(reinterpret_cast<char*>(&pixels[i*width*bpp + j*bpp]), 1);
}
}
//Create texture
Terminal terminal;
Считываю BMP файл. Размеры, количество бит на пиксель и тип сжатия считываются нормально. Бит на пиксель 24, сжатия нет(0). Дальше я переоткрываю файл и отступаю нужное кол-во пикселей (смещение данных). После этого считываю данные о цветах пикселей. С рисунками нарисованными непосредственно мной всё проходит нормально. Но с картинками взятыми из интернета происходит сбой. После определённого пикселя считывание прекращается. По дебагу получается что при достижение этого пикселя наступает конец файла. Пробовал вырезать куски изображения из нета и переносить в свой файл. Одни куски переносятся и всё нормально, другие обрывают считывание. Наблюдал эту проблему у нескольких рисунков. Возможно кто-то сталкивался с такой проблемой?
Источник: http://www.gamedev.ru/code/forum/?id=144831
+126
private const string constDefFeedLimitValue = "5";
private string feedLimit = constDefFeedLimitValue;
private int feedLmt;
protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
{
try
{
feedLmt = Convert.ToInt32(feedLimit);
}
catch (Exception)
{
feedLmt = 0;
}
...
}
Автор из Киева, имеет статус MVP.
+146
case enter:
{
TreeNodeBackColorChange();
if (Connection.Login == "" || Connection.Login == null)
{
new fmlogin().ShowDialog();
try
{
if (Connection.Login != "")
foreach (TreeNode item in tvMenuList.Nodes)
{
if (item.Name == lk)
{
item.NodeFont = new Font("arial", 10, FontStyle.Bold);
item.Text += " (" + Connection.Login + ")";
}
}
}
catch { }
}
else MessageBox.Show("Вы уже авторизованы!", "Вход в личный кабинет", MessageBoxButtons.OK, MessageBoxIcon.Warning);
break;
}
case leave:
{
TreeNodeBackColorChange();
if (Connection.Login != "" && Connection.Login != null)
{
if (MessageBox.Show("Вы уверены, что хотите выйти?", "Выход", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
{
Connection.Login = "";
Connection.Pass = "";
try
{
foreach (TreeNode item in tvMenuList.Nodes)
{
foreach (TreeNode item2 in item.Nodes)
{
foreach (TreeNode item3 in item2.Nodes)
{
if (item3.Name == lk)
{
item.NodeFont = tvMenuList.Font;
item3.Text = "Личный кабинет";
}
}
if (item2.Name == lk)
{
item.NodeFont = tvMenuList.Font;
item2.Text = "Личный кабинет";
}
}
if (item.Name == lk)
{
item.NodeFont = tvMenuList.Font;
item.Text = "Личный кабинет";
}
}
}
catch { }
MessageBox.Show("Выход произведен успешно!", "Выход", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
else MessageBox.Show("Вы не авторизованы!", "Выход из личного кабинета", MessageBoxButtons.OK, MessageBoxIcon.Warning);
break;
}
извиняюсь) форматирование сбивается когда из студии вставляю)
PS жалко что нельзя вставить больше 100 строк. А тут такие красивые функции есть, которые теряют всю свою зрелишность при их урезании
+169
if (($_GET['var'])==0 and ($_GET['email'])==1 and ($_GET['numbers'])==1)
$label='Вы неправильно указали логин';
elseif (($_GET['var'])==0 and ($_GET['email'])==0 and ($_GET['numbers'])==1)
$label='Вы неправильно указали логин и е-мейл';
elseif (($_GET['var'])==1 and ($_GET['email'])==0 and ($_GET['numbers'])==1)
$label='Вы неправильно указали е-мейл';
elseif (($_GET['var'])==0 and ($_GET['email'])==0 and ($_GET['numbers'])==0)
$label='Вы неправильно указали логин, е-мейл и числовой набор';
elseif (($_GET['var'])==1 and ($_GET['email'])==1 and ($_GET['numbers'])==0)
$label='Вы неправильно указали числовой набор';
elseif (($_GET['var'])==0 and ($_GET['email'])==1 and ($_GET['numbers'])==0)
$label='Вы неправильно указали логин и числовой набор';
else
$label='';
Вывод ошибки