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

    В номинации:
    За время:
  2. Куча / Говнокод #13295

    +118

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    <table width="630" border="1" class="main">
    
    <!-- Распирай. Властвуй. Унижай. -->
    <table border="1" width="800" class="main">
                
    <tr align="center"><td class="tds"> 
    ....
    </td></tr>
    </table></table>

    Цель была- просто впихнуть широкую таблицу, когда "голова", и кусок основной таблицы сайта (то, что до "распирай") отдаются скриптом. Дабы не вносить существенных поправок в движковую часть, и страницы- пришлось наговнокодить.

    lionovsky, 03 Июля 2013

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

    +130

    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
    * g o a t s e x * g o a t s e x * g o a t s e x *
    g                                               g  
    o /     \             \            /    \       o
    a|       |             \          |      |      a
    t|       `.             |         |       :     t
    s`        |             |        \|       |     s
    e \       | /       /  \\\   --__ \\       :    e
    x  \      \/   _--~~          ~--__| \     |    x  
    *   \      \_-~                    ~-_\    |    *
    g    \_     \        _.--------.______\|   |    g
    o      \     \______// _ ___ _ (_(__>  \   |    o
    a       \   .  C ___)  ______ (_(____>  |  /    a
    t       /\ |   C ____)/      \ (_____>  |_/     t
    s      / /\|   C_____)       |  (___>   /  \    s
    e     |   (   _C_____)\______/  // _/ /     \   e
    x     |    \  |__   \\_________// (__/       |  x
    *    | \    \____)   `----   --'             |  *
    g    |  \_          ___\       /_          _/ | g
    o   |              /    |     |  \            | o
    a   |             |    /       \  \           | a
    t   |          / /    |         |  \           |t
    s   |         / /      \__/\___/    |          |s
    e  |           /        |    |       |         |e
    x  |          |         |    |       |         |x
    * g o a t s e x * g o a t s e x * g o a t s e x *

    Stertor, 29 Июня 2013

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

    +29

    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
    //thirteen
            Cluster cl;
            Cluster empty;
            I--;
            if(distances.size()){
                for (int i = 0; i < (Lmax < distances.size() ? Lmax : distances.size()); ++i){
                    cl.X(( clusters.at(distances.at(i).first.first).X()*clusters.at(distances.at(i).first.first).Points().size() + clusters.at(distances.at(i).first.second).X()*clusters.at(distances.at(i).first.second).Points().size())/(clusters.at(distances.at(i).first.first).Points().size() + clusters.at(distances.at(i).first.second).Points().size()));
                    cl.Y(( clusters.at(distances.at(i).first.first).Y()*clusters.at(distances.at(i).first.first).Points().size() + clusters.at(distances.at(i).first.second).Y()*clusters.at(distances.at(i).first.second).Points().size())/(clusters.at(distances.at(i).first.first).Points().size() + clusters.at(distances.at(i).first.second).Points().size()));
                    if(clusters.at(distances.at(i).first.second).Number() != -1 && clusters.at(distances.at(i).first.first).Number() != -2){
                        cl.Points() = clusters.at(distances.at(i).first.second).Points();
                        clusters.at(distances.at(i).first.second) = cl;
                        clusters.at(distances.at(i).first.second).Number(-1);
                        for (std::vector<Point>::iterator j = clusters.at(distances.at(i).first.first).Points().begin(); j != clusters.at(distances.at(i).first.first).Points().end(); ++j)
                        {
                        	clusters.at(distances.at(i).first.second).Points().push_back(*j);
                        }
                        clusters.at(distances.at(i).first.first) = empty;
                        n_c--;
                    }
                }
                for (std::vector<Cluster>::iterator i = clusters.begin(); i != clusters.end(); ++i){
                    if(i->Number() == -2){
                        i = clusters.erase(i);
                    }
                    i->Number(i - clusters.begin());
                    if(I)i->Points().clear();
                    if(i == clusters.end())break;
                }
            }
            //fourteen

    Кусок алгоритма isodata

    Abbath, 28 Июня 2013

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

    +150

    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
    //
        getMode: function(nMode) {
            switch (nMode) {
                case this.MODES.LEFT_BOOKEND:
                    return this.aModes[nMode];
                case this.MODES.RIGHT_BOOKEND:
                    return this.aModes[nMode];
                case this.MODES.BOTH_BOOKENDS:
                    return this.aModes[nMode];
                case this.MODES.NONE:
                default:
                    return this.aModes[this.MODES.NONE];
            }
        },

    Наверное уже боян, но вот же он, опять!

    https://github.com/scirelli/ExtjsBreadCrumbs/blob/master/js/ux/breadCrumbs.js

    Elvenfighter, 11 Июня 2013

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

    +63

    1. 1
    //START ADDING CODE HERE TODAY.  !!

    Прямо посреди класса

    myzone, 10 Июня 2013

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

    +133

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    try
    	HeapSize += 268435456 -- +100500 могучих байт в кучу во имя производительности
    catch (
    	try
    		HeapSize += 67108864 -- жалкая попытка добавить хоть что - то
    	catch
    		GIMS.Core.SystemMgr.ThrowError "init error" "Cannot extend the heap :(" -- сглотнуть обиду, поднасрав в лог
    )

    GC, you shall not pass!
    Первая ступень попыток ускорить тормозной MAXScript

    3Doomer, 04 Июня 2013

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

    +162

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    switch ($isBlank) {
        case true:
            $seconds_to_cache = 1;
            break;
        case false:
            $seconds_to_cache = 100000000;
            break;
    }

    еще default: не хватает для полной красоты...

    DemoniacDeath, 03 Июня 2013

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

    −105

    1. 1
    if(ignoreSelection?[atml extraCharges]!=NULL:[atml extraCharges]&&![atml selectedAttribute])

    Лесенки для слабаков!!

    Psionic, 31 Мая 2013

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

    +132

    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
    if (dest_lstat_ok)
        {
          if (S_ISDIR (dest_stats.st_mode))
            {
              error (0, 0, _("%s: cannot overwrite directory"), quote (dest));
              return false;
            }
          if (interactive)
            {
              fprintf (stderr, _("%s: replace %s? "), program_name, quote (dest));
              if (!yesno ())
                return true;
              remove_existing_files = true;
            }
    
          if (backup_type != no_backups)
            {
              dest_backup = find_backup_file_name (dest, backup_type);
              if (rename (dest, dest_backup) != 0)
                {
                  int rename_errno = errno;
                  free (dest_backup);
                  dest_backup = NULL;
                  if (rename_errno != ENOENT)
                    {
                      error (0, rename_errno, _("cannot backup %s"), quote (dest));
                      return false;
                    }
                }
            }
        }
    
      if (relative)
        source = rel_source = convert_abs_rel (source, dest);
    
      ok = ((symbolic_link ? symlink (source, dest)
             : linkat (AT_FDCWD, source, AT_FDCWD, dest,
                       logical ? AT_SYMLINK_FOLLOW : 0))
            == 0);

    Coreutils такой coreutils

    serpinski, 15 Мая 2013

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

    −167

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    МассивКоэффициентов = Новый Структура;
    -------------------------------------------------------------------------------------------------------
    Если Элемент.Имя = "КнопкаПерсонал" тогда
    	СписокВидоврасчета = 1;
    иначе
    	СписокВидоврасчета = 2;
    конецЕсли;

    "Принцип наименьшего удивления" при выборе имен переменных в работе

    doom2good, 13 Мая 2013

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