- 1
- 2
- 3
- 4
- 5
if (whole_text.toLowerCase().search(new RegExp(search_phrase, 'i')) < 0) {
$(this).css('display', 'none');
} else {
$(this).css('display', 'block');
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+158
if (whole_text.toLowerCase().search(new RegExp(search_phrase, 'i')) < 0) {
$(this).css('display', 'none');
} else {
$(this).css('display', 'block');
}
+164
function trim(s)
{
var i,j;
for (i = 0; i < s.length && s.charAt(i) == " "; i++);
for (j = s.length-1; j >= 0 && s.charAt(j) == " "; j--);
if (i<=j)
return s.substring(i, j+1);
else
return '';
}
+159
protected function paperSizeOrientationValidator(p_printpropertiesobj:Object):Boolean
{
var ret_val:Boolean = (p_printpropertiesobj.printJob.paperWidth == _printPaperTab.paperWidth * PRINT_DPI &&
p_printpropertiesobj.printJob.paperHeight == _printPaperTab.paperHeight * PRINT_DPI)
||
(p_printpropertiesobj.printJob.paperHeight == _printPaperTab.paperWidth * PRINT_DPI &&
p_printpropertiesobj.printJob.paperWidth == _printPaperTab.paperHeight * PRINT_DPI)
||
((p_printpropertiesobj.printJob.paperWidth > _paperPrintMarginLow * _printPaperTab.paperWidth * PRINT_DPI && p_printpropertiesobj.printJob.paperWidth < _paperPrintMarginHigh * _printPaperTab.paperWidth * PRINT_DPI) &&
(p_printpropertiesobj.printJob.paperHeight > _paperPrintMarginLow * _printPaperTab.paperHeight * PRINT_DPI && p_printpropertiesobj.printJob.paperHeight < _paperPrintMarginHigh * _printPaperTab.paperHeight * PRINT_DPI))
||
((p_printpropertiesobj.printJob.paperHeight > _paperPrintMarginLow * _printPaperTab.paperWidth * PRINT_DPI && p_printpropertiesobj.printJob.paperHeight < _paperPrintMarginHigh * _printPaperTab.paperWidth * PRINT_DPI) &&
(p_printpropertiesobj.printJob.paperWidth > _paperPrintMarginLow * _printPaperTab.paperHeight * PRINT_DPI && p_printpropertiesobj.printJob.paperWidth < _paperPrintMarginHigh * _printPaperTab.paperHeight * PRINT_DPI))
return ret_val;
}
This is actually ActionScript. An unknown former colleague was trying to "validate paper orientation" before sending the page to the printer...
+147
signed bool
+146
void swap(word& w)
{
w=w<<8|w>>8;
};
И так, стартует конкурс "самый красивый swap". Жду ваши варианты. Призов не будет, так чисто пожрать.
+952
namespace AppendStrinAtBegin
{
class Program
{
static void ProcessDirectory(string path, string fileMask, Action<string> action)
{
Directory.EnumerateFiles(path, fileMask).ToList().ForEach(action);
Directory.EnumerateDirectories(path).ToList().ForEach
(
subDirectory => ProcessDirectory(subDirectory, fileMask, action)
);
}
static void Main(string[] args)
{
Console.WriteLine("Path FileMask AppendedString");
if (args.Length < 3)
return;
var appendedString = args.Skip(2).Aggregate((workingSentence, next) => workingSentence+ " " +next);
ProcessDirectory(args[0], args[1], (file) => ProcessFile(file, appendedString));
Console.WriteLine("Gun done");
}
static void ProcessFile(string file, string appendedStringAtBegin)
{
var fileLines = File.ReadAllLines(file, Encoding.GetEncoding(1251));
var fileResulted = fileLines.ToList();
fileResulted.Insert(0, appendedStringAtBegin);
File.WriteAllLines(file, fileResulted, Encoding.GetEncoding(1251));
}
}
}
+85
try {
keySpec = new PBEKeySpec(s.toCharArray());
tempKey = SecretKeyFactory.getInstance(ALGORITHM).generateSecret(keySpec);
} catch (InvalidKeySpecException i) {}
if(tempKey == null) {
keySpec = new PBEKeySpec(s.toCharArray());
tempKey = SecretKeyFactory.getInstance(ALGORITHM).generateSecret(keySpec);
}
Будь настойчив и не сдавайся!!!!
+122
for (int y = 0; y < bmp.Height; y++)
{
for (int x = 0; x < bmp.Width; x++)
{
Color col = bmp.GetPixel(x, y);
col = Color.FromArgb((col.R + col.G + col.B) / 3,
(col.R + col.G + col.B) / 3,
(col.R + col.G + col.B) / 3);
int rValue = int.Parse(col.R.ToString());
html.Append(getGrayShade(rValue));
if (x == bmp.Width - 1)
html.Append("<br/&rt");
}
}
Нашел проект на codeproject, для конвертации изображения в аscii-art
+166
$my_query = new WP_Query(array("post_status" => "publish",
"post_type" => "portfolio",
"post_parent" => $post->ID,
"orderby" => "date",
"posts_per_page" => 1));
/*
* Пиздец конечно, но это видимо самое гениальное, что я мог придумать
* в 3 часа ночи
*/
header("Location: ".get_permalink($my_query->posts[0]->ID));
WordPress.
+145
program gays;
uses crt;
var k,k1,kn,n,i,j:integer;
a,c:array [1..100,1..100] of real;
f,x,b,d:array [1..100] of real;
r:real;
begin
repeat
Write ('put poriadok n<100, n=');
readln(n);
until n<100;
for i:=1 to n do
begin
for j:=1 to n do
begin
write('a [',i,';',j,']=');
readln(a[i,j]);
c[i,j]:=a[i,j];
end;
write('b [',i,']=');
readln(b[i]);
d[i]:=b[i];
end;
//3blok
for k:=1 to (n-1) do
begin
//4 blok
if a[k,k]=0 then
begin
k1:=k;
repeat
k1:=k1+1 ;
until (a[k1,k]<>0) or (k1>n);
if a[k1,k]=0 then
begin
writeln('Vedushii elementi ravni nuly');
halt;
end;
kn:=k1;
for j:=1 to n do
begin
r:=a[k,j];
a[k,j]:=a[kn,j];
a[kn,j]:=r;
end;
r:=b[k];
b[k]:=b[kn];
b[kn]:=r;
end;
//5 blok
b[k]:=b[k]/a[k,k];
for i:=(k+1) to n do
b[i]:=b[i]-a[i,k]*b[k];
for j:=(k+1) to n do
begin
a[k,j]:=a[k,j]/a[k,k];
for i:=(k+1) to n do
a[i,j]:=a[i,j]-a[i,k]*a[k,j];
end;
end;
//end 3 blok
x[n]:=b[n]/a[n,n];
// 7 blok
for i:=(n-1) downto 1 do
begin
for j:=i+1 to n do
b[i]:=b[i]-x[j]*a[i,j] ;
x[i]:=b[i];
end;
// 8 blok
for i:=1 to n do
if x[i]<0 then writeln ('nomer otricatelnogo kornia =',i);
for j:=1 to n do writeln('x[',j,']=',x[j]:10:4);
// 9 blok
for i:=1 to n do
begin
f[i]:=-d[i];
for j:=1 to n do
f[i]:=f[i]+c[i,j]*x[j];
writeln('F=',f[i]:10:4);
end;
readkey;
end.
Очередной высер стажера при написании учетного решения в 1С