- 1
#define ass assert (false)
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+141
#define ass assert (false)
...
−131.6
SELECT ct.com_id, cdt.com_name, ct.tax_id, pt.tax_name, tt.date FROM com_table AS ct LEFT OUTER
JOIN com_des_table AS cdt ON cdt.id = ct.com_id LEFT OUTER JOIN payments_table AS pt ON pt.id =
ct.tax_id LEFT OUTER JOIN tax_table AS tt ON tt.tax_id = ct.tax_id WHERE ct.tax_id LIKE '001%' and
ct.com_id = '1' UNION SELECT ct.com_id, cdt.com_name, ct.tax_id, rt.tax_name, tt.date FROM com_table
AS ct LEFT OUTER JOIN com_des_table AS cdt ON cdt.id = ct.com_id LEFT OUTER JOIN reports_table AS
rt ON rt.id = ct.tax_id LEFT OUTER JOIN tax_table AS tt ON tt.tax_id = ct.tax_id WHERE ct.tax_id LIKE
'002%' and ct.com_id = '1' UNION SELECT ct.com_id, cdt.com_name, ct.tax_id, pt.tax_name, tt.date FROM
com_table AS ct LEFT OUTER JOIN com_des_table AS cdt ON cdt.id = ct.com_id LEFT OUTER JOIN
payments_table AS pt ON pt.id = ct.tax_id LEFT OUTER JOIN tax_table AS tt ON tt.tax_id = ct.tax_id
WHERE ct.tax_id LIKE '001%' and ct.com_id = '0' UNION SELECT ct.com_id, cdt.com_name, ct.tax_id,
rt.tax_name, tt.date FROM com_table AS ct LEFT OUTER JOIN com_des_table AS cdt ON cdt.id = ct.com_id
LEFT OUTER JOIN reports_table AS rt ON rt.id = ct.tax_id LEFT OUTER JOIN tax_table AS tt ON tt.tax_id =
ct.tax_id WHERE ct.tax_id LIKE '002%' and ct.com_id = '0' UNION SELECT ct.com_id, cdt.com_name,
ct.tax_id, pt.tax_name, tt.date FROM com_table AS ct LEFT OUTER JOIN com_des_table AS cdt ON cdt.id =
ct.com_id LEFT OUTER JOIN payments_table AS pt ON pt.id = ct.tax_id LEFT OUTER JOIN tax_table AS tt
ON tt.tax_id = ct.tax_id WHERE ct.tax_id LIKE '001%' and ct.com_id = '2' UNION SELECT ct.com_id,
cdt.com_name, ct.tax_id, rt.tax_name, tt.date FROM com_table AS ct LEFT OUTER JOIN com_des_table AS
cdt ON cdt.id = ct.com_id LEFT OUTER JOIN reports_table AS rt ON rt.id = ct.tax_id LEFT OUTER JOIN
tax_table AS tt ON tt.tax_id = ct.tax_id WHERE ct.tax_id LIKE '002%' and ct.com_id = '2' UNION SELECT
ct.com_id, cdt.com_name, ct.tax_id, pt.tax_name, tt.date FROM com_table AS ct LEFT OUTER JOIN
com_des_table AS cdt ON cdt.id = ct.com_id LEFT OUTER JOIN payments_table AS pt ON pt.id = ct.tax_id
LEFT OUTER JOIN tax_table AS tt ON tt.tax_id = ct.tax_id WHERE ct.tax_id LIKE '001%' and ct.com_id = '3'
UNION SELECT ct.com_id, cdt.com_name, ct.tax_id, rt.tax_name, tt.date FROM com_table AS ct LEFT
OUTER JOIN com_des_table AS cdt ON cdt.id = ct.com_id LEFT OUTER JOIN reports_table AS rt ON rt.id =
ct.tax_id LEFT OUTER JOIN tax_table AS tt ON tt.tax_id = ct.tax_id WHERE ct.tax_id LIKE '002%' and
ct.com_id = '3';
Не помню, что именно. Вырыл в старом логе. К сожалению из-за местных ограничений по длине кода не удалось выложить подобные портянки длинной в 10 тыщ символов.
+115.2
class TReadWrapper<TItemType>
{
public static object item(string ItemString)
{
if (typeof(TItemType) == typeof(double))
return Convert.ToDouble(ItemString);
TDbg.Assert(false);
return null;
}
};
class TRead<TItemType>
{
public static TItemType item(StreamReader BinaryStream)
{
string ItemString = BinaryStream.ReadLine();
if (ItemString == null)
throw new Exception();
return (TItemType)TReadWrapper<TItemType>.item(ItemString);
}
};
class TFileToList<TListItem> : List<TListItem>
{
public TFileToList(string FileName)
{
if(typeof(TListItem)==typeof(char))
{
StreamReader file = new StreamReader(FileName, Encoding.Unicode);
string FileData = file.ReadToEnd();
foreach (char item in FileData)
this.Add((TListItem)(object)item);
file.Close();
return;
};
StreamReader fileSource = new StreamReader(FileName, Encoding.Unicode);
try
{
for (;;)
this.Add(TRead<TListItem>.item(fileSource));
}
catch
{
};
fileSource.Close();
}
}
class TListToFile<TListItem>
{
static public void rewrite(string NameOfDestinationFile, List<TListItem> Source)
{
if(typeof(TListItem)==typeof(char))
{
StreamWriter file = new StreamWriter(NameOfDestinationFile, false, Encoding.Unicode);
foreach (TListItem item in Source)
file.Write(item);
file.Flush();
file.Close();
return;
};
StreamWriter fileDestination = new StreamWriter(NameOfDestinationFile, false, Encoding.Unicode);
foreach (TListItem item in Source)
fileDestination.WriteLine(Convert.ToString(item));
fileDestination.Flush();
fileDestination.Close();
}
}
+110
Function IsBigLet(Let: String): Boolean;
var r: bool;
begin
r:=false;
if pos('Й',Let)>0 then r:=true;
if pos('Ц',Let)>0 then r:=true;
if pos('У',Let)>0 then r:=true;
if pos('К',Let)>0 then r:=true;
if pos('Е',Let)>0 then r:=true;
if pos('Н',Let)>0 then r:=true;
if pos('Г',Let)>0 then r:=true;
if pos('Ш',Let)>0 then r:=true;
if pos('Щ',Let)>0 then r:=true;
if pos('З',Let)>0 then r:=true;
if pos('Х',Let)>0 then r:=true;
if pos('Ф',Let)>0 then r:=true;
if pos('Ы',Let)>0 then r:=true;
if pos('В',Let)>0 then r:=true;
if pos('А',Let)>0 then r:=true;
if pos('П',Let)>0 then r:=true;
if pos('Р',Let)>0 then r:=true;
if pos('О',Let)>0 then r:=true;
if pos('Л',Let)>0 then r:=true;
if pos('Д',Let)>0 then r:=true;
if pos('Ж',Let)>0 then r:=true;
if pos('Э',Let)>0 then r:=true;
if pos('Я',Let)>0 then r:=true;
if pos('Ч',Let)>0 then r:=true;
if pos('С',Let)>0 then r:=true;
if pos('М',Let)>0 then r:=true;
if pos('И',Let)>0 then r:=true;
if pos('Т',Let)>0 then r:=true;
if pos('Б',Let)>0 then r:=true;
if pos('Ю',Let)>0 then r:=true;
Result:=r;
end;
Немножко индусского кода!
+186.2
$AmountOfChairs=0;
foreach($faculty['Chair'] as $currChair)
{
$AmountOfChairs++;
}
echo $AmountOfChairs;
+162.8
<?php
function db_connect($host, $user, $pass, $db) {
global $glink;
$glink = mysql_connect($host, $user, $pass) or db_give_error(3, '', db_error($glink));
mysql_select_db($db, $glink) or db_give_error(4, '', db_error($glink));
mysql_query("SET CHARSET cp1251",$glink);
return $glink;
}
function db_query($sql, $log = 0) {
global $glink;
$res = mysql_query($sql, $glink) or db_give_error(5, $sql, db_error($glink));
return $res;
}
function db_fetch_row($res) {
$row = empty($res) ? false : mysql_fetch_row($res);
return $row;
}
function db_num_rows($res, $stmt = '') {
$rows = mysql_num_rows($res);
if (null === $rows) db_give_error(6, '', db_error($glink));
return $rows;
}
function db_num_fields($res, $stmt = '') {
$fields = empty($res) ? false : mysql_num_fields($res);
if (null === $fields) db_give_error(7, '', db_error($glink));
return $fields;
}
function db_field_name($res, $fld) {
$name = (empty($res) or !isset($fld)) ? false : mysql_field_name($res, $fld);
if (false === $name) db_give_error(8, '', db_error($glink));
return $name;
}
function db_affected_rows($res) {
global $glink;
$rows = mysql_affected_rows($glink);
if (null === $rows) db_give_error(9, '', db_error($glink));
return $rows;
}
function db_insert_id($id = 0) {
$id = mysql_insert_id();
return ($id) ? $id : 1;
}
function db_next_id($table, $field, $seqname = 'seq') {
return 0;
}
function db_errno($res) {
return mysql_errno($res);
}
function db_error($res) {
return mysql_error();
}
function db_free_result($res) {
$res = mysql_free_result($res);
return $res;
}
?>
Все из того же проекта (http://govnokod.ru/2929). авторам видимо надоело писать mysql_ и они решили сделать свой аналог db_. При чем смысла от этого полный NULL. Говнокод, он и в Африке говнокод
+163.2
if($id>542)
{
echo '<img Name="altimg" src="'.$foto.'" border=0>';
}
else
{
$size = getimagesize ($foto);
if($size['0']>=500 ? $w=500:$w=$size['0']);
if($size['1']>=500 ? $h=500:$h=$size['1']);
echo '<img Name="altimg" src="'.$foto.'" width="'.$w.'" height="'.$h.'" border=0>';
}
вот что значит запускать бета верси говноскрипта в действие. Не продумав изначально что не плохо бы изменять размеры изображения при заливке пришлось вот так говнокодить.
+55.4
#include <math.h>
#include <assert.h>
#include "vector10d.h"
float vcompare_epsilon10d = 0.0005f;
ml inlined float v10d_getElement(vec10d *v, int index)
{
assert( v != 0);
assert( index >= 0 );
assert( index < 3 );
return (* ((&((v)->x)) + (index) ));
}
ml inlined bool v10d_isValid(const vec10d *v)
{
if(v == 0) return g_false;
if((v->x * v->x) < 0.0f)return g_false;
if((v->y * v->y) < 0.0f)return g_false;
if((v->z * v->z) < 0.0f)return g_false;
if((v->w * v->w) < 0.0f)return g_false;
if((v->m * v->m) < 0.0f)return g_false;
if((v->n * v->n) < 0.0f)return g_false;
if((v->o * v->o) < 0.0f)return g_false;
if((v->p * v->p) < 0.0f)return g_false;
if((v->r * v->r) < 0.0f)return g_false;
if((v->s * v->s) < 0.0f)return g_false;
return g_true;
}
ml inlined void v10d_set(vec10d *v, float x, float y, float z, float w, float m,
float n, float o, float p, float r, float s)
{
assert(v = 0);
v->x=x;
v->y=y;
v->z=z;
v->w=w;
v->m=m;
v->n=n;
v->o=o;
v->p=p;
v->r=r;
v->s=s;
assert( v10d_isValid(v) != g_false );
}
ml inlined void v10d_get(const vec10d *v, float *x, float *y, float *z, float *w,
float *m, float *n, float *o, float *p, float *r, float *s)
{
assert ( v != 0 );
assert ( x != 0 );
assert ( y != 0 );
assert ( z != 0 );
assert ( w != 0 );
assert ( m != 0 );
assert ( n != 0 );
assert ( o != 0 );
assert ( p != 0 );
assert ( r != 0 );
assert ( s != 0 );
assert( v10d_isValid(v) != g_false );
*x = v->x;
*y = v->y;
*z = v->z;
*w = v->w;
*m = v->m;
*n = v->n;
*o = v->o;
*p = v->p;
*r = v->r;
*s = v->s;
}
Сие чудо нарыл на просторах интернетов. Для ценителей весь исходник http://pastebin.org/114060 .. Очевидно чуваки писали очередной Crysis :)
+62.4
#define DOIT(why, doit) !(why) || ((doit), (why))
...
STDMETHODIMP CSimpleCtrl::SetObjectRects(LPCRECT prcPos,LPCRECT prcClip)
{
DOIT(prcPos, ATLTRACE(_T("t: %d | l: %d | b: %d | r: %d"),
prcPos->top, prcPos->left, prcPos->bottom, prcPos->right));
return IOleInPlaceObject_SetObjectRects(prcPos, prcClip);
}
+72.6
Object[] o = new Object[16];
for (int i = 0; i < 20; i++) {
o[i] = "";
}