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

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

    +56

    1. 1
    for (size_t i=v.size()-1; i<v.size(); --i)

    unsigned в массивах не нужен, нахуй усрались длинные массивы?

    TarasB, 22 Сентября 2014

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

    +64

    1. 1
    2. 2
    3. 3
    4. 4
    void GetVoid()
    {
    	return delete &"Возвращаем void";
    };

    Функция для получения void.

    maxillion, 21 Сентября 2014

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

    +135

    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
    private void button1_Click(object sender, EventArgs e)
            {
                if (comboBox1.Text == "Випадково")
                {
                   LoadMatrixRand(masP, dataGridView1);
                }
    
                if (comboBox1.Text == "Повна")
                {
                    LoadMatrixFull(masP, dataGridView1);
                }
    
                if (comboBox1.Text == "Пуста")
                {
                    LoadMatrixZero(masP, dataGridView1);
                }
    
                if (comboBox1.Text == "Діагональна")
                {
                    LoadMatrixDiagonal(masP, dataGridView1);
                }
    
                if (comboBox1.Text == "Антидіагональна")
                {
                    LoadMatrixAntiDiagonal(masP, dataGridView1);
                }
            }
    
            private void button2_Click(object sender, EventArgs e)
            {
                if (comboBox2.Text == "Випадково")
                {
                    LoadMatrixRand(masQ, dataGridView2);
                }
    
                if (comboBox2.Text == "Повна")
                {
                    LoadMatrixFull(masQ, dataGridView2);
                }
    
                if (comboBox2.Text == "Пуста")
                {
                    LoadMatrixZero(masQ, dataGridView2);
                }
    
                if (comboBox2.Text == "Діагональна")
                {
                    LoadMatrixDiagonal(masQ, dataGridView2);
                }
    
                if (comboBox2.Text == "Антидіагональна")
                {
                    LoadMatrixAntiDiagonal(masQ, dataGridView2);
                }
            }
    
            private void button3_Click(object sender, EventArgs e)
            {
                if (comboBox3.Text == "Випадково")
                {
                    LoadMatrixRand(masR, dataGridView3);
                }
    
                if (comboBox3.Text == "Повна")
                {
                    LoadMatrixFull(masR, dataGridView3);
                }
    
                if (comboBox3.Text == "Пуста")
                {
                    LoadMatrixZero(masR, dataGridView3);
                }
    
                if (comboBox3.Text == "Діагональна")
                {
                    LoadMatrixDiagonal(masR, dataGridView3);
                }
    
                if (comboBox3.Text == "Антидіагональна")
                {
                    LoadMatrixAntiDiagonal(masR, dataGridView3);
                }
            }

    shitty life as my code

    Nutell_a, 19 Сентября 2014

    Комментарии (24)
  5. Си / Говнокод #16692

    +131

    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
    /*
     * Copyright (C) 2007-2012 Allwinner Technology Co., Ltd.
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License as
     * published by the Free Software Foundation; either version 2 of
     * the License, or (at your option) any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with this program; if not, write to the Free Software
     * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
     * MA 02111-1307 USA
     */
    
    #ifndef __DISP_DISPLAY_I_H__
    #define __DISP_DISPLAY_I_H__
    
    #include "ebios_de.h"
    #include "ebios_lcdc_tve.h"
    #include "drv_disp_i.h" /* For DISP_XXXXXX status codes */
    
    #define DE_INF __inf
    #define DE_WRN __wrn
    
    #define OSAL_IRQ_RETURN IRQ_HANDLED
    
    #define HANDTOID(handle)  ((handle) - 100)
    #define IDTOHAND(ID)  ((ID) + 100)
    
    #define INTC_IRQNO_SCALER0  SW_INT_IRQNO_DEFEBE0
    #define INTC_IRQNO_SCALER1  SW_INT_IRQNO_DEFEBE1
    #define INTC_IRQNO_LCDC0    SW_INT_IRQNO_LCDCTRL0
    #define INTC_IRQNO_LCDC1    SW_INT_IRQNO_LCDCTRL1
    
    #define MAX_SPRITE_BLOCKS   32
    
    /*basic data information definition*/
    enum {
    	FALSE = 0,
    	TRUE
    };
    
    #define DIS_NULL 0
    
    #define BIT0    0x00000001
    #define BIT1	0x00000002
    #define BIT2	0x00000004
    #define BIT3	0x00000008
    #define BIT4	0x00000010
    #define BIT5	0x00000020
    #define BIT6	0x00000040
    #define BIT7	0x00000080
    #define BIT8	0x00000100
    #define BIT9	0x00000200
    #define BIT10	0x00000400
    #define BIT11	0x00000800
    #define BIT12	0x00001000
    #define BIT13	0x00002000
    #define BIT14	0x00004000
    #define BIT15	0x00008000
    #define BIT16	0x00010000
    #define BIT17	0x00020000
    #define BIT18	0x00040000
    #define BIT19	0x00080000
    #define BIT20	0x00100000
    #define BIT21	0x00200000
    #define BIT22	0x00400000
    #define BIT23	0x00800000
    #define BIT24	0x01000000
    #define BIT25	0x02000000
    #define BIT26	0x04000000
    #define BIT27	0x08000000
    #define BIT28	0x10000000
    #define BIT29	0x20000000
    #define BIT30	0x40000000
    #define BIT31	0x80000000
    
    
    #endif

    Нашёл в драйвере дисплея. Вместо 1<<N.

    mittorn, 13 Сентября 2014

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

    +126

    1. 1
    2. 2
    3. 3
    using питух = String;
    ...
    protected питух AccessToken { get; set; }

    В память о плавающем

    reshetochnik, 24 Августа 2014

    Комментарии (24)
  7. C# / Говнокод #16571

    +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
    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
    String r_count = "";
                String r_cat = "";
                String r_pansion = "";
                for (Int32 ii = 0; ii < rows.Count; ii++)
                {
                    Int32 j = rows[ii].NNight;
                    DateTime d = rows[ii].DateBeg;
                    DateTime d_e = rows[ii].DateEnd;
                    Int32 type = rows[ii].MinLength > 0 ? 3 : 2;
                    j = (type == 3) ? -1 : j;
    
                    Int32 lengthMin = rows[ii].MinLength;
                    if (((d < date1 || d > date2) && type != 3))
                        continue;
                    else
                        if (!(d <= date1 && d_e >= date1 || d <= date2 && d_e >= date2) && date1 != DateTime.MinValue && date2 != DateTime.MaxValue && type == 3)
                            continue;
                    String _r_count = _Rooms[rows[ii].RoomId];
                    String _r_cat = _RoomCat[rows[ii].RoomCatId];
                    String _r_pansion = _Pansions[rows[ii].PansionId];
                    List<String> a = new List<string>();
                    if (_r_count != r_count || _r_cat != r_cat || _r_pansion != r_pansion)
                    {
                        if (!String.IsNullOrEmpty(r_count) && !String.IsNullOrEmpty(r_cat))
                        {
                            Pricing.RoomCat cat = new Pricing.RoomCat();
                            cat.RoomCount = r_count;
                            cat.RoomName = r_cat;
                            cat.PansionName = r_pansion;
    
                            p.rooms.Add(cat);
                        }
                        r_count = _r_count;
                        r_cat = _r_cat;
                        r_pansion = _r_pansion;
                    }

    Краху туроператоров способствовали также и собственные инженеры.

    tablecell, 20 Августа 2014

    Комментарии (24)
  8. C# / Говнокод #16560

    +134

    1. 1
    2. 2
    3. 3
    class UnathorizedDevice : ArgumentException { public UnathorizedDevice() : base() { } }
    
    class LocalException : ArgumentException { public LocalException(string message) : base(message) { } }

    Говно или не говно? Мне кажется первое

    Smekalisty, 19 Августа 2014

    Комментарии (24)
  9. Java / Говнокод #16487

    +69

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    "add()\n";
    assert((row_indx >= 0 && row_indx <= rows) && 
    (col_indx >= 0 && col_indx < cols)
    );
    
    if(row_indx == rows)
    addRow();
    
    if(init_flag_arr[row_indx][col_indx])
    {
    std::cout « "in moving\n";
    int uninit_i, uninit_j;
    bool found = false;
    for(int i = row_indx; found == false && i < rows; i++)
    for(int j = col_indx; found == false && j < cols; j++)
    if(!init_flag_arr[i][j]) // если флаг == false
    {
    std::cout « "found!\n";
    uninit_i = i;
    uninit_j = j;
    found = true;
    
    }
    if(!found)
    {
    std::cout « "not found!\n";
    addRow(); // добовляем новую строку в матрицу (rows++)
    uninit_i = rows - 1;
    uninit_j = 0;
    }
    
    bool exit = false;
    for(int i = uninit_i, j = uninit_j; exit == false; i--)
    {
    for(; ;j--)
    {
    if(j == col_indx && i == row_indx)
    {
    exit = true;
    break;
    }
    if(j == 0)
    {
    matrix[i][j] = matrix[i - 1][cols - 1];
    init_flag_arr[i][j] = init_flag_arr[i - 1][cols - 1];
    break; 
    }
    matrix[i][j] = matrix[i][j - 1];
    init_flag_arr[i][j] = init_flag_arr[i][j - 1];
    
    }
    j = cols - 1;
    }
    } 
    matrix[row_indx][col_indx] = obj;
    init_flag_arr[row_indx][col_indx] = true;
    std::cout « "end add()\n";
    
    }
    
    // Для дебага, вывод инициализированных ячеек матрицы
    void Matrix::InitTable(std::ostream& os)const // чисто для дебага
    {
    for(int i = 0; i < rows; i++)
    {
    for(int j = 0; j < cols; j++)
    if(!init_flag_arr[i][j])
    os « "false\t";
    else
    os « "true\t";
    os « std::endl;
    }
    }
    // Удаление объекта с матрицы
    void Matrix::remove(int row_indx, int col_indx)
    {
    std::cout « "remove()\n";
    assert((row_indx >= 0 && row_indx < rows) && 
    (col_indx >= 0 && col_indx < cols)
    );
    matrix[row_indx][col_indx] = 0;
    init_flag_arr[row_indx][col_indx] = false;
    
    std::cout « "end remove()\n";
    }
    
    void Matrix::removeRow(int row_indx)
    {
    assert(row_indx >= 0 && row_indx < rows);
    int** new_matrix = new int*[rows - 1];
    bool** new_init_flag_arr = new bool*[rows];
    for(int i = 0; i < rows - 1; i++)
    {
    new_matrix[i] = new int[cols];
    new_init_flag_arr[i] = new bool[cols];
    //for(int j = 0; j < cols; j++)
    //{
    // new_matrix[i][j] = 0;
    // new_init_flag_arr[i][j] = false;
    //}/

    ...

    ana_stasia , 06 Августа 2014

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

    +157

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    # http://habrahabr.ru/post/227277/
    # открыл первый попавшийся скрипт на гитхабе по ссылке в посте, дальше не читал
    
    function validate_email($str)
    {
        return preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/',$str);
    }

    Sulik78, 25 Июня 2014

    Комментарии (24)
  11. SQL / Говнокод #16207

    −166

    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
    CREATE OR REPLACE FUNCTION "GET_SOTR_FULL_NAME" (sotr_id in number)
      RETURN  varchar2 IS
    cursor surname (sotr_id number)
     is
      select fc_fam from tsotr
      where tsotr.fk_id=sotr_id;
    cursor name (sotr_id number)
     is
      select fc_name from tsotr
      where tsotr.fk_id=sotr_id;
    cursor patronym (sotr_id number)
     is
      select fc_otch from tsotr
      where tsotr.fk_id=sotr_id;
     fio   varchar2(90);
     fam   varchar2(30);
     im    varchar2(30);
     otch  varchar2(30);
    BEGIN
      open surname (sotr_id);
       fetch surname into fam;
      close surname;
      open name (sotr_id);
       fetch name into im;
      close name;
      open patronym (sotr_id);
       fetch patronym into otch;
      close patronym;
       fio:=fam||' '||im||' '||otch;
      return fio;
    END;

    По ИД сотрудника получаем его ФИО

    Dimm_J, 23 Июня 2014

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