- 1
- 2
- 3
- 4
- 5
If bd12tc->mes!=num_month
st_mes=num_month
Else
st_mes=bd12tc->mes
EndIf
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+97
If bd12tc->mes!=num_month
st_mes=num_month
Else
st_mes=bd12tc->mes
EndIf
Clipper
Перевожу на работе старую программку (писалась больше 12 лет назад) в Delphi, нашёл вот такое
+121
procedure TForm1.Timer2Timer(Sender: TObject);
begin
image75.Visible:=false;image76.Visible:=false;
image1.Visible:=true;image2.Visible:=true;image3.Visible:=true;
image4.Visible:=true;image5.Visible:=true;image6.Visible:=true;
image7.Visible:=true;image8.Visible:=true;image9.Visible:=true;
image10.Visible:=true;image11.Visible:=true;image12.Visible:=true;
image13.Visible:=true;image14.Visible:=true;image15.Visible:=true;
image16.Visible:=true;image17.Visible:=true;image18.Visible:=true;
image19.Visible:=true;image20.Visible:=true;image21.Visible:=true;
image22.Visible:=true;image23.Visible:=true;image24.Visible:=true;
image25.Visible:=true;image26.Visible:=true;image27.Visible:=true;
image28.Visible:=true;image29.Visible:=true;image30.Visible:=true;
image31.Visible:=true;image32.Visible:=true;image33.Visible:=true;
image34.Visible:=true;image35.Visible:=true;image36.Visible:=true;
image37.Visible:=true;image38.Visible:=true;image39.Visible:=true;
image40.Visible:=true;image41.Visible:=true;image42.Visible:=true;
image43.Visible:=true;image44.Visible:=true;image45.Visible:=true;
image46.Visible:=true;image47.Visible:=true;image48.Visible:=true;
image49.Visible:=true;image50.Visible:=true;image51.Visible:=true;
image52.Visible:=true;image53.Visible:=true;image54.Visible:=true;
image55.Visible:=true;image56.Visible:=true;image57.Visible:=true;
image58.Visible:=true;image59.Visible:=true;image60.Visible:=true;
image61.Visible:=true;image62.Visible:=true;image63.Visible:=true;
image64.Visible:=true;image65.Visible:=true;image66.Visible:=true;
image67.Visible:=true;image68.Visible:=true;image69.Visible:=true;
image70.Visible:=true;image71.Visible:=true;image72.Visible:=true;
image73.Visible:=true;
if image1.left<360 then begin timer2.Enabled:=false;button2.Visible:=true;
image1.Visible:=false;image2.Visible:=false;image3.Visible:=false;
image4.Visible:=false;image5.Visible:=false;image6.Visible:=false;
image7.Visible:=false;image8.Visible:=false;image9.Visible:=false;
image10.Visible:=false;image11.Visible:=false;image12.Visible:=false;
image13.Visible:=false;image14.Visible:=false;image15.Visible:=false;
image16.Visible:=false;image17.Visible:=false;image18.Visible:=false;
image19.Visible:=false;image20.Visible:=false;image21.Visible:=false;
image22.Visible:=false;image23.Visible:=false;image24.Visible:=false;
image25.Visible:=false;image26.Visible:=false;image27.Visible:=false;
image28.Visible:=false;image29.Visible:=false;image30.Visible:=false;
image31.Visible:=false;image32.Visible:=false;image33.Visible:=false;
image34.Visible:=false;image35.Visible:=false;image36.Visible:=false;
image37.Visible:=false;image38.Visible:=false;image39.Visible:=false;
image40.Visible:=false;image41.Visible:=false;image42.Visible:=false;
image43.Visible:=false;image44.Visible:=false;image45.Visible:=false;
image46.Visible:=false;image47.Visible:=false;image48.Visible:=false;
image49.Visible:=false;image50.Visible:=false;image51.Visible:=false;
image52.Visible:=false;image53.Visible:=false;image54.Visible:=false;
image55.Visible:=false;image56.Visible:=false;image57.Visible:=false;
image58.Visible:=false;image59.Visible:=false;image60.Visible:=false;
image61.Visible:=false;image62.Visible:=false;image63.Visible:=false;
image64.Visible:=false;image65.Visible:=false;image66.Visible:=false;
image67.Visible:=false;image68.Visible:=false;image69.Visible:=false;
image70.Visible:=false;image71.Visible:=false;image72.Visible:=false;
image73.Visible:=false;end
else begin image1.left:=image1.Left-3;image1.top:=image1.top-1;
image2.left:=image2.Left+2;image2.top:=image2.top+2;
image3.left:=image3.Left-1;image3.top:=image3.top-3;
image4.left:=image4.Left-2;image4.top:=image4.top+4;
...
Ещё 65 строк кода!
Анимация взрыва на Delphi 7.
+102
$compareCost = 0;
$countGacha = 0;
for($i=0; $i<10; ++$i):
$compareCost += $this->freeGacha->getCost();
if( $this->player->getSocialPoint() > $compareCost ) continue;
else break;
$countGacha = $i+1;
endfor;
Korean style ;)
+96
public void setWeather(WeatherData[] weather) {
weatherInfo.setWeather(weather[0]);
weatherInfo.setTomorrowWeather(weather[1]);
weatherInfo.setDayAfterTomorrowWeather(weather[2]);
weatherInfo.setDayAfterDayAfterTomorrowWeather(weather[3]);
weatherInfo.setDayAfterDayAfterDayAfterTomorrowWeather(weather[4]);
weatherInfo.setDayAfterDayAfterDayAfterDayAfterTomorrowWeather(weather[5]);
}
Студенты такие студенты....
+100
if ($node->title == 'Главная страница' || $node->title == 'Home')
{print '<img src="sites/all/themes/them/images/stock.png" />';
}
Говнокод по Drupal-овски.
Найден в шаблоне page.tpl.php
−89
MdlСимметричность.Командная(СтИстБи, ФлагСим, КвоРабЧис)
If ФлагСим = True Then ' тут мы сохраним столб истинности линейной функции и количество рабочих чисел
ФлагСим1 = True 'покажем, что хоть одна функция симметрична
СохранимНужнуюФункцию(СчетСим, КвоРабЧисЖмин, КвоРабЧис, СтИстБи, СтИстБиИскомыйСим)
End If
Как, пример, как нельзя называть и обзывать переменные и имена функций. Взято отсюда: http://www.sql.ru/forum/actualthread.aspx?tid=934300
+96
// expressions to parse
$input_pars = array(
's:2'=>'(sort(\d+)/?)?', //1-2
'id:2'=>'((\d+)/?)?', //3-4
'utkonos_id-shop_id:2-2'=>'(u(\d+)(s(\d+))?/)?', //5-6 7-8
'iid:1'=>'([0-9a-zA-Z_]+)/?', //9
'page:2'=>'(pg(\d+)/)?', //10-11
'chpsize:2'=>'(chp(\d+)/)?', //12-13
'chlist:2'=>'(chlist_(grid|list)/)?', //14-15
'p_other:1'=>'(.*)', //16
);
if(!$class)unset($input_pars['iid:1']);
$m = array();
$i=0;
if(isset($_REQUEST['p_'])&&preg_match('[^'.implode('',$input_pars).'$]',$_REQUEST['p_'],$m)) {
//vd($m);
foreach($input_pars as $key=>$line) {
list($par_name,$num) = explode(':', $key);
$par_name_arr = explode('-',$par_name);
$num_arr = explode('-',$num);
if(count($par_name_arr)>1) {
foreach($par_name_arr as $kluch => $par_name) {
$i += $num_arr[$kluch];
$_REQUEST[$par_name] = $m[$i];
}
}else{
$i += $num;
$_REQUEST[$par_name] = $m[$i];
}
}
$_REQUEST['id'] += 0;
if ($_REQUEST['s'] === '0') {
$_REQUEST['s'] = 0;
}
if ($_REQUEST['chpsize'] === '0') {
$_REQUEST['chpsize'] = 0;
}
vd($_REQUEST);
}else{
$_REQUEST['s'] = grv('s',-1); /// Сортировка
$_REQUEST['id'] = grv('id',0);
$_REQUEST['shop_id'] = grv('shop_id',0);
$_REQUEST['page'] = grv('page',0);
$_REQUEST['chpsize'] = (int)grv('chpsize',-1);
}
+103
digits n = reverse $ map (`mod` 10) (takeWhile (/= 0) (iterate (`div` 10) n))
fromDigits l = sum $ zipWith (*) (reverse l) (map (10^) [0..])
isPalindromic x = digits x == (reverse $ digits x)
f :: Integer -> [[Integer]] -> [Integer] -> Int -> [[Integer]]
f x founded lookedup niter
| niter > 50 = [notlychers, [x] ++ lychers ++ lookedup, zs]
| nextX `elem` notlychers = [[x] ++ notlychers ++ lookedup, lychers, zs]
| nextX `elem` lychers = [notlychers, [x] ++ lychers ++ lookedup, zs]
| isPalindromic nextX = [[x] ++ notlychers ++ lookedup, lychers, zs]
| otherwise = f nextX founded (x : lookedup) (niter+1)
where nextX = x + fromDigits (reverse $ digits x)
notlychers = founded !! 0
lychers = founded !! 1
zs = founded !! 2
g :: [[Integer]] -> [[Integer]]
g founded = f (x-1) [xs, ys, [x-1]] [] 0
where x = zs !! 0
xs = founded !! 0
ys = founded !! 1
zs = founded !! 2
gg n = g [[],[],[n+1]]
isLycher n = null $ (gg n) !! 0
http://projecteuler.net/problem=55
http://projecteuler.net/thread=55
>i even haven't understood why it works :(
+95
<table style="width: 100%">
<tr>
<td rowspan="2" style="width: 39px"> </td>
<td height="22px" width="306px" background="/templates/images/all_for_your.jpg" style="background-repeat: no-repeat;"></td>
<td> </td>
</tr>
<tr>
<td width="306px">
<table class="style2" style="height: 147px;" >
<tr>
<!--<td height="22px" width="306px" background="/templates/images/all_for_your.jpg">
</td>-->
</tr>
<tr>
<td class="style14" style="height: 21px;"><a href="page13.html" <?php if ($_GET['id'] == 13) echo "style=\"color: red;\""; ?>> ччччч</td>
</tr>
<tr>
<td class="style14" style="height: 21px;"><a href="page12.html" <?php if ($_GET['id'] == 12) echo "style=\"color: red;\""; ?>> фвургия</td>
</tr>
<tr>
<td class="style14" style="height: 21px; ">
<a href="page8.html" <?php if ($_GET['id'] == 8) echo "style=\"color: red;\""; ?>> ывфыв</a> </td>
</tr>
<tr>
<td class="style14" style="height: 21px; ;"><a href="page9.html" <?php if ($_GET['id'] == 9) echo "style=\"color: red;\""; ?>> ыывсия</td>
</tr>
<tr>
<td class="style14" style="height: 21px; "><a href="page43.html" <?php if ($_GET['id'] == 43) echo "style=\"color: red;\""; ?>> Вмиика</td>
</tr>
<tr>
<td class="style14" style="height: 21px; "><a href="page10.html" <?php if ($_GET['id'] == 10) echo "style=\"color: red;\""; ?>>ние</td>
</tr>
<tr>
<td class="style14" style="height: 21px; "><a href="page14.html" <?php if ($_GET['id'] == 14) echo "style=\"color: red;\""; ?>>Одыа
</td>
</tr>
<tr>
<td class="style14" style="height: 21px; "><a href="page22.html" <?php if ($_GET['id'] == 22) echo "style=\"color: red;\""; ?>> Оысия</td>
</tr>
</table>
Один из старых сайтов нашел:)
+112
<?php
@session_start();
include("с.php");
if(isset($_POST['postid'])){
if($_POST['PoM']=="plus"){
if(isset($_SESSION['userid']) && mysql_num_rows(mysql_query("SELECT * FROM `bans` WHERE `userid`='".@$_SESSION['userid']."';"))==0){
$query89=mysql_query("SELECT `from` FROM `blogs` WHERE `bid`='".$_POST['postid']."' LIMIT 1;");
if($_SESSION['userid']==mysql_result($query89, 0, 0)){ } else {
$get_rating=mysql_query("SELECT `rating` FROM `blogs` WHERE `bid`='".$_POST['postid']."';");
$check_vote_plus=mysql_query("SELECT `voteid` FROM `blogvotes` WHERE `bid`='".$_POST['postid']."' and `userid`='".$_SESSION['userid']."' and `PoM`='plus';");
$check_vote_minus=mysql_query("SELECT `voteid` FROM `blogvotes` WHERE `bid`='".$_POST['postid']."' and `userid`='".$_SESSION['userid']."' and `PoM`='minus';");
if(mysql_num_rows(@$check_vote_minus)){
mysql_query("DELETE FROM `blogvotes` WHERE `bid`='".$_POST['postid']."' and `userid`='".$_SESSION['userid']."';");
mysql_query("UPDATE `blogs` SET `rating`=".mysql_result($get_rating, 0, 0)."+1 WHERE `bid`='".$_POST['postid']."';");
}
$get_rating2=mysql_query("SELECT `rating` FROM `blogs` WHERE `bid`='".$_POST['postid']."';");
$check_vote_plus3=mysql_query("SELECT `voteid` FROM `blogvotes` WHERE `bid`='".$_POST['postid']."' and `userid`='".$_SESSION['userid']."' and `PoM`='plus';");
if(!mysql_num_rows(@$check_vote_plus3)){
mysql_query("UPDATE `blogs` SET `rating`=".mysql_result($get_rating2, 0, 0)."+1 WHERE `bid`='".$_POST['postid']."';");
mysql_query("INSERT INTO blogvotes(`bid`, `userid`, `PoM`) VALUES('".$_POST['postid']."', '".$_SESSION['userid']."', '".$_POST['PoM']."');");
$query6=mysql_query("SELECT `userid`, `username`, `email`, `points`, `reputation` FROM `users` WHERE `userid`='".$_SESSION['userid']."' LIMIT 1");
$current_user=mysql_fetch_row($query6);
}
}
}
$get_r_rating=mysql_query("SELECT `rating` FROM `blogs` WHERE `bid`='".$_POST['postid']."';");
$ratingValue=mysql_result($get_r_rating, 0, 0);
}
}
?>
Очередной код, используемый в моём самописном движке для оценки постов. Разобраться во всём этом удаётся только благодаря тому, что я писал его недавно и помню построение кода.