- 1
- 2
- 3
- 4
- 5
/********************************/
Некоторые переводят «Save as» как фразу «Сохранить как»…
Но самые мудрые знают, что на самом деле это «Спасти жопу»
/********************************/
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+144
/********************************/
Некоторые переводят «Save as» как фразу «Сохранить как»…
Но самые мудрые знают, что на самом деле это «Спасти жопу»
/********************************/
...
+144
Draggable.prototype.move = function(event){
var event = Runic.event.getEvent(event),
mLeft = (this.direction == 'both' || this.direction == 'horizontal') ? (Runic.event.getEventX(event) - this.mdiffX) : this.element.offsetLeft,
mTop = (this.direction == 'both' || this.direction == 'vertical') ? (Runic.event.getEventY(event) - this.mdiffY) : this.element.offsetTop,
//get cursor position
curx = Runic.event.getEventX(event),
cury = Runic.event.getEventY(event);
if (this.box) {
if (this.direction == 'horizontal' || this.direction == 'both') {
if (curx > this.fromX && curx < this.toX) {
this.element.style.left = mLeft + 'px';
} else if (curx <= this.fromX && this.direction) {
if (this.boxCSSPosition == 'relative' || this.boxCSSPosition=='absolute') {
this.element.style.left = 0 + 'px'
this.element.style.right = 'auto'
} else {
this.element.style.left = this.box.offsetLeft + 'px'
}
} else if (curx >= this.toX) {
if (this.boxCSSPosition == 'relative' || this.boxCSSPosition=='absolute') {
this.element.style.right = 0 + 'px'
this.element.style.left = 'auto'
} else {
this.element.style.left = this.box.offsetLeft + this.box.clientWidth - this.element.clientWidth + 'px'
}
}
}
if (this.direction == 'vertical' || this.direction == 'both') {
if (cury > this.fromY && cury < this.toY) {
this.element.style.top = mTop + 'px';
} else if (cury <= this.fromY) {
if (this.boxCSSPosition == 'relative' || this.boxCSSPosition=='absolute') {
this.element.style.top = 0 + 'px';
this.element.style.bottom = 'auto'
} else {
this.element.style.top = this.box.offsetTop + 'px'
}
} else if (cury >= this.toY) {
if (this.boxCSSPosition == 'relative' || this.boxCSSPosition=='absolute') {
this.element.style.bottom = 0 + 'px';
this.element.style.top = 'auto'
} else {
this.element.style.top = this.box.offsetTop + this.box.clientHeight - this.element.clientHeight + 'px'
}
}
}
} else {
this.element.style.left = mLeft + 'px';
this.element.style.top = mTop + 'px';
}
//run callback funciton
if (this.onDrag != undefined && typeof this.onDrag.func == 'function') {
if (this.onDragCount < this.onDrag.count || this.onDrag.count == 0) {
this.onDragCount++;
this.onDrag.func();
}
}
}
наговнокодил
−118
/^([a-zA-Z0-9]+)([-_.]?[a-zA-Z0-9]+)*@([a-zA-Z0-9]+[-_.]?)*[a-zA-Z0-9]+(?:\.[a-zA-Z]{2,6})$/
+162
function SentMessage($Text,$Title) {
$r=mysql_query("SELECT `id`,`login`,`email` FROM `".$this->TableUsers."` WHERE `access` = 1 and `check_email`=1");
while( $res = mysql_fetch_array($r) ){
mysql_query("
INSERT INTO `".$this->MessTable."` (
`From` , `To` , `Date` , `Title` , `Text`
) VALUES (
'".$this->MainUser['id']."', '".$res[id]."', NOW(), '".$Title."', '".$Text."'
)
");
$body=BuildBody("mail.message", $res);
$headers=' /*... заголовок ...*/ ';
mail ( $res[email], " /*... отправитель ..*/ ", $body, $headers);
}
}
вот такое чудо враждебной техники откопалось при колупании одной cms'ки...
(при том что выборка из $this->TableUsers с такими условиями получалась порядка ~500 т. строк )
+131
/***************************************/
Между прочим, сегодня у нас взят плановый гет 2000 пользователей!
С чем и поздравляем ГК.РУ!
/****************************************/
+150
function countdown() {
var today = new Date();
var start = new Date();
start.setTime(Math.ceil(Время ближайшей трансляции будет скоро объявлено * 1000));
var remains = new Date();
remains.setTime(start - today);
//window.status = remains;
var d = remains.getUTCDate() - 1;
var h = remains.getUTCHours();
var m = remains.getUTCMinutes();
d = textize(d, 'день', 'дня', 'дней');
h = textize(h, 'час', 'часа', 'часов');
m = textize(m, 'минуту', 'минуты', 'минут');
if (remains.getUTCHours() == 0 && remains.getUTCMinutes() < 5) {
document.getElementById('remains').innerHTML="Трансляция начнется с минуты на минуту";
} else if (remains.getTime() < 0) {
document.getElementById('remains').innerHTML="Трансляция идет";
//if (!document.getElementById('hll')) {
// location.reload(true);
//}
} else {
document.getElementById('remains').innerHTML="Ближайшая трансляция — через <b>"+d+" "+h+" "+m+"</b>";
}
t = setTimeout('countdown()',500);
}
взято с сайта http://kultu.ru/
−156
print reverse 1..10
+155
<?php
include "conf_db.php";
if(!empty($_REQUEST['doreg'])){
$error=array();
if(!$_REQUEST['name']) $error['name']="Имя";
if(!$_REQUEST['pass']) $error['pass']="Пароль";
if(!$_REQUEST['pass_to']) $error['pass_to']="Снова пароль";
if(!$_REQUEST['e_mail']) $error['e_mail']="E-mail";
if(!empty($error))
{
foreach ($error as $value)
{
echo "Не заполнено поле $value<br>";
}
include "form.php";
}
if(empty($error))
{
$error_to=array();
if(trim($_REQUEST['pass']) !== trim($_REQUEST['pass_to'])) $error_to['pass']="Пароли не совпадают!";
if(empty($error_to))
{
$query="select * from users where name='".$_REQUEST['name']."'";
$id=mysql_query($query)or die(mysql_error());
$arr=mysql_fetch_array($id);
if(!empty($arr)) $error_to['db']="пользователь с таким именем уже зарегистрирован!";
}
if(!empty($error_to))
{
foreach($error_to as $value)
{
echo $value;
}
include "form.php";
}
}
if(empty ($error_to) && empty($error))
{
//Здесь проверка прошла.
}
?>
Скрипт регистрации
+173
function jsPlay(soundobj) {
var thissound= eval("document."+soundobj);
try {
thissound.Play(); // играй!!!
}
catch (e) {
thissound.DoPlay(); // играй СЦУКО!!!!!!!!!!!
}
}
http://rabota2009.ucoz.ru/
вот так надо использовать try-catch если вы не знали.
+158
function rnd(){
var randscript = -1;
var num = banners.length;
while (randscript < 0 || randscript > parseInt(num/col)-1 || isNaN(randscript)){
randscript = parseInt(Math.random()*(num+1))
}
return randscript
}
http://earninguide.biz/top.js
генераторы бывают случайные и псевдослучайные.
но есть еще и псевдо_ХУ_евые!
вот один из них...