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

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

    +144.9

    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
    node_t* read_record(FILE *file) {
        int success = 0;
        node_t *record = 0;
        do {
            int nsz, dsz;
            record = (node_t*)malloc(sizeof(node_t));
            if (!record) {
                break;
            }
            record->data = 0;
            record->next = 0;
    
            if (fread(&nsz, sizeof(int), 1, file) != 1 || feof(file)) {
                break;
            }
    
            if (fread(record->name, 1, nsz, file) != nsz || feof(file)) {
                break;
            }
    
            /* ... */
    
            record->nsz = nsz;
            record->dsz = dsz;
            success = 1;
        } while (0);
    
        if (record && !success) {
            free_list(record);
            record = 0;
        }
    
        return record;
    }
    
    
    void write_record(FILE *file, node_t *record) {
        int dsz = record->dsz;
        int nsz = record->nsz;
    
        if ((fwrite(&nsz, sizeof(int), 1, file) != 1) ||
            (fwrite(record->name, 1, nsz, file) != nsz) ||
            (fwrite(&csz, sizeof(int), 1, file) != 1) ||
            (fwrite(record->data, 1, dsz, file) != dsz) ||
            ferror(file)) {
            fputs("Error: write_record", stderr);
        }
    }

    govnopetya, 26 Января 2010

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

    +162.1

    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
    $cities_id=array(1,2,3,4,5,6);
     $cities_name=array("MSK","SPB","NN","KZ","NOV","UFA");
     
     GHTML::Run(array("html_autoinsert_on"=>0,"html_method"=>"_POST"));
    
     print GHTML::Link("/test.php",null,GHTML::Link("/test.php","style='font-weight:bold;font-size:20px;'")->Html("[Главная]"))->Html("[Главная]");
     print " ";
     print GHTML::Link("/test.php?act=reg",null,GHTML::Link("/test.php?act=reg","style='font-weight:bold;font-size:20px;'")->Html("[Регистрация]"))->Html("[Регистрация]");
      
      
     print GHTML::Form("POST","")
     ->HTML(
         GHTML::Input("name","text","Имя пользователя",null,true)->Html(),
         "<br>",
         GHTML::Input("pass1","password","Пароль")->Html(),
    	 "<br>",
         GHTML::Input("pass2","password","Пароль ещё раз")->Html(),
    	 "<br>",
         GHTML::Select("city")->Html(
               GHTML::Option("")->Html("Выберите город"),
               GHTML::Option($cities_id,$_POST['city'])->Html($cities_name)
         ),
    	 "<br>",
    	 GHTML::CheckBoxList("che_cities[]",$cities_id,null,$_POST['che_cities'])->Html($cities_name),
         "<br>",
    	 GHTML::RadioList("r_cities[]",$cities_id,null,$_POST['r_cities'])->Html($cities_name),
    	 "<br>",
         GHTML::Textarea("resume",50,9,null,true)->Html("Ненмого о себе"),
    	 "<br>",	 
    	 GHTML::Input("","submit","Жми!")->Html()
     );
    
    
    //////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////
    
    
    <a href='/test.php'  />[Главная]</a> <a href='/test.php?act=reg' style='font-weight:bold;font-size:20px;' />[Регистрация]</a><form method='POST' action='' /><input type='text' name='name' value='Имя пользователя'  /><br><input type='password' name='pass1' value='Пароль'  /><br><input type='password' name='pass2' value='Пароль ещё раз'  /><br><select name='city'  /><option value=''  />Выберите город</option><option value='6'  />MSK</option><option value='5'  />SPB</option><option value='4'  />NN</option><option value='3'  />KZ</option><option value='2'  />NOV</option><option value='1'  />UFA</option></select><br><input type='checkbox' name='che_cities[]' value='6'  />MSK<br /><input type='checkbox' name='che_cities[]' value='5'  />SPB<br /><input type='checkbox' name='che_cities[]' value='4'  />NN<br /><input type='checkbox' name='che_cities[]' value='3'  />KZ<br /><input type='checkbox' name='che_cities[]' value='2'  />NOV<br /><input type='checkbox' name='che_cities[]' value='1'  />UFA<br /><br><input type='radio' name='r_cities[]' value='6'  />MSK<br /><input type='radio' name='r_cities[]' value='5'  />SPB<br /><input type='radio' name='r_cities[]' value='4'  />NN<br /><input type='radio' name='r_cities[]' value='3'  />KZ<br /><input type='radio' name='r_cities[]' value='2'  />NOV<br /><input type='radio' name='r_cities[]' value='1'  />UFA<br /><br><textarea name='resume' cols='50' rows='9'  />Ненмого о себе</textarea><br><input type='submit' name='' value='Жми!'  /></form>

    хорошо что php гиппертекстовый ;)

    Mitusbka, 24 Января 2010

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

    +138.9

    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
    public static class Test3
            {
                public delegate object MyDelegate(object o);
                public delegate T MyDelegate<T>(T o);
    
                public static void Run()
                {
                    MyDelegate dlgA = (o) => { return o; };
                    
                    MyDelegate<object> dlgB = (i) => { return i; };
    
                    MyDelegate dlg = ChangeType<MyDelegate>(dlgB);
                }
                static T ChangeType<T>(Delegate dlg)
                {
                    return (T)(object)Delegate.CreateDelegate(typeof(T), dlg.Target, dlg.Method);
                }
            }

    Люблю вкусняшку))

    fekrado, 22 Января 2010

    Комментарии (16)
  5. Perl / Говнокод #2457

    −113.6

    1. 1
    2. 2
    3. 3
    4. 4
    sub append {
        my $appendstring = @_[0];
        $returnstring = "$returnstring$appendstring";
    }

    Из плагина к nagios'у, который проверяет состояние интерфейсов на cisco-девайсах. http://svn.opsview.org/opsview/trunk/opsview-core/nagios-plugins/check_snmp_cisco_ifstatus .

    aag, 20 Января 2010

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

    +162

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    <?
    $str = ""; 
    $amp="";
    foreach ($p as $i=>$v)
    {
             $str .= $amp."$i=$v";
             $amp = "&";
    }
    ?>

    xXx_totalwar, 15 Января 2010

    Комментарии (16)
  7. Pascal / Говнокод #2335

    +106.6

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if WordCount>GetWord(i) then else if WordCount>GetWord(i) then
      begin
        // ...
        // ...
      end;

    при каких условиях выполнится код между begin-end?..

    TAX, 26 Декабря 2009

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

    +171.6

    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
    if ( !empty( $page ) )
    {
        if ( $page == "login" )
        {
            $spage = "Login.inc";
        }
        else if ( $page == "rules" )
        {
            $spage = "rules.inc";
        }
        else if ( $page == "help" )
        {
            $spage = "help.inc";
        }
        else if ( $page == "wm" )
        {
            $spage = "wm.inc";
        }
        else if ( $page == "game" 
        {
            $spage = "game.inc";
        }
        else if ( $page == "webmoney" )
        {
            $spage = "webmoney.inc";
        }
        else if ( $page == "egold" )
        {
            $spage = "egold.inc";
        }
        else if ( $page == "cashin" )
        {
            $spage = "cashin.inc";
        }
        else if ( $page == "ballans" )
        {
            $spage = "ballans.inc";
        }
        else if ( $page == "remind" )
        {
            $spage = "remind.inc";
        }
        else if ( $page == "contact" )
        {
            $spage = "contact.inc";
        }
        else if ( $page == "reg" )
        {
            $spage = "reg.inc";
        }

    :(((

    azzz, 25 Декабря 2009

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

    +174.4

    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
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");
    document.body.innerHTML = document.body.innerHTML.replace("[b]", "<b>");
    document.body.innerHTML = document.body.innerHTML.replace("[/b]", "</b>");

    bb-коды на индусском сайте

    fuckyounoob, 24 Декабря 2009

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

    +163

    1. 1
    2. 2
    3. 3
    4. 4
    <dt id="idXXX-label"> </dt>
    <dd id="idXXX-element">
        <input id="idXXX" type="hidden" value="23" name="idXXX"/>
    </dd>

    ненавижу Zend_Form

    paranoid, 17 Декабря 2009

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

    +60.9

    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
    #if 0
      n = NPN_GetStringIdentifier("prompt");
    
      NPVariant vars[3];
      STRINGZ_TO_NPVARIANT("foo", vars[0]);
      STRINGZ_TO_NPVARIANT("bar", vars[1]);
      STRINGZ_TO_NPVARIANT("foof", vars[2]);
      NPN_Invoke(sWindowObj, n, vars, 3, &rval);
      if (NPVARIANT_IS_STRING(rval)) {
       printf ("prompt returned '%s'\n", NPVARIANT_TO_STRING(rval).utf8characters);
      }
    
       NPN_ReleaseVariantValue(&rval);
    #endif

    и это официальный пример написания плагина с сайта Mozilla
    пруф линк - http://mxr.mozilla.org/seamonkey/source/modules/plugin/samples/npruntime/plugin.cpp - строка 564

    Coach, 13 Ноября 2009

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