- 1
http://nm.merz-akademie.de/~alexander.schlegel/pixeledit/pixeleditor2.php
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+144
http://nm.merz-akademie.de/~alexander.schlegel/pixeledit/pixeleditor2.php
смотрите какой гений верстки пейсал ЭТО.
+151
$(".selection a").click(function(event){
if(this==event.target) {
$(this).toggleClass("m1active")
sel1="0"; sel2="0"; sel3="0"; sel4="0"; sel5="0"; onb="0"; sel6="0"; sel7="0"; sel8="0"; sel9="0"; sel10="0"; sel11="0"; sel12="0";
if($("#sel1").hasClass("m1active")) { sel1="1"; }
if($("#sel2").hasClass("m1active")) { sel2="1"; }
if($("#sel3").hasClass("m1active")) { sel3="1"; }
if($("#sel4").hasClass("m1active")) { sel4="1"; }
if($("#sel5").hasClass("m1active")) { sel5="1"; }
if($("#sel6").hasClass("m1active")) { sel6="1"; }
if($("#sel7").hasClass("m1active")) { sel7="1"; }
if($("#sel8").hasClass("m1active")) { sel8="1"; }
if($("#sel9").hasClass("m1active")) { sel9="1"; }
if($("#sel10").hasClass("m1active")) { sel10="1"; }
if($("#sel11").hasClass("m1active")) { sel11="1"; }
if($("#sel12").hasClass("m1active")) { sel12="1"; }
if($("#onb").hasClass("m1active")) { onb="1"; }
// var txff="eddm.php?sel1=".sel1;
$("#content-ajax").load("eddm.php",{ sel1: sel1, sel2: sel2, sel3: sel3, sel4: sel4, sel5: sel5, sel6: sel6, sel7: sel7, sel8: sel8, sel9: sel9, sel10: sel10, sel11: sel11, sel12: sel12, onb: onb }, function() {
$(".editus tr:nth-child(even)").css('background-color','#ffeedd');
});
Ребята, прошу покритиковать сайт web-school.su и предложить правильные решения
+156
list($year, $month, $day) = split('[/.-]', $r['data']);
//$month = $man[(int)$month];
$date = "$day.$month.$year";
DATE_FORMAT
+158
<script type="text/javascript">
jQuery('.container').cycle({
fx: 'scrollHorz',
prev: '#prev2',
next: '#next2',
timeout: 0});
</script>
<img id="prev2" src="<?=$this->getSkinUrl('images/leftarr.png')?>" alt="Left Arrow" />
<?php foreach ($_gallery as $_image)
$__gallery[] = $_image;
?>
<ul class="container">
<?php
for($i = 0;$i < count($__gallery);$i++):
$_image = $__gallery[($i) % count($__gallery)];
?>
<li>
<a href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); ?>" onclick="slide('<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()) ?>',<?php echo ($s = isset($s) ? ++$s : 0) ?>,'<?php echo $this->getGalleryUrl($_image) ?>'); return false;"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(90); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>" /></a>
</li>
<?php endfor; ?>
</ul>
<ul class="container">
<?php
for($i = 0;$i < count($__gallery);$i++):
$_image = $__gallery[($i+1) % count($__gallery)];
?>
<li>
<a href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); ?>" onclick="slide('<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()) ?>',<?php echo ($s = isset($s) ? ++$s : 0) ?>,'<?php echo $this->getGalleryUrl($_image) ?>'); return false;"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(90); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>" /></a>
</li>
<?php endfor; ?>
</ul>
<ul class="container">
<?php
for($i = 0;$i < count($__gallery);$i++):
$_image = $__gallery[($i+2) % count($__gallery)];
?>
<li>
<a href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); ?>" onclick="slide('<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()) ?>',<?php echo ($s = isset($s) ? ++$s : 0) ?>,'<?php echo $this->getGalleryUrl($_image) ?>'); return false;"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(90); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>" /></a>
</li>
<?php endfor; ?>
</ul>
<ul class="container">
<?php
for($i = 0;$i < count($__gallery);$i++):
$_image = $__gallery[($i+3) % count($__gallery)];
?>
<li>
<a href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); ?>" onclick="slide('<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()) ?>',<?php echo ($s = isset($s) ? ++$s : 0) ?>,'<?php echo $this->getGalleryUrl($_image) ?>'); return false;"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(90); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>" /></a>
</li>
<?php endfor; ?>
</ul>
слайдер с прокруткой с помощью цайкла
+166
template <typename RetT> RetT Max() { return (RetT)0; }
template <typename RetT, typename ArgT, typename ... Args> RetT Max(ArgT Arg1, Args ... args)
{ RetT Temp = Max<RetT>(args ...); return ((RetT)Arg1 > Temp) ? ((RetT)Arg1) : (Temp); }
int main(int argc, char* argv[])
{
printf("%d\n", Max<int>(100, 200.356, false, -300));
return 0;
}
оцените полет человеческой мысли и чудеса нового стандарта С++0x... семпл мой, правда довольно редко используется...
+167
int pm = pm == -2 ? -1 : pm_ == -1 ? mi : pm_;
Фрагмент из функции поиска, определение какого-то индекса.
+73
if ((float)TF1.getText()>(float)(TF2.getText()){
}
Вот так вот приводят типы:)
http://www.sql.ru/forum/actualthread.aspx?bid=38&tid=551373&hl=
+163
int F(x)
{
if (.chto-to) v.push_back(.koe-chto.);
int ind = somefunc(x);
for each y in x.childs
v[ind].res += F(y);
}
Не говнокод, но пример того, как из std::vector можно выстрелить себе в ногу
Комментарий автора кода ( http://codeforces.ru/blog/entry/1719#comment-32824 ):
такая штука получала крэш на компиляторе жюри, из-за того что сначала вычислялся адрес v[ind].res затем вызывалась снова F, которая пушбекает в вектор v, и может тем самым заставить вектор перевыделить память, тем самым адрес вычисленный ранее становился инвалидным.
я этот баг долго не мог найти, потомучто студия генерила нормальный код, не вызывающий креша
+102
var zaxita, ataka, zaxitacomp, atakacomp, yron, yroncomp: integer;
begin
Label3.Caption := IntToStr(healt);
Label4.Caption := IntToStr(healtcomp);
If Radiobutton1.Checked = True then
begin
zaxita := 1;
yron := 3;
end;
If Radiobutton2.Checked = True then
begin
zaxita := 2;
yron := 2;
end;
If Radiobutton3.Checked = True then
begin
zaxita := 3;
yron := 1;
end;
If Radiobutton4.Checked = True then ataka := 3;
If Radiobutton5.Checked = True then ataka := 2;
If Radiobutton6.Checked = True then ataka := 1;
zaxitacomp := Random(4);
atakacomp := Random(4);
If zaxita <> atakacomp then
begin
healt := healt - yron;
Label3.Caption := IntToStr(healt);
If healt <= 0 then
begin
MessageBeep(48);
ShowMessage('Вы проиграли. Ваш труп скормят крысам!');
Close;
end;
If zaxitacomp <> ataka then
begin
healtcomp := healtcomp - ataka;
Label4.Caption := IntToStr(healtcomp);
If healtcomp <= 0 then
begin
MessageBeep(48);
ShowMessage('Вы выйграли! Поздравляю! Теперь можете разграбить своего врага! О, что это?!');
end;
end;
end;
end;
end.
Это оффлайн симулятор игры карнаж. Игра такая игра
+160
<table>
<form method="post" action="/ololo/onatole.html?step={{if $step eq '2'}}3{{else}}6{{/if}}">
<tr><td><a id="submit">...
....
фаерфокс отлично парсит такие формы внутри таблиц, jQuery(this).closest('form') тоже возвращает все превосходно