- 1
- 2
- 3
- 4
const QColor * c = & QColor.red;
const QColor * c = & QColor.rgb(12,12,12);
const QColor * c = & int QColor::red () const;
const int * c = & int QColor::red () const;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+163
const QColor * c = & QColor.red;
const QColor * c = & QColor.rgb(12,12,12);
const QColor * c = & int QColor::red () const;
const int * c = & int QColor::red () const;
Взято отсюда: http://www.prog.org.ru/topic_16855_0.html
Особенно радует фраза: "Пробовал так <....> И другими способами, на которые вылетало множество ошибок".
+179
function redirect_page($script_name)
{
$location = $script_name;
?><script>document.location.href="<? echo $location; ?>";</script><?
}
Я нашел это говно в наш код!
−183
def validate_line(line):
if len(line) <= 2: return False
if line[0] == '""': return False
if line[0] == "''": return False
if line[0] == '+!': return False
if line[0] == '-?': return False
if line[0] == '- (': return False
if line[0] == '-(': return False
if line[0] == '-)': return False
if line[0] == '-6a': return False
if line[0] == '-6a )': return False
if line[0] == '-a': return False
if line[0] == '-aa': return False
if line[0] == '-:': return False
if line[0] == ':': return False
if line[0][0] == '#': return False
if line[0][0] == "'": return False
if line[0][0] == '&': return False
if line[0][0] == '(': return False
return True
Жил был один маленький портальчик одной немаленькой компании. Портал внутренний, пользовался секретамками, манагерами и прочим планктоном. С задачей своей справлялся, не глючил и вообще проблем не приносил. И вот задумали в него добавить пару "фишек". А писался он давно, программиста уже не найти. Полезли в код, а там ... В общем вот; ВЕСЬ код написан в так вот стиле...
+167
public function generateGUID ()
{
$GUID = $this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter()."-";
$GUID = $GUID.$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter()."-";
$GUID = $GUID.$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter()."-";
$GUID = $GUID.$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter()."-";
$GUID = $GUID.$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter().$this->generateCharacter();
return $GUID;
}
из класса для работы с paypal. (скачан с оффсайта)
+159
<?php
session_start();
DEFINE('trusteko', true);
@$l=$_GET['l'];
//echo md5('12345');
include_once "../admin/meta.php";
include_once ("../inc/setup.php");
include_once ("../inc/config.php");
$dbc=db_connect();
if(isset($_POST['reg']))
{
$query="SELECT * FROM `access` WHERE login='".$_POST['login']."' LIMIT 1";
$result = mysql_query($query,$dbc);
$row=mysql_fetch_array($result);
if (md5($_POST['passwd'])==$row['parol'] and $_POST['login']==$row['login'])
{
$_SESSION['passwd']=$_POST['passwd'];
$_SESSION['login']=$_POST['login'];
//////////////////
include "menu_text.php";
//////////////////
}
else
{
echo "<center><form action=\"\" method=\"post\" name=\"reg\">
<table style=\"width:400px; height:50px;border:1px;\" align=\"center\">
<tr><td colspan=\"2\" style=\"text-align:center\">Авторизация</td></tr>
<tr><td>Login:</td><td><input type=\"text\" name=\"login\"></td></tr>
<tr><td>Password:</td><td><input type=\"password\" name=\"passwd\"></td></tr>
<tr><Td colspan=\"2\"><input type=\"submit\" name=\"reg\" value=\"Вход\"></td></tr>
</table>
</form></center>";
}
}
if (isset($_SESSION['login']) and !isset($_POST['reg']))
{
$query="SELECT * FROM `access` WHERE login='".$_SESSION['login']."' LIMIT 1";
$result = mysql_query($query,$dbc);
$row=mysql_fetch_array($result);
if (md5($_SESSION['passwd'])==$row['parol'] and $_SESSION['login']==$row['login'])
{
//////////////////
include "menu_text.php";
//////////////////
}
}
if (!isset($_SESSION['login']) and !isset($_POST['reg']))
{
echo "<center><form action=\"\" method=\"post\" name=\"reg\">
<table style=\"width:400px; height:50px;border:1px;\" align=\"center\">
<tr><td colspan=\"2\" style=\"text-align:center\">Авторизация</td></tr>
<tr><td>Login:</td><td><input type=\"text\" name=\"login\"></td></tr>
<tr><td>Password:</td><td><input type=\"password\" name=\"passwd\"></td></tr>
<tr><Td colspan=\"2\"><input type=\"submit\" name=\"reg\" value=\"Вход\"></td></tr>
</table>
</form></center>";
}
?>
Мое, этому коду 2 года )
Веселая система авторизации.
Разумеется я так уже не пишу ;)
+169
global $_GET, $m_db;
паццтолом
+127
private String addZero(String num){
String res = null;
if (num.length() == 1){
res = "0" + num;
}else{
res = num;
}
return res;
}
.........
String Y = request.getParameter("sdYear");
String M = request.getParameter("sdMonth");
String D = request.getParameter("sdDay");
String sd = null, fd = null;
if ((Y != null)&&(M != null)&&(D != null)&&(Y.length() > 0)&&(M.length() > 0)&&(D.length() > 0)){
sd = Y + addZero(M) + addZero(D);
} else {
sd = "*";
}
Y = request.getParameter("fdYear");
M = request.getParameter("fdMonth");
D = request.getParameter("fdDay");
if ((Y != null)&&(M != null)&&(D != null)&&(Y.length() > 0)&&(M.length() > 0)&&(D.length() > 0)){
fd = Y + addZero(M) + addZero(D);
} else {
fd = "*";
учитесь работать с датой
+172
foreach($shop_search_arr as $k=>$v){
$shop_search_arr[$k] = $v;
}
Чтоб наверняка)
+167
<?
function displayData() {
global $chanTitle, $chanLink, $chanDesc, $rss, $items, $itemCount, $imgTitle, $imgLink, $imgUrl;
global $items, $itemCount;
?>
<?
for($i = 0;$i < 1;$i++) {
if(@$items[$i]['link']<>''){
?>
<? echo '<h4>'.codirovkaReader(@$items[$i]['title']).'</h4>'; ?>
<? echo '<h5>'.codirovkaReader(@$items[$i]['pubdate']).'</h5>'; ?>
<? echo codirovkaReader(@$items[$i]['desc']); ?>
<? echo '<br><hr size="1">'; ?>
<?
}
}
?>
<?
}
parseRSS($url);
?>
+146
import java.awt.*;import java.awt.event.*;import java.util.*;import javax.swing.
*;class T extends JFrame implements Runnable{int C=10,R=20,S=R,i,j,r,l,b;int[][]
M=new int[C][R];T(){setBounds(100,100,C*S,R*S);setDefaultCloseOperation(3);t();
new Thread(this).start();}protected void processKeyEvent(KeyEvent e) {int v=e.
getKeyCode();if(v==37)l=1;if(v==39)r=1;repaint();}void n(){b=0;l=0;for(i=0;i<C;i
++)for(j=0;j<R;j++){if (b>0)break;if(M[i][j]==9){if(i>1){M[i][j]=0;M[i-1][j]=9;}
else b=1;}}}void o(){b=0;r=0;for(i=C-1;i>=0;i--)for(j=0;j<R;j++){if(b>0)break;if
(M[i][j]==9){if(i<C-1){M[i][j]=0;M[i+1][j]=9;}else b=1;}}}public void paint
(Graphics g){super.paint(g);for(i=0;i<C;i++)for(j=0;j<R;j++){int m=M[i][j];if(m
!=0)g.drawRect(i*S,j*S,S,S);}}public static void main(String[]a){new T().
setVisible(true);}public void run(){for(;;){try{Thread.sleep(200);}catch(
Exception e){}if(r>0)o();if(l>0)n();b=0;for(i=C-1;i>=0;i--)for(j=R-1;j>=0;j--){
if (b>0)break;if(M[i][j]==9)if(j<R-1){if(M[i][j+1]==0){if(!isCan()){t();b=1;
break;}M[i][j]=0;M[i][j+1]=9;}else{t();b=1;break;}}else{t();b=1;break;}}repaint(
);}}boolean isCan(){int j,i;for(i=0;i<C;i++)for(j=0;j<R;j++){if(j<R-1&&M[i][j]>8
&&M[i][j+1]==1)return false;}return true;}void t(){int i,j;for(i=C-1;i>=0;i--)
for (j=R-1;j>=0;j--)M[i][j] = M[i][j]!=0?1:0;for(j=0;j<R;j++)for(i=0;i<C;i++){}
Random r=new Random();int s=r.nextInt(3);M[4][0]=9;switch(s){case 0:M[5][0]=9;M[
5][1]=9;break;case 1:M[4][1]=9;M[5][0]=9;M[5][1]=9;break;case 2:M[4][1]=9;M[4][2
]=9;M[4][3]=9;break;}}}
JSwing тетрис : 20 строчек