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

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

    −86

    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
    def search_with_city(obj1, obj2, obj3):
        print '------------Search by latitude, longitude and city------------'
        list1 = []
        list_new = []
        while True:
            line = file_airport.readline().lower()
            if obj3 in line:
                Str_file = ''.join(line)
                List_file2 = Str_file.split(',')
                if obj3 in List_file2[7]:
                    list1.append(List_file2)
                    for item in list1:
                        item.append(sqrt((float(item[11]) - float(obj1))**2 + (float(item[12]) - float(obj2))**2))
                        list_new = sorted(list1, key = lambda x: x[-1], reverse = False)
                    config = yaml.load(open('findairport.conf'))
                    outs = config['output']
                for List_file in list_new:
                    if List_file2[3] != List_file[3]:
                        for out in outs:
                            out = out % dict(airportcode = str(List_file[0]).upper(), distance = List_file[-1],\
                                airportname = str(List_file[13]).title(),  sa = str(List_file[8]).title(), street = str(List_file[10]).title(),\
                                city = str(List_file[7]).title(), state = str(List_file[5]).upper(), zip = List_file[3],\
                                country = str(List_file[2]).upper(), lat = str(List_file[11]), lon = str(List_file[12]+'\n'))
                            print out
            if not line:
                break
        try:
            if not obj1 in line and not obj2 in line and not obj3 in line:
                print 'Nothing more is been found'
        except:
            pass
        else:
            pass
        file_airport.seek(0)

    PHP'шники наступают! :)

    stalk, 14 Декабря 2011

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

    +129

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    <div class="sliderItem">
        <a class="j-fullscreen-thumbnail" href="/events/night-life/2011/12/10/568385/pictures/18257298">
            <img src="about: blank"  lazysrc="http://files2.geometria.ru/pics/thumbnail/18257298.jpg" style="visibility: hidden;"  alt="Всемирный День Футбола!" width="110" height="110"/>
            <span class="j-fullscreenLink accessConfirmed" message="Чтобы посмотреть фото на весь экран, войдите на сайт" title="На весь экран"></span>
        </a>
    </div>

    С главной страницы социалки одной. Страница - ну просто памятник культу карго. Сто сорок загружаемых скриптов. С ними - двести запросов. Триста шестьдесят вот этих чудесных, использующих lazy loading, declarative data binding и хрен пойми чего ещё шаблонов.

    PHP-шник - он как эмбрион, по мере роста повторяет весь путь развития отрасли веб-разработки.

    actuator, 13 Декабря 2011

    Комментарии (6)
  4. Си / Говнокод #8803

    +139

    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
    /*
     * HttpReceiveRequestEntityBody
     */
    static ULONG __cdecl
    HttpReceiveRequestEntityBody_called(BOOL carry_on,
                                        DWORD ret_addr,
                                        HANDLE ReqQueueHandle,
                                        HTTP_REQUEST_ID RequestId,
                                        ULONG Flags,
                                        PVOID pBuffer,
                                        ULONG BufferLength,
                                        PULONG pBytesReceived,
                                        LPOVERLAPPED pOverlapped)
    {
        if (GetCurrentThreadId() != cur_thread_id && ReqQueueHandle == cur_req_queue)
        {
            carry_on = FALSE;
            return ERROR_IO_PENDING; /* evil evil */
        }
    
        return 0;
    }

    нет что бы что то путнее в комментарии написать :)

    63F45EF45RB65R6VR, 12 Декабря 2011

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

    +162

    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
    <?php
    if ($x9 == TRUE) 
    	{
    	$sum = $raw_sum * $K_smoke;
    	}
    else if ($x10 == TRUE) 
    	{ 
    	$sum = $raw_sum * $K_pole;
    	}
    else if ($x10 == TRUE && $x9 == TRUE) {
    	$sum = $raw_sum * $K_pole * $k_smoke;
    	}
    else {
    	$sum = $raw_sum;
    	}
    ?>

    Кусок и простейшего калькулятора :)

    Mr_Smile, 09 Декабря 2011

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

    +132

    1. 1
    RewriteRule ^groups/([^/]+)/(201[1-9]-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1]))$ /index.php?g=$1&amp;action=week&amp;d=$2 [L]

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

    LiteError, 08 Декабря 2011

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

    +169

    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
    /*
    Функция раскодирования символов кириллицы.
    Исходные данные должны содержаться в строке $ToDecode.
    Символы кириллицы раскодируются из: ^NN, где NN - номер символа (по очереди на клавиатуре, вначале заглавные буквы).
    01 - Й, 02 - Ц, ... 31 - Б, 32 - Ю, 33 - Ё, 34 - й, 35 - ц, ..., 64 - б, 65 - ю, 66 - ё
    Все символы, кроме раскодируемых данным образом остаются неизменными.
    Добавлены украинские символы.
    */
    function decoding (ToDecode)
      {
      var Result = ''
      var len = ToDecode.length
      var ch=''
      var i = 0
      while (i<len)
        {
        ch = ToDecode.charAt(i)
    
        if (ch == '^')
          {
           ch=ch+ToDecode.charAt(i+1)+ToDecode.charAt(i+2)
           if (ch=='^01') {ch = 'Й';} if (ch=='^02') {ch = 'Ц';} if (ch=='^03') {ch = 'У';}
           if (ch=='^04') {ch = 'К';} if (ch=='^05') {ch = 'Е';} if (ch=='^06') {ch = 'Н';}
           if (ch=='^07') {ch = 'Г';} if (ch=='^08') {ch = 'Ш';} if (ch=='^09') {ch = 'Щ';}
           if (ch=='^10') {ch = 'З';} if (ch=='^11') {ch = 'Х';} if (ch=='^12') {ch = 'Ъ';}
           if (ch=='^13') {ch = 'Ф';} if (ch=='^14') {ch = 'Ы';} if (ch=='^15') {ch = 'В';}
           if (ch=='^16') {ch = 'А';} if (ch=='^17') {ch = 'П';} if (ch=='^18') {ch = 'Р';}
           if (ch=='^19') {ch = 'О';} if (ch=='^20') {ch = 'Л';} if (ch=='^21') {ch = 'Д';}
           if (ch=='^22') {ch = 'Ж';} if (ch=='^23') {ch = 'Э';} if (ch=='^24') {ch = 'Я';}
           if (ch=='^25') {ch = 'Ч';} if (ch=='^26') {ch = 'С';} if (ch=='^27') {ch = 'М';}
           if (ch=='^28') {ch = 'И';} if (ch=='^29') {ch = 'Т';} if (ch=='^30') {ch = 'Ь';}
           if (ch=='^31') {ch = 'Б';} if (ch=='^32') {ch = 'Ю';} if (ch=='^33') {ch = 'Ё';}
           if (ch=='^34') {ch = 'й';} if (ch=='^35') {ch = 'ц';} if (ch=='^36') {ch = 'у';}
           if (ch=='^37') {ch = 'к';} if (ch=='^38') {ch = 'е';} if (ch=='^39') {ch = 'н';}
           if (ch=='^40') {ch = 'г';} if (ch=='^41') {ch = 'ш';} if (ch=='^42') {ch = 'щ';}
           if (ch=='^43') {ch = 'з';} if (ch=='^44') {ch = 'х';} if (ch=='^45') {ch = 'ъ';}
           if (ch=='^46') {ch = 'ф';} if (ch=='^47') {ch = 'ы';} if (ch=='^48') {ch = 'в';}
           if (ch=='^49') {ch = 'а';} if (ch=='^50') {ch = 'п';} if (ch=='^51') {ch = 'р';}
           if (ch=='^52') {ch = 'о';} if (ch=='^53') {ch = 'л';} if (ch=='^54') {ch = 'д';}
           if (ch=='^55') {ch = 'ж';} if (ch=='^56') {ch = 'э';} if (ch=='^57') {ch = 'я';}
           if (ch=='^58') {ch = 'ч';} if (ch=='^59') {ch = 'с';} if (ch=='^60') {ch = 'м';}
           if (ch=='^61') {ch = 'и';} if (ch=='^62') {ch = 'т';} if (ch=='^63') {ch = 'ь';}
           if (ch=='^64') {ch = 'б';} if (ch=='^65') {ch = 'ю';} if (ch=='^66') {ch = 'ё';}
           // украинские символы
           if (ch=='^67') {ch = 'Ї';} if (ch=='^68') {ch = 'І';} if (ch=='^69') {ch = 'Є';}
           if (ch=='^70') {ch = 'Ґ';} if (ch=='^71') {ch = 'ї';} if (ch=='^72') {ch = 'і';}
           if (ch=='^73') {ch = 'є';} if (ch=='^74') {ch = 'ґ';}
           i=i+2
          }
        i=i+1
        Result=Result+ch
        }
      return Result
      }

    А я минут 10 ковырялся думая в каком виде они кириллицу пересылают.

    mr.The, 30 Ноября 2011

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

    +164

    1. 1
    2. 2
    3. 3
    if (!isset ($_POST['filter']['state'])) $_POST['filter']['state'] = 0;
    .....
    $state = @$_POST['filter']['state'] ? $_POST['filter']['state'] : 0;

    не, ну а вдруг потеряется

    CRRaD, 30 Ноября 2011

    Комментарии (6)
  9. SQL / Говнокод #8624

    −108

    1. 1
    select 7-(8-datepart(weekday,getDate())) % 7

    Написал для конвертации дней недели начинающихся с SUNDAY=1, в привычные Пн-1, Вс-7

    3.14159265, 23 Ноября 2011

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

    +147

    1. 1
    <xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text>

    Такое ещё надо придумать

    Holden, 23 Ноября 2011

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

    +120

    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
    /// <summary>
    /// Calculates and returns a hashcode based on this user's
    /// MarketName and default units. The hashcode should be
    /// unique for each different combination of MarketName and 
    /// units.
    /// </summary>
    /// <returns>An int that may be positive or negative.</returns>
    public override int GetHashCode()
    {
    // A function like this raises innumerable questions.  Why did they over ride the 
    // hash code function?  Why did they use an attribute that is not certain to be unique?
    // why did they not use the one that is going to be unique?  Why did they not cvheck to 
    // see if the thing they were hasing was not null?  When did my life go so far off the rails
    // that I have to deal with code like this?  How many places call this code? Why did they not 
    // include any meaningful comments? Why does it suddenly start breaking after the 3.5 upgrade?
    // in an effort to avoid thinking about those questions, I've justy changed the has to use the 
    // unique user id instead of the retarded defaultuserunits hash.
    System.Text.StringBuilder sb = new System.Text.StringBuilder();
    sb.Append(this.MarketName);
    if (this.DefaultUserUnits != null)
    {
      sb.Append(Utility.StringUtility.GetJSObjectLiteral(this.DefaultUserUnits));
    }
    else
    {
      sb.Append(Utility.StringUtility.GetJSObjectLiteral(this.ID));
    }
      return sb.ToString().GetHashCode();
    }

    aprishchepov, 19 Ноября 2011

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