1. Лучший говнокод

    В номинации:
    За время:
  2. JavaScript / Говнокод #3960

    +159

    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
    function setmenu(fid,a)
    {
      try
      {
        ma=eval("menu"+a)
        ra=eval("razz"+a)
        if(fid=="raz"+a)
        {
          lft=ra.offsetLeft+gentab.offsetLeft+menubeg.offsetLeft+menu.offsetLeft;
    
          ua=navigator.userAgent.toLowerCase();
          isIE        = ((ua.indexOf("msie")!= -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1)); 
          isGecko     = (ua.indexOf("gecko")     != -1);
          isSafari    = (ua.indexOf("safari")    != -1);
          isKonqueror = (ua.indexOf("konqueror") != -1);
          isOpera     = (ua.indexOf("opera") != -1)
          if(isIE)
          {
            ma.style.top=66;
          }
          else
          {
            ma.style.top=59;
            if(isOpera) ma.style.top=51;       
          }
          if(a==6)ma.style.top=30;
          if(a==5)
          {
            if((!isIE)&&(!isOpera))lft=672;
          }
          ma.style.left=lft;
    
          if(lft+ma.offsetWidth>gentab.offsetLeft+gentab.offsetWidth)
          {
            ma.style.left=gentab.offsetLeft+gentab.offsetWidth-(ma.offsetWidth+2)
          }
          ma.style.visibility="visible";
          ma.style.zIndex=100;
          if(menu_old!=a)
          {
            eval('menu'+menu_old).style.visibility="hidden"
          }
          menu_old=a
        }
      }
      catch(err)
      {
      }
    }

    http://www.softgrad.com/softgrad.js
    (контора уебдевелоперов)
    вот так "microsoft certified partner-ы" решают вопрос кроссбарузерной верстки.

    Alfred, 12 Августа 2010

    Комментарии (3)
  3. Ruby / Говнокод #3955

    −96

    1. 1
    2. 2
    3. 3
    4. 4
    accounts=[]
    clients_accounts.each_key do |key|
       accounts.push key
    end

    vlad-druzh, 12 Августа 2010

    Комментарии (3)
  4. JavaScript / Говнокод #3949

    +167

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    function hasclass(e,c){
    has=false
    for(i=0;i<e.className.split(' ').length;i=i+1)
    if( e.className.split(' ')[i]=== c) has= true;
    if(has==true){return true;}else{return false;}
    }

    В лучших традициях говнокода. Оригинальное форматирование сохранено.

    eval, 11 Августа 2010

    Комментарии (3)
  5. Java / Говнокод #3946

    +80

    1. 1
    2. 2
    3. 3
    if ( obj == null ) {
      throw new IllegalArgumentException( "Value cannot be null: " + obj );
    }

    raorn, 11 Августа 2010

    Комментарии (3)
  6. Python / Говнокод #3945

    −168

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    if request.user.is_superuser:
            content["stuff"] = stuff_list
            content["content_stuff"] = content_stuff_list
            content["domain_url"] = settings.DOMAIN_URL or "http://boo.com"
            if request.user.is_superuser:
                content["active_hotels"] = Hotel.objects.filter(is_active=True)

    долго понимал, так и не понял

    iscarface, 11 Августа 2010

    Комментарии (3)
  7. Perl / Говнокод #3941

    −125

    1. 1
    2. 2
    3. 3
    4. 4
    $new_customer = 1 if ($new_customer);
        $new_customer = 0 unless ($new_customer);
    
    # запись из весьма не малого инет-магазина.... на perl'е....

    vat, 11 Августа 2010

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

    +171

    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
    56. 56
    57. 57
    58. 58
    59. 59
    include('conf.php');
    
    $domen=strip_tags($_POST['domain']);
    $descr=strip_tags($_POST['descr']);
    $admin=strip_tags($_POST['admin']);
    $tech=strip_tags($_POST['tech']);
    $nserver1=strip_tags($_POST['nserver1']);
    $nserver2=strip_tags($_POST['nserver2']);
    $mail=strip_tags($_POST['changed']);
    $submit=strip_tags($_POST['s']);
    
    if($_POST['s']){
    $simbol='|[^a-z0-9-]|i'; if(!preg_match($simbol, $domen)) {
    if($domen){ 
    if($descr){ 
    if($admin){
    if($tech){
    if($nserver1){
    if($nserver2){
    if($mail){if (preg_match("|[0-9a-z^_]+@[0-9a-z_^.]+.[a-z]{2,3}|i",$mail)){
    
    $headers = "Content-Type: text/plain; charset=windows-1251\n";
    $headers .= "From: ".$_POST['changed']."\n";
    $headers .= "X-Priority: 3\r\n";
    
    $tem="ADD $domen.org.ua";
    
    $msg ="domain: $domen.org.ua
    descr: $descr
    admin-c: $admin
    tech-c:  $tech
    nserver: $nserver1
    nserver: $nserver2
    changed: $mail ".date("Ymd")."
    source: UANIC";
    
    mail("[email protected]", "$tem", $msg, $headers);
    
    echo "Заявка отправлена со следующими данными:<br><br>";
    echo"Название домена: <strong><font color=\"#ff0000\">$domen.org.ua</font></strong><br>";
    echo"Описание домена: <strong><font color=\"#ff0000\">$descr</font></strong><br>";
    echo"Администратор домена: <strong><font color=\"#ff0000\">$admin</font></strong><br>";
    echo"Технический контакт домена: <strong><font color=\"#ff0000\">$tech</font></strong><br>";
    echo"DNS Сервер № 1: <strong><font color=\"#ff0000\">$nserver1</font></strong><br>";
    echo"DNS Сервер № 1:  <strong><font color=\"#ff0000\">$nserver2</font></strong><br>";
    echo"Ваш E-mail: <strong><font color=\"#ff0000\">$mail</font>   ".date("Ymd")."</strong><br><br>";
    echo"В течении 10 минут проверьте ваш почтовый ящчик <strong><font color=\"#00ff00\">$mail</font></strong> на наличие ссылки о подтверждении регистрации доменного имени";
    exit(); 
    
    }else{echo "<center>$error9<br>"; include('index.html');  die;}
    }else{echo "<center>$error8<br>"; include('index.html');  die;}
    }else{echo "<center>$error7<br>"; include('index.html');  die;}
    }else{echo "<center>$error6<br>"; include('index.html');  die;}
    }else{echo "<center>$error5<br>"; include('index.html');  die;}
    }else{echo "<center>$error4<br>"; include('index.html');  die;}
    }else{echo "<center>$error3<br>"; include('index.html');  die;}
    }else{echo "<center>$error2<br>"; include('index.html');  die;}
    }else{echo "<center>$error10<br>"; include('index.html');  die;}
    }else{echo "<center>$error1<br>"; include('index.html');  die;}

    ящчик :D

    GoodTalkBot, 10 Августа 2010

    Комментарии (3)
  9. JavaScript / Говнокод #3901

    +158

    1. 1
    2. 2
    $('div.contain p ~ a[href$="jpg"]').attr('id', 'linker');
    document.getElementById('linker').style.color = 'green';

    eval, 07 Августа 2010

    Комментарии (3)
  10. C# / Говнокод #3893

    +111

    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
    /// <summary>
            /// Получает IPAdress к которому нужно подключиться
            /// </summary>
            private int Get_IPAdress_Server()
            {
                string Buf = "";
                for (int i = 0; i < Server_IP.Servers_IP.Length; i++ )
                {
                    try
                    {
                        TcpClient tc = new TcpClient(Server_IP.Servers_IP[i], Server_IP.Servers_Port[i]);
                        byte[] buffer = new byte[19];
                        NetworkStream nss = tc.GetStream();
                        nss.Read(buffer, 0, 19);
                        Buf = Encoding.ASCII.GetString(buffer).Trim();
                        Server_IPAdress = Buf.Substring(0, Buf.IndexOf(":"));
                        Server_Port = int.Parse(Buf.Substring(Buf.IndexOf(":") + 1, Buf.Length - Buf.IndexOf(":") - 1));
                        return 0;
                    }
                    catch (SocketException)
                    {
                    }
                }
                return -1;
            }

    Получаем индекс в коллекции где хранятся список серверов Первый доступный!

    Nigma143, 06 Августа 2010

    Комментарии (3)
  11. C++ / Говнокод #3889

    +157

    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
    struct Vertex
    {
    	float x, y, z;
    	float tu0, tv0;
    } vertices[20000] = 
    {
    	-X,  0,  Z, 0, 0,
    	 X,  0,  Z, 0, 0,
    	-X,  0, -Z, 0, 0, 
    	 X,  0, -Z, 0, 0,
    
    	 0,  Z,  X, 0, 0,
    	 0,  Z, -X, 0, 0,
    	 0, -Z,  X, 0, 0,
    	 0, -Z, -X, 0, 0,
    
    	 Z,  X,  0, 0, 0,
    	-Z,  X,  0, 0, 0,
    	 Z, -X,  0, 0, 0,
    	-Z, -X,  0, 0, 0,
    };

    Kirinyale, 06 Августа 2010

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