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

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

    +167

    1. 1
    <a title="Главная" href="http://<?php echo $_SERVER['HTTP_HOST'].str_replace('\\', '', dirname($_SERVER['PHP_SELF'])); ?>">Главная</a>

    нашел в одном проекте, я бы и не смог до такого додуматься

    alextg, 04 Июня 2011

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

    +158

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    {|if $message=="ok"|}
        <div style="text-align: center; padding:10px; margin:10px; color: white; font-weight: bold; background-color: green;">Your message has successfully been added.</div>
    {|/if|}
    {|if $message=="error"|}
        <div style="text-align: center; padding:10px; margin:10px; color: white; font-weight: bold; background-color: red;">Mistake. You filled out the wrong form.</div>
    {|/if|}

    Красивое использование CSS.

    max_wp, 03 Июня 2011

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

    +147

    1. 1
    2. 2
    GOVNOREGER© для govnokod.ru
    http://slil.ru/31180342

    15d980da30374a8f, 02 Июня 2011

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

    +165

    1. 1
    2. 2
    return $result_rows;
    mysql_close($external_db);

    Ring, 30 Мая 2011

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

    +134

    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
    -module(common_io).
    -export([read_utf8/2, default_fallback/1]).
    
    default_fallback(<<Data>>)->
        erlang:display(Data).
    
    read_utf8(Collected, <<Utf8Char/utf8>>, _CallAfter)->
        lists:append(Collected, [Utf8Char]);
    read_utf8(Collected, <<Utf8Char/utf8, Data/binary>>, CallAfter)->
        lists:append([Collected, [Utf8Char], read_utf8(Data, CallAfter)]);
    read_utf8(Collected, <<Data/binary>>, CallAfter)->
        CallAfter(Data),
        Collected;
    read_utf8(Collected, <<>>, _CallAfter)->
        Collected.
    
    read_utf8(<<>>, _CallAfter)->
        [];
    read_utf8(<<Utf8Char/utf8>>, _CallAfter)->
        [Utf8Char];
    read_utf8(<<Data/binary>>, CallAfter)->
        read_utf8([], Data, CallAfter).

    Первый раз в жизни пишу что-то на Эрланге. Чует сердце, что что-то тут не так...

    wvxvw, 24 Мая 2011

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

    +83

    1. 1
    2. 2
    Float.parseFloat(obj.getPrice() + ""));
    // int obj.getPrice()

    int to float

    dshulgin, 17 Мая 2011

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

    +82

    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
    //request reading
            String allData = "";
            try {
                int data = input.read();
                while (true) {
                    allData += (char) data;
                    if (input.available() < 1) {
                        break;
                    }
                    data = input.read();
                }
            } catch (IOException ex) {
                Logger.getLogger(HttpProtocolProcessor.class.getName()).log(Level.SEVERE,
                        "Problems occured while reading the stream.", ex);
            }

    Прямо свежего наклада. Вот таким вот нетривиальным способом член команды читает из InputStream'a всё в одну строку. Он не только читает по байтно, но еще и для каждого байта создаёт новую строку. О мой боже. Т_Т.

    sogekoder, 15 Мая 2011

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

    +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
    13. 13
    14. 14
    //----------------------------------------------------------------------------
    void TChimesMinigame::InventoryEndDrag(str aId)
    { 
      TSceneObject * drag_object = getScene(1)->FindObject(aId);
    
      if (!drag_object) 
      {
        iInventory->CheckEndDrag(NULL);
        return; 
      }
        
      iInventory->CheckEndDrag(NULL);
    }
    //----------------------------------------------------------------------------

    w100, 15 Мая 2011

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

    +116

    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
    IList<Hashtable> records = crit.List<Hashtable>();
    Guid[] personsId = records.Select(item => (Guid)item["PersonID"]).Distinct().ToArray();
    List<EmployeeData> empDatas = new List<EmployeeData>();
    
    foreach(Guid personId in personsId) {
    	IEnumerable<Hashtable> employeeRecords = records.Where(item => (Guid)item["PersonID"] == personId);
    	Hashtable employeeRecord = employeeRecords.FirstOrDefault(item => !(bool)item["IsLoad"] || (DateTime)item["EventDate"] == employeeRecords.Max(unit => (DateTime)unit["EventDate"]));
    
    	Hashtable employeeRecordAddition = new GenericNHibernateDao<BaseDocument>().CreateCriteria()
    		.CreateAlias("Department", "department")
    		.CreateAlias("Employee", "employee")
    		.CreateAlias("WorkDescription.Schedule", "schedule", JoinType.LeftOuterJoin)
    		.CreateAlias("WorkDescription.EmployeeApperance", "employeeApperance", JoinType.LeftOuterJoin)
    		.Add(Restrictions.Eq("EmployeeStamp.TabNo", employeeRecord["TabNo"]))
    		.Add(Restrictions.Eq("IsHalf", false))
    	...
    }

    No comments %)

    Guid, 12 Мая 2011

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

    +167

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    /* DO NOT UNCOMMENT THIS CODE AGAIN.  THIS IS THE 3rd TIME I'VE HAD TO REMOVE THIS.
        if($("form#purchase_form").length) {
            var currentPaymentValue = $("input[name='paymentFormOverride']:checked", "#purchase_form").val();
            if (currentPaymentValue == 'cc')
                $("#pp_payment_method").click(function(){paymentRedirect('pp')});
            else
                $("#cc_payment_method").click(function(){paymentRedirect('cc')});
        }
    	*/

    Чоткая обратная связь :))

    kovel, 11 Мая 2011

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