- 1
- 2
- 3
- 4
- 5
- 6
- 7
Private Function Leto(ByVal Dat1 As Date) As Boolean
Return IIf(Dat1.Month > 3 And Dat1.Month < 9, True, False)
End Function
Private Function Bas(ByVal Cost1 As Decimal, ByVal Kol1 As Integer)
Return Cost1 * Kol1
End Function
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−359
Private Function Leto(ByVal Dat1 As Date) As Boolean
Return IIf(Dat1.Month > 3 And Dat1.Month < 9, True, False)
End Function
Private Function Bas(ByVal Cost1 As Decimal, ByVal Kol1 As Integer)
Return Cost1 * Kol1
End Function
вообще это по линку cfdevа лежало в #3142
http://www.sql.ru/forum/actualthread.aspx?bid=9&tid=467673&hl=
но он не запостил самое гавно - то есть этот кусок
и его походу мало кто заметил
+171
function showResults()
{var i=0;if(document.getElementById('choice12').checked==true)
{i++;}
if(document.getElementById('choice23').checked==true)
{i++;}
if((document.getElementById('choice31').checked==true)&&(document.getElementById('choice32').checked==false)&&(document.getElementById('choice33').checked==true)&&(document.getElementById('choice34').checked==false))
{i++;}
if((document.getElementById('choice41').checked==false)&&(document.getElementById('choice42').checked==true)&&(document.getElementById('choice43').checked==true)&&(document.getElementById('choice44').checked==false))
{i++;}
if(document.getElementById('text5').value=='type')
{i++;}
if(document.getElementById('choice62').checked==true)
{i++;}
if(document.getElementById('text7').value=='alt')
{i++;}
if((document.getElementById('choice81').checked==false)&&(document.getElementById('choice82').checked==true)&&(document.getElementById('choice83').checked==false)&&(document.getElementById('choice84').checked==true))
{i++;}
if(document.getElementById('text9').value=='target')
{i++;}
if((document.getElementById('choice101').checked==true)&&(document.getElementById('choice102').checked==false)&&(document.getElementById('choice103').checked==false)&&(document.getElementById('choice104').checked==true))
{i++;}
if(document.getElementById('text11').value=='<input>')
{i++;}
if(document.getElementById('choice123').checked==true)
{i++;}
if((document.getElementById('choice131').checked==false)&&(document.getElementById('choice132').checked==true)&&(document.getElementById('choice133').checked==false)&&(document.getElementById('choice134').checked==true))
{i++;}
if(document.getElementById('text14').value=='action')
{i++;}
if((document.getElementById('choice151').checked==false)&&(document.getElementById('choice152').checked==true)&&(document.getElementById('choice153').checked==true)&&(document.getElementById('choice154').checked==true))
{i++;}
if((document.getElementById('choice161').checked==false)&&(document.getElementById('choice162').checked==false)&&(document.getElementById('choice163').checked==true)&&(document.getElementById('choice164').checked==true))
{i++;}
if(document.getElementById('choice174').checked==true)
{i++;}
if(document.getElementById('choice182').checked==true)
{i++;}
if(document.getElementById('text19').value=='background')
{i++;}
if(document.getElementById('choice201').checked==true)
{i++;}
document.getElementById('questions').style.display='none';document.getElementById('results').style.display='block';document.getElementById('results').innerHTML='<h2 style="color: #377">Результаты теста</h2>\n<p>Количество правильных ответов: <strong>'+i+'</strong>.</p>';if(i>=18)
{document.getElementById('results').innerHTML+='<p style="color: #096">Поздравляем с отличным результатом!</p>\n<p style="color: #f00">Оценка 5</p>';}
if((i<18)&&(i>=14))
{document.getElementById('results').innerHTML+='<p style="color: #096">Поздравляем с хорошим результатом!</p>\n<p style="color: #f00">Оценка 4</p>';}
if((i<14)&&(i>=6))
{document.getElementById('results').innerHTML+='<p style="color: #096">Результат удовлетворительный!</p>\n<p style="color: #f00">Оценка 3</p>';}
if(i<=6)
{document.getElementById('results').innerHTML+='<p style="color: #c00">К сожалению, результат очень плохой!!!</p>\n<p style="color: #f00">Оценка 2</p>';}
document.getElementById('results').innerHTML+='<p class="buttons"> <input type="button" value="Подсказать ответы" onclick= "showQuestions();getHelp();" /></p>';}
Тест на знание html. Мало того, что говнокод, так там и ответы ещё неправильные. Источник — http://www.cssblok.ru/test/test1.html
P.S. копирайт снизу на том сайте ("Школьная веб-студия , 2007") всё оправдывает.
+924
// придерживаюсь оригинала как могу
// код как был:
static char message_buf[64000]; // must be actually 64K == 64<<10 == 65536
class MessageHandler {
// [...]
char *header; // point into the message_buf
char *content;
std::list<char *> tlvs; // pointers to the elements of the message
};
// я пожаловался - пообещали исправить в новой версии по ходу реализации новой фичи.
// новый "усовершенствованый" код, с "поддержкой" многопоточности.
static char message_buf[100][65000]; // 100 == max threads, buffer size now is much closer to the standard
class MessageHandler {
// [...]
int threadId; // index into the new message_buf[]
char *header; // point into the message_buf[threadId]
char *content;
std::vector<char *> tlvs; // same, but in std::vector because it is "faster"
};
вот так кодируют и совершенствуют код матерые шведские программистки.
самое обидное что мой коллега почти все это пофиксил в оригинальной версии, но из-за важной фичи отказались мержить с новой версией и выкинули почти все его изменения.
−92
public class Chart//работа с ChartSpace
{
/* String sCategories="значение1"+СимволТабуляции(символ с кодом 9)+"значение2"+...
* String sValues="значение1"+СимволТабуляции(символ с кодом 9)+"значение2"+...
*/
//В VB6 также вместе со "строками через табулятор" поддерживаются одномерные массивы
//var
public const String sProcedure001 = "OneWindow.Procedure121";
public const String sProcedure002 = "OneWindow.Procedure122";
public const String sProcedure003 = "OneWindow.Procedure123";
public const String sProcedure004 = "OneWindow.Procedure124";
public const String sProcedure005 = "OneWindow.Procedure125";
public static Int32 iDataLiteral = Convert.ToInt32(OWC11.ChartSpecialDataSourcesEnum.chDataLiteral);
public static Object[,] _oZap001;
public static Object[,] _oZap002;
public static Object[,] _oZap003;
public static Object[,] _oZap004;
public static Object[,] _oZap005;
//end var
//property
public static Object[,] oZap001
{
//var
//end var
get
{
Int32 iNum = 0;
Exception oErr;
if (_oZap001 == null)
{
iNum = Ow.iZap0(sProcedure001, out _oZap001, out oErr);
if (iNum <= 0)
{
_oZap001 = null;
}
}
return _oZap001;
}
}
public static Object[,] oZap002
{
//var
//end var
get
{
Int32 iNum = 0;
Exception oErr;
if (_oZap002 == null)
{
iNum = Ow.iZap0(sProcedure002, out _oZap002, out oErr);
if (iNum <= 0)
{
_oZap002 = null;
}
}
return _oZap002;
}
}
public static Object[,] oZap003
{
//var
//end var
get
{
Int32 iNum = 0;
Exception oErr;
if (_oZap003 == null)
{
iNum = Ow.iZap0(sProcedure003, out _oZap003, out oErr);
if (iNum <= 0)
{
_oZap003 = null;
}
}
return _oZap003;
}
}
public static Object[,] oZap004
{
//var
//end var
get
{
Int32 iNum = 0;
Exception oErr;
if (_oZap004 == null)
{
iNum = Ow.iZap0(sProcedure004, out _oZap004, out oErr);
if (iNum <= 0)
{
_oZap004 = null;
}
}
return _oZap004;
}
}
public static Object[,] oZap005
{
...
Я нашел абсолютное гавно!!!!!!
Максим Прохоров торжественно спиздил исходники сайта okno.mos.ru и забыл в конторе (хуй он забыл, на самом деле я ему доступ закрыл в один прекрасный момент).
Теперь буду выкладывать маленькими порциями. представляете, за это гавно отвалили миллионов 10. Чиновники их дружно освоили. А отвалили из нашего кармана. Я лично налоги плачу.
+174.2
require_once(substr(__FILE__, 0, strlen(__FILE__) - strlen("/start.php"))."/bx_root.php");
Подключаем файл относительно текущей директории скрипта (start.php)
© 1С-Битрикс, версия 8.x
+173.4
function p_id($p_id)
{
global $product_id;
foreach($product_id as $k=>$v)if($p_id==$k)
{
$sel_r=$k;
$sel_t=$v;
}
return $sel_t;
}
Реальная функция и даже реально используется.
Сотрудник, далекий от кодинга, иногда чтобы не отвлекать меня разные мелочи кодит сам... Ну там по образцам типа...
Функцию эту кстати я трогать не стал исходя из золотого правила - "работает - не трогай!", так и используется и по сей день...
+143.6
<?php
try {
$mysqlhost = "localhost";
$mysqluser = "root";
$mysqlpass = "";
if ($db = mysql_connect ($mysqlhost,$mysqluser,$mysqlpass)){
echo "Successfully connected to the database.";
mysql_close ($db);
} else {
throw new exception ("Sorry, could not connect to mysql.");
}
} catch (exception $e) {
echo $e->getmessage ();
}
?>
как не надо подключаться к mysql
+159.2
<?php
function encrypt($str) {
$key = array();
$dst = array();
$i = 0;
$nBytes = strlen($str);
while ($i < $nBytes){
$i++;
$key[$i] = ord(substr($str, $i - 1, 1));
$dst[$i] = $key[$i];
}
$rslt = $key[1] + $key[2]*256 + $key[3]*65536 + $key[4]*16777216;
$one = $rslt * 213119 + 2529077;
$one = $one - intval($one/ 4294967296) * 4294967296;
$rslt = $key[5] + $key[6]*256 + $key[7]*65536 + $key[8]*16777216;
$two = $rslt * 213247 + 2529089;
$two = $two - intval($two/ 4294967296) * 4294967296;
$rslt = $key[9] + $key[10]*256 + $key[11]*65536 + $key[12]*16777216;
$three = $rslt * 213203 + 2529589;
$three = $three - intval($three/ 4294967296) * 4294967296;
$rslt = $key[13] + $key[14]*256 + $key[15]*65536 + $key[16]*16777216;
$four = $rslt * 213821 + 2529997;
$four = $four - intval($four/ 4294967296) * 4294967296;
$key[4] = intval($one/16777216);
$key[3] = intval(($one - $key[4] * 16777216) / 65535);
$key[2] = intval(($one - $key[4] * 16777216 - $key[3] * 65536) / 256);
$key[1] = intval(($one - $key[4] * 16777216 - $key[3] * 65536 - $key[2] * 256));
$key[8] = intval($two/16777216);
$key[7] = intval(($two - $key[8] * 16777216) / 65535);
$key[6] = intval(($two - $key[8] * 16777216 - $key[7] * 65536) / 256);
$key[5] = intval(($two - $key[8] * 16777216 - $key[7] * 65536 - $key[6] * 256));
$key[12] = intval($three/16777216);
$key[11] = intval(($three - $key[12] * 16777216) / 65535);
$key[10] = intval(($three - $key[12] * 16777216 - $key[11] * 65536) / 256);
$key[9] = intval(($three - $key[12] * 16777216 - $key[11] * 65536 - $key[10] * 256));
$key[16] = intval($four/16777216);
$key[15] = intval(($four - $key[16] * 16777216) / 65535);
$key[14] = intval(($four - $key[16] * 16777216 - $key[15] * 65536) / 256);
$key[13] = intval(($four - $key[16] * 16777216 - $key[15] * 65536 - $key[14] * 256));
$dst[1] = $dst[1] ^ $key[1];
$i=1;
while ($i<16){
$i++;
$dst[$i] = $dst[$i] ^ $dst[$i-1] ^ $key[$i];
}
$i=0;
while ($i<16){
$i++;
if ($dst[$i] == 0) {
$dst[$i] = 102;
}
}
$encrypt = "0x";
$i=0;
while ($i<16){
$i++;
if ($dst[$i] < 16) {
$encrypt = $encrypt . "0" . dechex($dst[$i]);
} else {
$encrypt = $encrypt . dechex($dst[$i]);
}
}
return $encrypt;}
вот он великий генератор паролей оО
никто не подберет пароль ))))
+164.8
utils.ajax.q("flip.php?o="+s+"&r="+Math.random()+Math.random()+Math.random(), function(r) {
if(r != "S") trc("Ошибка! -- "+r);
});
потребовался абсолютный рандом.
взято отсюда http://forlulz.net/labs/pix/ - там такого моего кода еще навалом
+169.4
if (!jQuery) $('<scr' + 'ipt src="/jquery.js" type="text/javascript"></scr' + 'ipt>');