- 1
case UP : o > 0 ? o-- : o = FIELD_SIZE - 1; break;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+911
case UP : o > 0 ? o-- : o = FIELD_SIZE - 1; break;
Друг скинул в аську, попросил перевести в if-ную форму)))
Не знаю где он это откопал)))
+143
!<>
Просто очень короткий говнокод:
Читается как не больше и не меньше.
Конечно, выдумано, но тем не менее :)
+144
#include <iostream>
#include <stdio.h>
using namespace std;
#define chislo int
#define osnovnoe main
#define nachalo {
#define konec }
#define chitaj scanf
#define pishi printf
#define CS ;
#define verni return
#define noleg 0
#define strochechka string
#define naruzhu <<
#define vnutr >>
#define vozmi cin
#define daj cout
#define esli if
#define PISCS endl
#define eshe &&
#define cicle for
#define poka while
#define simvol char
#define vozmis getchar()
#define shlak EOF
#define SPS '\n'
#define vozmozhno ||
#define eshe &&
#define inache else
chislo aasda[1000] CS
chislo chistka()
nachalo
chislo i CS
cicle(i=noleg CS i<1000 CS i++)
aasda[i]=noleg CS
verni aasda[noleg] CS
konec
chislo mnozh(chislo k)
nachalo
chislo i CS
cicle(i=noleg+2 CS i<k CS i++)
esli(k%i==0) nachalo aasda[i]++ CS verni mnozh(k/i)+1 CS konec
aasda[k]++ CS
verni 1 CS
konec
chislo krutilka(chislo k)
nachalo
esli(k==1) verni 1 CS
verni k*krutilka(k-1) CS
konec
chislo osnovnoe()
nachalo
chislo colm, ppm=1, k, i CS
vozmi vnutr k CS
chistka() CS
colm=mnozh(k) CS
cicle(i=noleg CS i<=1000 CS i++)
esli(aasda[i]>0) ppm*=krutilka(aasda[i]) CS
daj naruzhu krutilka(colm)/ppm naruzhu PISCS CS
verni noleg CS
konec
Так мы писали задачи на Турнире Архимеда=)
+165
function month($n){
switch ($n) {
case 1: $m = "сiчнi" ; break;
case 2: $m = "лютому" ; break;
case 3: $m = "березнi"; break;
case 4: $m = "квiтнi" ; break;
case 5: $m = "травнi" ; break;
case 6: $m = "червнi" ; break;
case 7: $m = "липнi" ; break;
case 8: $m = "серпнi" ; break;
case 9: $m = "вереснi"; break;
case 10: $m = "жовтнi" ; break;
case 11: $m = "листопадi"; break;
case 12: $m = "груднi" ; break;
}
return $m;
}
function month2($n)
{
switch ($n)
{
case 1: $m = "сiчень" ; break;
case 2: $m = "лютий" ; break;
case 3: $m = "березень"; break;
case 4: $m = "квiтень" ; break;
case 5: $m = "травень" ; break;
case 6: $m = "червень" ; break;
case 7: $m = "липень" ; break;
case 8: $m = "серпень" ; break;
case 9: $m = "вересень"; break;
case 10: $m = "жовтень" ; break;
case 11: $m = "листопад"; break;
case 12: $m = "грудень" ; break;
}
return $m;
}
/*... всяко разно ...*/
if($month==1)$month="сiчнi";
if($month==2)$month="лютому";
if($month==3)$month="березнi";
if($month==4)$month="квiтнi";
if($month==5)$month="травнi";
if($month==6)$month="червнi";
if($month==7)$month="липнi";
if($month==8)$month="серпнi";
if($month==9)$month="вереснi";
if($month==10)$month="жовтнi";
if($month==11)$month="листопадi";
if($month==12)$month="груднi";
// дебажный комментарий тут был
if($month1==1)$month1="сiчнi";
if($month1==2)$month1="лютому";
if($month1==3)$month1="березнi";
if($month1==4)$month1="квiтнi";
if($month1==5)$month1="травнi";
if($month1==6)$month1="червнi";
if($month1==7)$month1="липнi";
if($month1==8)$month1="серпнi";
if($month1==9)$month1="вереснi";
if($month1==10)$month1="жовтнi";
if($month1==11)$month1="листопадi";
if($month1==12)$month1="груднi";
/*...еще немного...*/
if($month==1)$month1="сiчнi";
if($month==2)$month1="лютому";
if($month==3)$month1="березнi";
if($month==4)$month1="квiтнi";
if($month==5)$month1="травнi";
if($month==6)$month1="червнi";
if($month==7)$month1="липнi";
if($month==8)$month1="серпнi";
if($month==9)$month1="вереснi";
if($month==10)$month1="жовтнi";
if($month==11)$month1="листопадi";
if($month==12)$month1="груднi";
+169
<div class="filterPanel" style="width:250px;">
<div class="filterComboBoxCaption">Диапазон времени:</div>
с: <select name="timeBeginFl" id="timeBeginFlId" style="width:80px;" onChange="javascript:resetTimes();">
<option value="07:00:00" {if $object.timeBeginFl=="07:00:00"}selected{/if}>07:00</option>
<option value="07:30:00" {if $object.timeBeginFl=="07:30:00"}selected{/if}>07:30</option>
<option value="08:00:00" {if $object.timeBeginFl=="08:00:00"}selected{/if}>08:00</option>
<option value="08:30:00" {if $object.timeBeginFl=="08:30:00"}selected{/if}>08:30</option>
<!-- ещё N таких же строчек -->
<option value="05:00:00" {if $object.timeBeginFl=="05:00:00"}selected{/if}>05:00</option>
<option value="05:30:00" {if $object.timeBeginFl=="05:30:00"}selected{/if}>05:30</option>
<option value="06:00:00" {if $object.timeBeginFl=="06:00:00"}selected{/if}>06:00</option>
<option value="06:30:00" {if $object.timeBeginFl=="06:30:00"}selected{/if}>06:30</option>
</select>
по: <select name="timeEndFl" id="timeEndFlId" style="width:80px;">
<option value="07:30:00" {if $object.timeEndFl=="07:30:00"}selected{/if}>07:30</option>
<option value="08:00:00" {if $object.timeEndFl=="08:00:00"}selected{/if}>08:00</option>
<option value="08:30:00" {if $object.timeEndFl=="08:30:00"}selected{/if}>08:30</option>
<option value="09:00:00" {if $object.timeEndFl=="09:00:00"}selected{/if}>09:00</option>
<!-- ещё N таких же строчек -->
<option value="05:00:00" {if $object.timeEndFl=="05:00:00"}selected{/if}>05:00</option>
<option value="05:30:00" {if $object.timeEndFl=="05:30:00"}selected{/if}>05:30</option>
<option value="06:00:00" {if $object.timeEndFl=="06:00:00"}selected{/if}>06:00</option>
<option value="06:30:00" {if $object.timeEndFl=="06:30:00"}selected{/if}>06:30</option>
</select>
</div>
Из шаблонов под Smarty.
−119
sub getMessages{
local($mop,$pg,$all)=@_;
if(!&db_query("select insurance_faq_main.id,date_format(insurance_faq_main.date,'%d.%m.%Y'),insurance_faq_main.name,insurance_faq_main.email,insurance_faq_main.www,insurance_faq_main.city,insurance_faq_main.message,insurance_faq_main.ip,answer from insurance_faq_main, insurance_faq_ans where insurance_faq_ans.idm=insurance_faq_main.id order by id desc limit ".$pg*$mop.",$mop")) {$body .= $db_message; return -1}
$id;
@date;
@name;
@email;
@www;
@city;
@msg;
@ip;
@answer;
for(local $i=0;defined($rows->[$i]);$i++)
{
$id[$i]=$rows->[$i]->[0];
$date[$i]=$rows->[$i]->[1];
$name[$i]=$rows->[$i]->[2];
$email[$i]=$rows->[$i]->[3];
$www[$i]=$rows->[$i]->[4];
$city[$i]=$rows->[$i]->[5];
$msg[$i]=$rows->[$i]->[6];
$ip[$i]=$rows->[$i]->[7];
$answer[$i]=$rows->[$i]->[8];
}
return $i;
}
Мужской способ возвращать результаты из функции
−86
using System;
using System.Web;
using MaxPro;
namespace HandlerFile
{
public class FileHttpHandler : IHttpHandler
{
// Переопределяем метод ProcessRequest.
public void ProcessRequest(HttpContext context)
{
//var
Byte[] oImg;
Int32 iId=0;
Int32 iRemInt=0;
//var Zap
Int32 iNum=0;
Exception oErr;
Object[,] oZap=new Object[0,0];
//end var
if(All.IsInteger(context.Request.QueryString["iId"]))
{
iId=Convert.ToInt32(context.Request.QueryString["iId"]);
iNum=Ow.iZap1i("OneWindow.Procedure173","@iId",iId,out oZap,out oErr);
}
else if(All.IsInteger(context.Request.QueryString["iRemInt"]))
{
iId=Convert.ToInt32(context.Request.QueryString["iRemInt"]);
iNum=Ow.iZap1i("OneWindow.Procedure174","@iRemInt",iRemInt,out oZap,out oErr);
}
if(iNum>0)
{
oImg=(Byte[])oZap[0,0];
//генерация бинарного потока
/* Возможно пригодится, хотя ясности нет зачем,
* но когда ie сбоит и не открывает файл, то это помогает, особенно ClearHeaders
* Response.ClearContent()
* Response.ClearHeaders()
*///
context.Response.ContentEncoding=System.Text.Encoding.GetEncoding("UTF-8");
context.Response.Charset="UTF-8";
context.Request.ContentEncoding=System.Text.Encoding.UTF8;
switch (Convert.ToString(oZap[2,0]))
{
case "gif":
context.Response.ContentType="image/GIF";
context.Response.AddHeader("Content-Disposition","filename="+Convert.ToString(oZap[1,0]));
break;
case "jpg":
context.Response.ContentType="image/JPEG";
context.Response.AddHeader("Content-Disposition","filename="+Convert.ToString(oZap[1,0]));
break;
case "jpeg":
context.Response.ContentType="image/JPEG";
context.Response.AddHeader("Content-Disposition","filename="+Convert.ToString(oZap[1,0]));
break;
case "bmp":
context.Response.ContentType="image/BMP";
context.Response.AddHeader("Content-Disposition","filename="+Convert.ToString(oZap[1,0]));
break;
case "png":
context.Response.ContentType="image/PNG";
context.Response.AddHeader("Content-Disposition","filename="+Convert.ToString(oZap[1,0]));
break;
case "txt":
context.Response.ContentType="text/plain";
context.Response.AddHeader("Content-Disposition","filename="+Convert.ToString(oZap[1,0]));
break;
case "htm":
context.Response.ContentType="text/HTML";
context.Response.AddHeader("Content-Disposition","filename="+Convert.ToString(oZap[1,0]));
break;
case "html":
context.Response.ContentType="text/HTML";
context.Response.AddHeader("Content-Disposition","filename="+Convert.ToString(oZap[1,0]));
break;
case "xls":
context.Response.ContentType="application/vnd.ms-excel";
context.Response.AddHeader("Content-Disposition","attachment; filename="+Convert.ToString(oZap[1,0]));
break;
case "doc":
context.Response.ContentType="application/msword";
context.Response.AddHeader("Content-Disposition","attachment; filename="+Convert.ToString(oZap[1,0]));
break;
case "dot":
context.Response.ContentType="application/msword";
context.Response.AddHeader("Content-Disposition","attachment; filename="+Convert.ToString(oZap[1,0]));
break;
case "ppt":
context.Response.ContentType="application/vnd.ms-powerpoint";
context.Response.AddHeader("Content-Disposition","attachment; filename="+Convert.ToString(oZap[1,0]));
break;
default:
context.Response.AddHeader("Content-Disposition","attachment; filename="+Convert.ToString(oZap[1,0]));
break;
}
context.Response.OutputStream.Write(oImg,0,oImg.Length);
}
}
а вам слабо? всё те же мос окна
−863
SELECT
SQL_CALC_FOUND_ROWS id,
autor,
...бла, бла, бла, ищо штук 15 дефолтных полей...
tags,
perem_1,
perem_2,
perem_3,
perem_4,
perem_5,
perem_6,
perem_7,
perem_8,
perem_9,
perem_10,
perem_11,
perem_12,
perem_13,
perem_14,
perem_15,
perem_16,
perem_17,
perem_18,
perem_19,
perem_20,
perem_21,
perem_22,
poster,
screenshot_1,
screenshot_2,
screenshot_3,
screenshot_4
FROM dle_post
WHERE approve
AND allow_main
AND date < '2010-04-26 04:00:01'
ORDER BY FIXED DESC , date DESC
LIMIT 0 , 6
помните дети, долгое^W употребление LSD^W DLE вредит вашему здоровью
ДЛЕ не способен разделять данные в разделах (видио: разрешение, длительность и тп.; игры: жанр, таблетка, сис.требования и тд...) и вот таким изящным способом дети употреблявшие LSD^W DLE решили свою проблему
+161
$q = mysql_query("select * from users where `login`='$login';") or die (
$err = mysql_error();
$fp = fopen ("mysql_logs/mysql_error.log", "a+");
fwrite ($fp, "".$date." - ".err."");
fclose ($fp);
header('Location: index.php?mysql_error'));
+188
this.innerText = this.innerText.replace(this.innerText, 'Только для зарегистрированных');
Суровые челябинские программисты не перестают удивлять.