1. JavaScript / Говнокод #6401

    +156

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    try {
        document.domain = "wolframalpha.com";
        context = parent ? parent : document;
        } catch(e){}
        try { 
            if (typeof(context.$) == "undefined") {
                context = window;
            } else {
                $=context.$;
            }
        }
        catch(e){ context = window; }

    Если с первого раза не получилось...

    RaZeR, 19 Апреля 2011

    Комментарии (1)
  2. PHP / Говнокод #6400

    +165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    function sorti()
        {
        	if($_GET['where']=='desc'?$where='asc':$where='desc');
        	return 'where='.$where;
        }

    GoodTalkBot, 19 Апреля 2011

    Комментарии (28)
  3. PHP / Говнокод #6399

    +166

    1. 1
    2. 2
    3. 3
    public function getPreviousId(){
    	return $this->getId() - 1;
    }

    А вот так из модели можно возвратить айдишник предыдущей записи, и ничего страшного что запись с этим айдишником может не существовать в базе

    govno, 19 Апреля 2011

    Комментарии (4)
  4. Куча / Говнокод #6398

    +144

    1. 1
    http://nm.merz-akademie.de/~alexander.schlegel/pixeledit/pixeleditor2.php

    смотрите какой гений верстки пейсал ЭТО.

    TheHamstertamer, 19 Апреля 2011

    Комментарии (84)
  5. JavaScript / Говнокод #6397

    +151

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    $(".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 и предложить правильные решения

    Webschool, 19 Апреля 2011

    Комментарии (62)
  6. PHP / Говнокод #6396

    +156

    1. 1
    2. 2
    3. 3
    list($year, $month, $day) = split('[/.-]', $r['data']);
    //$month = $man[(int)$month];
    $date = "$day.$month.$year";

    DATE_FORMAT

    De-Luxis, 19 Апреля 2011

    Комментарии (13)
  7. PHP / Говнокод #6395

    +158

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    <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>

    слайдер с прокруткой с помощью цайкла

    jjonghyo, 19 Апреля 2011

    Комментарии (17)
  8. C++ / Говнокод #6394

    +166

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    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... семпл мой, правда довольно редко используется...

    ReL, 19 Апреля 2011

    Комментарии (80)
  9. C++ / Говнокод #6393

    +167

    1. 1
    int pm = pm == -2 ? -1 : pm_ == -1 ? mi : pm_;

    Фрагмент из функции поиска, определение какого-то индекса.

    Surendil, 19 Апреля 2011

    Комментарии (19)
  10. Java / Говнокод #6392

    +73

    1. 1
    2. 2
    if ((float)TF1.getText()>(float)(TF2.getText()){
    }

    Вот так вот приводят типы:)
    http://www.sql.ru/forum/actualthread.aspx?bid=38&tid=551373&hl=

    javaman, 18 Апреля 2011

    Комментарии (5)