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

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

    +128

    1. 1
    #define STUPID_ACCELF_TEXT_SHIT

    laMer007, 26 Февраля 2014

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

    +128

    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
    mixin template GenerateAutoDispose()
    {
        void dispose()
        {
            foreach_reverse(i,t;this.tupleof)
            {
                static if(staticIndexOf!(auto_dispose,__traits(getAttributes, this.tupleof[i])) != -1)
                {
                    static if(isArray!(typeof(t)))
                    {
                        foreach(t1;t)
                        {
                            if(t1 !is null)
                            {
                                t1.dispose();
                            }
                        }
                    }
                    else
                    {
                        if(t !is null)
                        {
                            t.dispose();
                        }
                    }
                }
            }
        }
    }

    http://pastebin.com/2x2k7ngR

    LispGovno, 08 Февраля 2014

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

    +128

    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
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <dict>
        <key>author</key>
        <string>Nobody</string>
        <key>name</key>
        <string>my-theme</string>
        <key>settings</key>
        <array>
            <!-- ... -->
            <dict>
                <key>name</key>
                <string>Attribute</string>
                <key>scope</key>
                <string>entity.other.attribute-name</string>
                <key>settings</key>
                <dict>
                    <key>fontStyle</key>
                    <string></string>
                    <key>foreground</key>
                    <string>#006E28</string>
                </dict>
            </dict>
            <!-- ... -->
        </array>
    </dict>
    </plist>

    XML. Такой загадочный и энтерпрайзный.

    // Цветовая схема для Sublime Text (или TextMate)

    Elvenfighter, 17 Января 2014

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

    +128

    1. 1
    2. 2
    3. 3
    4. 4
    Sorry! The page could not be loaded.
    
    Unable to connect to MySQL and select database.
    MySQL reported: Access denied for user 'root'@'localhost' (using password: YES)

    http://gvforum.ru/

    эх, vasiliy, кто ж на продакшене базу от рута поднимает? надо же от юзверя с правами insert, delete, update, select

    Lure Of Chaos, 08 Января 2014

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

    +128

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    //...
    for (int i = 0; i < size; i++)
    {
        //...
        if (i == size + 2) break;
        //...
    }
    //...

    Увидел у соседа в коде. Осторожность никогда не помешает :)

    MoN, 21 Декабря 2013

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

    +128

    1. 1
    2. 2
    3. 3
    4. 4
    http://rghost.ru/51035531
    Новый бот для минусования (запускать на виртуалке)
    
    Описание такое, чтобы отпугнуть хомячье.

    Новый бот для минусования.

    Stertor, 17 Декабря 2013

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

    +128

    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
    object Point2D {
    
      type Point2D = Object {def apply(method: Method): method.type#signature}
    
      trait Method {
        type signature
      }
    
      object ToString extends Method {
        override type signature = () => String
      }
    
      object GetX extends Method {
        override type signature = () => Int
      }
    
      object SetX extends Method {
        override type signature = (Int) => Point2D
      }
    
      def Point2D(x: Int, y: Int): Point2D = {
    
        class Dispatch {
    
          def apply(method: Method): method.signature = (method match {
            case ToString => () => s"($x, $y)"
            case GetX => () => x
            case SetX => (x: Int) => Point2D(x, y)
          }).asInstanceOf[method.signature]
    
        }
    
        new Dispatch
      }
    
    }

    LispGovno, 10 Декабря 2013

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

    +128

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video {
        margin:0;
        padding:0;
        border:0;
        font-size:1em;
        font-family:'Helvetica','Arial',sans-serif;
        vertical-align:baseline
    }

    invision70, 05 Декабря 2013

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

    +128

    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
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    #include "unpacker.h"
    
    Unpacker::Unpacker(char *name) {
        _splitString = new char*[16];
        _ctx = SDL_RWFromFile(name, "rb");
    }
    
    Unpacker::~Unpacker() {
        delete _splitString;
        SDL_RWclose(_ctx);
        SDL_FreeRW(_ctx);
    }
    
    Dir *Unpacker::getDir(char *path) {;
        int index = 1;
        char pth[256];
        char name[80];
        char *str = "";
        if (!path)
            return NULL;
        _split(path);
        SDL_RWseek(_ctx, 2, SEEK_SET);
        pth[0] = '/'; pth[1] = '\0';
        while (_splitString[index]) {    
            Uint16 count;
            Uint32 hash;
            str = _splitString[index];
            hash = _hash(str);
            count = SDL_ReadLE16(_ctx);
            for (int i=0; i<count; i++) {
                Uint32 h;
                Uint32 offset;
                h = SDL_ReadLE32(_ctx);
                offset = SDL_ReadLE32(_ctx);
                if (hash == h) {
                    Uint8 size;
                    Uint32 curPos = SDL_RWtell(_ctx);
                    SDL_RWseek(_ctx, offset, SEEK_SET);
                    SDL_RWread(_ctx, &size, 1, 1);
                    SDL_RWread(_ctx, name, size, 1);
                    name[size] = '\0';
                    if (!strcmp(str, name)) {
                        if (_splitString[index+1]) {
                             strcat(pth, str);
                             strcat(pth, "/");
                        }
                        break;
                    } else {
                        if (i == count-1)
                            return NULL;
                        SDL_RWseek(_ctx, curPos, SEEK_SET);
                    }
                }
            }
            index++;
        }
        Dir *dir = new Dir;
        strcpy(dir->name,  str);
        strcpy(dir->path, pth);
        dir->dirsCount = SDL_ReadLE16(_ctx);
        dir->dirsOffset = SDL_RWtell(_ctx);
        SDL_RWseek(_ctx, dir->dirsCount*8, SEEK_CUR);
        dir->filesCount = SDL_ReadLE16(_ctx);;
        dir->filesOffset = SDL_RWtell(_ctx);
        return dir;
    }
    
    File *Unpacker::getFile(char *path) {
        char pth[256];
        char nm[80];
        int index = 2;
        _split(path);
        if (!_splitString[1])
            return NULL;
        if (_splitString[2]) {
            strcpy(pth, "/");
            strcpy(pth, _splitString[1]);
            strcat(pth, "/");
        } else {
            Dir *dir = getDir("/");
            return getFile(dir, _splitString[1]);
        }
        while (1) {
            if (_splitString[index+1]) {;
                strcat(pth, _splitString[index]);
                strcat(pth, "/");
            } else {
                strcpy(nm, _splitString[index]);
                break;
            }
            index++;
        }

    Нашел у себя на диске - старое творенье, когда я был мал и глуп... Распаковщик архива на своего формата на основе zlib.

    Pythoner, 09 Октября 2013

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

    +128

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    if (null != this.messageTemplateResourceName && null != this.messageTemplateResourceType)
    {
        return ResourceStringLoader.LoadString(this.messageTemplateResourceType.FullName,
            this.messageTemplateResourceName,
            this.messageTemplateResourceType.Assembly);
    }
    if (null != this.messageTemplateResourceName || null != this.messageTemplateResourceType)
    {
        throw new InvalidOperationException(Resources.ExceptionPartiallyDefinedResourceForMessageTemplate);
    }

    Microsoft EnterpriseLibrary
    else? нет, не слышал

    NeoN, 29 Августа 2013

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