- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
if(x*x > = 0)
{
// какие-то действия
}
else
{
// какие-то действия
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+177
if(x*x > = 0)
{
// какие-то действия
}
else
{
// какие-то действия
}
Код встретил у знакомой студентки :3 Не, ну а в вдруг?
+165
javascript:
document.write(
document.getElementsByTagName('body')0].
getElementsByTagName('div')[0].
getElementsByTagName('div')[0].
getElementsByTagName('div')[2].
getElementsByTagName('div')[1].
getElementsByTagName('div')[0].
getElementsByTagName('div')[0].
getElementsByTagName('table')[0].
getElementsByTagName('tbody')[0].
getElementsByTagName('tr')[0].
getElementsByTagName('td')[0].
getElementsByTagName('div')[0].
getElementsByTagName('div')[0].
getElementsByTagName('div')[0].
getElementsByTagName('div')[1].
getElementsByTagName('table')[0].
getElementsByTagName('tbody')[0].
getElementsByTagName('tr')[0].
getElementsByTagName('td')[1].
getElementsByTagName('div')[0].
getElementsByTagName('b')[0].
getElementsByTagName('a')[0].value
);
http://javascript.ru/tutorial/dom/search#comment-5934
Вот как писать надо!
−132
Договор = Неопределено;
ВыборкаДоговоров = Справочники.ДоговорыКонтрагентов.Выбрать();
Пока ВыборкаДоговоров .Следующий() Цикл
Если ВыборкаДоговоров.Ссылка = Документ.ДоговорКонтрагента Тогда
Договор = ВыборкаДоговоров.Ссылка;
КонецЕсли;
КонецЦикла
ТабДокумент.Параметры.Договор = Договор.Наименеование;
Попросили стажера сделать печатную форму.
−162
USE [VOLTAREN]
GO
/****** Object: UserDefinedFunction [dbo].[myReplace] Script Date: 04/05/2011 12:11:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[myReplace](@NAME varchar(255))
RETURNS varchar(255)
BEGIN
set @NAME = (
UPPER(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
@NAME,'*','')
,'табл','таб')
,'~','')
,'`','')
,'<','')
,'>','')
,'}','')
,'{','')
,']','')
,'[','')
,'=','')
,'_','')
,'#','')
,'$','')
,'?','')
,'^','')
,'&','')
,'@','')
,'''','')
,'"','')
,':','')
,'%','')
,'-','')
,'+','')
,')','')
,'(','')
,'N','')
,'№','')
,'|','')
,'\','')
,'/','')
,'!','')
,';','')
,',','')
,'.','')
,' ','')));
return(
replace(
@NAME,
'покробол','по')
)
END;
функция удаления не нужных символов из строки
+157
//проверяем расширение
$rashirenie= substr($result_img['url'], strrpos($result_img['url'], '.') + 1);
$rashirenie=trim($rashirenie) ;
if($rashirenie=='jpg' or $rashirenie=='JPG' )
{
echo "<a href='".$path.$uploads.$result_img['url']."' target='_blank'><img src='img/jpg.png'></a><a href='del_img.php?id_image=".$result_img['id_image']."'><img src='img/del2.png' align='top'></a>" ;
}
if($rashirenie=='png' or $rashirenie=='PNG' )
{
echo "<a href='".$path.$uploads.$result_img['url']."' target='_blank'><img src='img/png.png'></a><a href='del_img.php?id_image=".$result_img['id_image']."'><img src='img/del2.png' align='top'></a>" ;
}
if($rashirenie=='gif' or $rashirenie=='GIF' )
{
echo "<a href='".$path.$uploads.$result_img['url']."' target='_blank'><img src='img/gif.png'></a><a href='del_img.php?id_image=".$result_img['id_image']."'><img src='img/del2.png' align='top'></a>" ;
}
if($rashirenie=='doc' or $rashirenie=='docx' )
{
echo "<a href='".$path.$uploads.$result_img['url']."' target='_blank'><img src='img/word.png'></a><a href='del_img.php?id_image=".$result_img['id_image']."'><img src='img/del2.png' align='top'></a>" ;
}
if($rashirenie=='xls' )
{
echo "<a href='".$path.$uploads.$result_img['url']."' target='_blank'><img src='img/exel.png'></a><a href='del_img.php?id_image=".$result_img['id_image']."'><img src='img/del2.png' align='top'></a>" ;
}
if($rashirenie=='txt' )
{
echo "<a href='".$path.$uploads.$result_img['url']."' target='_blank'><img src='img/txt.png'><a href='del_img.php?id_image=".$result_img['id_image']."'><img src='img/del2.png' align='top'></a></a>" ;
}
if($rashirenie=='pdf' )
{
echo "<a href='".$path.$uploads.$result_img['url']."' target='_blank'><img src='img/pdf.png'><a href='del_img.php?id_image=".$result_img['id_image']."'><img src='img/del2.png' align='top'></a></a>" ;
}
if($rashirenie=='zip' )
{
echo "<a href='".$path.$uploads.$result_img['url']."' target='_blank'><img src='img/zip.png'><a href='del_img.php?id_image=".$result_img['id_image']."'><img src='img/del2.png' align='top'></a></a>" ;
}
if($rashirenie=='rar' )
{
echo "<a href='".$path.$uploads.$result_img['url']."' target='_blank'><img src='img/rar.png'><a href='del_img.php?id_image=".$result_img['id_image']."'><img src='img/del2.png' align='top'></a></a>" ;
}
}
все стандартно самописный CMS:)
+980
if (ch=='k' && ch!='t')
{
something
}
Найдено в довольно серьезном проекте.
+168
function eto_zifra(symbol)
93{
94var value_1=false;
95if(symbol=='0') value_1=true;
96if(symbol=='1') value_1=true;
97if(symbol=='2') value_1=true;
98if(symbol=='3') value_1=true;
99if(symbol=='4') value_1=true;
100if(symbol=='5') value_1=true;
101if(symbol=='6') value_1=true;
102if(symbol=='7') value_1=true;
103if(symbol=='8') value_1=true;
104if(symbol=='9') value_1=true;
105return value_1
106}
Сайт радиомагазина http://tda2000.ru/home/price
−131
#!/bin/bash
######################################################################################
#
# Write a bash script that obtains active processes for the current user,
# breaks them into chains and prints all unique chains containing 3 or more
# PIDs in the following format:
# PID1:PID2:PID3:…:PIDn
# PID:PID:PID:…:PID
# …
# So that each next PID is a parent of the previous PID, the first PID in
# each chain does not have children and the last PID in each chain
# does not have parent.
#
######################################################################################
TEMPFILE="/tmp/$0$$" # file needs to save the process list
# it's really needed to divide columns
# generated 'ps'
# parameters:
# -H - sorts the list as process forest (it lets to find connection between child and parent faster)
# -o - sets the output format
# "%p %P" - thow columns in output: PID and PPID
# -u - sets username
# `whoami` - get the current user name
ps -H -o "%p %P" -u `whoami` > $TEMPFILE
PIDLIST=(`awk '/[0-9]/ {print $1}' $TEMPFILE`) # make an array using the first column
PPIDLIST=(`awk '/[0-9]/ {print $2}' $TEMPFILE`) # and the second
SIZE=${#PIDLIST[*]}
K=0
# bypassing the forest using stack which emulates LINKS array. K is the pointer to stack's top
for (( i=0; i<$SIZE; i++ ))
do
if [[ $K = 0 || ${PPIDLIST[$i]} = ${LINKS[$K-1]} ]] # new tree or new edge in the tree.
then
LINKS[$K]=${PIDLIST[$i]} # push PID to stack
K=`expr $K + 1`
else # the chain is complete.
if [[ $K > 2 ]] # enough size to print the chain
then # reversed formatted output the chain
echo ${LINKS[*]} | awk '{ printf $NF; for (i = NF-1; i > 0; --i) printf ":"$i}'
echo
fi
until [[ $K == 0 || ${PPIDLIST[$i]} == ${LINKS[$K-1]} ]]
do # deleting elements from stack until find a
# parent or tree is end
unset LINKS[$K-1]
K=`expr $K - 1`
done
LINKS[$K]=${PIDLIST[$i]} # push PID to stack
K=`expr $K + 1`
fi
done
rm -rf $TEMPFILE # removing temp file
−116
-(BOOL) checkIsDeleted:(Transactions*)target
{
if (target.transactionType == TransactionTypeTransfer)
{
if (target.cashFlow && target.cashFlow.isDeleted && target.secondCashFlow && target.secondCashFlow.isDeleted)
return YES;
return NO;
}
else
if (target.cashFlow && target.cashFlow.isDeleted)
return YES;
return NO;
}
Классика )))
+161
$query = 'SELECT `views` FROM `'.PREFIX.'_newsi` WHERE `id` = '.$item["id"];
$result = $kernel->runSQL($query);
$count;
if (mysql_num_rows($result)) {
$count = mysql_result($result,"views");
$query = 'UPDATE `'.PREFIX.'_newsi` SET `views` = "'.++$count.'" WHERE `id` ='.$item["id"];
$kernel->runSQL($query);
}
Увеличиваем счетчик количества просмотров новости