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

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

    +200.8

    1. 1
    $d=str_replace('-', '.', date("Y-m-d"));

    Дата через точку )))

    pasha, 12 Апреля 2010

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

    +144

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    List<Student> students = new List<Student>
            {
               new Student {LastName="Omelchenko", Scores= new List<int> {97, 72, 81, 60}},
               new Student {LastName="O'Donnell", Scores= new List<int> {75, 84, 91, 39}},
               new Student {LastName="Mortensen", Scores= new List<int> {88, 94, 65, 85}},
               new Student {LastName="Garcia", Scores= new List<int> {97, 89, 85, 82}},
               new Student {LastName="Beebe", Scores= new List<int> {35, 72, 91, 70}} 
            };

    Говногость, 08 Апреля 2010

    Комментарии (18)
  4. C# / Говнокод #2961

    +143.8

    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
    using System;
    
    class MyGenericClass<T> {
      T ob;
    
      public MyGenericClass(T o) {
        ob = o;
      }
    
      public T getob() {
        return ob;
      }
    
      public void showType() {
        Console.WriteLine("Type of T is " + typeof(T));
      }
    }
    
    public class Test {
      public static void Main() {
        MyGenericClass<int> iOb;
    
        iOb = new MyGenericClass<int>(102);
    
        iOb.showType();
    
        int v = iOb.getob();
        Console.WriteLine("value: " + v);
    
        MyGenericClass<string> strOb = new MyGenericClass<string>("Generics add power.");
        strOb.showType();
        
        string str = strOb.getob();
        Console.WriteLine("value: " + str);
      }
    }

    как не надо юзать шаблоны классов

    sergylens, 08 Апреля 2010

    Комментарии (18)
  5. PHP / Говнокод #2743

    +163.5

    1. 1
    2. 2
    3. 3
    $this->query_insert($this, array('', $mode, '', '',$id_group_new, $id_subgroup, $id_product,
    '', '', '', '', '', '', '', '', '',
    '', '', '', '', '', '', '', '', '', '', '', ''));

    Вышел на этот кусок гкода с ошибки о неверном количестве значений в sql insert, не удивился :)

    hardcoder, 10 Марта 2010

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

    +157.7

    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
    <?php 
    //fsockopen, fputs.. 
    
    $content = ""; 
    $header = "not yet"; 
    
    while( !feof( $pointer ) ) { 
        $line = fgets( $pointer, 128 ); 
        if( $line == "\r\n" && $header == "not yet" ) { 
            $header = "passed"; 
        } 
        if( $header == "passed" ) { 
            $content .= $line; 
        } 
    } 
    
    //fclose.. 
    
    echo( substr( $content, 2 ) ); 
    ?>

    По просьбе знакомого. Я в этом мало чего понимаю :)

    Cr@ZyBoY, 25 Февраля 2010

    Комментарии (18)
  7. JavaScript / Говнокод #2568

    +161.6

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    this.each(function(){
    	if (jQuery.browser.msie)
                alert( ' Change your browser please ' );
            else
                ...

    IE is being me to mean again...

    Nemerle, 08 Февраля 2010

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

    +129.4

    1. 1
    2. 2
    3. 3
    <a class="btn" href="#" onclick="{if $client->getId()}xmlrpc_choose_playlist(this,{$mp3->getId()},1,'top_month_mp3');return false;{else}xmlrpc_load_popup('login', null);{/if}">
    <img src="views/default/images/add.gif" width="8" height="8" alt="Добавить в плейлист" title="Добавить в плейлист" />
    </a>

    Это кусок смартявского шаблона
    Типа песенку в плейлист добавляем


    а иногда таких песен на странице ни одна сотня )))

    paranoid, 20 Января 2010

    Комментарии (18)
  9. Си / Говнокод #2421

    +144.9

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    char str[n]="Programmirivanie eto horoshiy predmet";
         for(i=0; i<n; i++)
         {
              printf("%c", str[i]);
         }
         printf("\n");

    Без комментариев ))

    Grockles, 15 Января 2010

    Комментарии (18)
  10. PHP / Говнокод #2397

    +162.5

    1. 1
    2. 2
    $require = 'email|name|phone';
    foreach (explode('|', $required) as $field)

    найдено при рефакторинге

    Stormherz, 12 Января 2010

    Комментарии (18)
  11. PHP / Говнокод #2378

    +164

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    for($i = 0; $i < 1000; $i++) {
            if(isset($_POST['discount_sum_'.$i]))
            {
                $a_discount_id_service[] = htmlspecialchars(@$_POST['id_service_'.$i]);
                $a_discount_sum[]        = htmlspecialchars(@$_POST['discount_sum_'.$i]);
                $a_discount_type[]       = htmlspecialchars(@$_POST['discount_type_'.$i]);
                $a_discount_time_type[]  = htmlspecialchars(@$_POST['discount_time_type_'.$i]);
            }
            else {
                break;
            }
    }

    По POST'у передаётся некоторое количество 'discount_sum_'.$i, 2 или 3, например 'discount_sum_1', 'discount_sum_2', 'discount_sum_3', в зависимости от точно известного количества записей в одной из таблиц, и передаваемое количество точно известно в момент передачи, но ведь лучше перебрать от 1 до 1000! :))

    hardcoder, 06 Января 2010

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