- 1
- 2
- 3
function log($message){
echo $message; //just echo it out! Yee haw!
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+147.9
function log($message){
echo $message; //just echo it out! Yee haw!
}
офигенный лог
+99
try
SetPropValue(c, aqGetConfigproperty_name.asString,aqGetConfigpropery_value.asvariant);
aqGetConfig.Next;
if aqGetConfigproperty_name.AsString = 'TabVisible'
then begin
if aqGetConfigpropery_value.AsString = '1' then vis:=True
else vis:=False;
SetPropValue(c, aqGetConfigproperty_name.asString,vis);
end
Вот так мы ставим свойства закладок из конфигуратора:)
+156.2
if($started==true && !empty($query))
do { } while ($todo===$berry);
/*
* if started equals true,
* and isn't empty query,
* do nothing while todo
* really more, than berry
*/
no comments
+136.4
public class Xps2Slides
{
private int MakeCollection(List<string> data)
{
...
CallGC();
...
}
private void bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
...
CallGC();
...
}
private void makeDeepZoomFiles(string png)
{
...
CallGC();
}
private string MakePNG(ref FrameworkElement fe, int pageNumber)
{
CallGC();
...
CallGC();
...
}
private void doPNG(string outputPath, ref RenderTargetBitmap bmp)
{
...
CallGC();
...
}
private void CallGC()
{
GC.AddMemoryPressure(300000);// number was picked at random..
GC.Collect();
GC.WaitForPendingFinalizers();
GC.WaitForFullGCComplete();
}
}
Кандидат на позицию программиста: "There are alot of samples on the internet of such similar code, but nothing that could be used for serially generating these collections on the fly without crashing with a memory overflow error or some other input output issue. I have resolved these problems in the file contained in the sample."
+160.1
while ($row = @mysql_fetch_array($result)) {
$id =$row[id];
$appelation =$row[appelation];
$name =$row[name];
$name2 =$row[name2];
$company =$row[company];
$street =$row[street];
$addition =$row[addition];
$state =$row[state];
$zip_code =$row[zip_code];
$city =$row[city];
$country =$row[country];
$email =$row[email];
$fax =$row[fax];
$phone =$row[phone];
}
из одного шопика..
+136
/// <summary>Read-Only property. Gets the Age.</summary>
public Int32 Age {
get {
Int32 age = 0;
if(this.dateOfBirth != DateTime.MaxValue){
String temp = (DateTime.Now.Subtract(this.dateOfBirth).TotalDays / 365).ToString();
age = Convert.ToInt32(temp.Substring(0, temp.IndexOf(".")));
}
return (age);
}
}
вот только одно не понимаю -- мочему Int32?
+44.3
while(*(++a)=*(++b));
Краткость - сетра таланта.
+75.7
bool SCG__PROCEDURE_DestroyThreadAfterFinalizeExecutedTaskForThisThreadAndFreeMemoryAllocatedForThreadsStructuresIfNeed(TThread* ThreadForDestroy)
{
...
};
Из проэкта моего знакомого. Комментарии он пишет очень редко.
+103.9
la:
for j:=8 to (length(a)-length(b) div 2) do
begin
...
if(a[j]>'5') goto la;
...
if(a[j]>'7') goto la;
...
if(a[j]>'2') goto la;
...
j:=j-8;
...
form1.memo1.text=form1.memo1.text+'; '+inttostr(j)+'5';
...
if(a[j]>'1') goto g;
...
j:=j+8;
end;
g:
Не знаю почему, но меня охватывают фиерические чувства. Найденно на просторах рунета в разделах готовых решений задач для студентов.
+57.4
volatile void* AllocatedMemory;
int AllocateMemoryThread(const int size)
{
char buffer[size];
AllocatedMemory=(void*)buffer;
AllocatingDone.Signal();
Sleep(INFINITY);
return 0;
};
...
void* MAlloc(const int size)
{
CriticalSection.Lock();
if( !CreateThread(AllocateMemoryThread,true,size,0) )
return NULL;
AllocatingDone.Wait();
const void* AllocatedBuffer=AllocatedMemory;
CriticalSection.UnLock();
return AllocatedBuffer;
};
CriticalSection - критическая секция.
AllocatingDone - какой-то семафор.
Вообще не могу понять код. Что он этим хотел сказать...