1. C++ / Говнокод #23347

    +2

    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
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    string shifarhex(string count)
    {
    
      string take,take2;
    string getch1;
    
    
    	getch1=count;
    
        string sub1 = "0000";//2 to 3		 31
       unsigned int pos1 = getch1.find(sub1,0);
      if(pos1 != string::npos)
      {
       take2="0"; 
      }
         string sub2 = "0001";//2 to 3		 31
       unsigned int pos2 = getch1.find(sub2,0);
      if(pos2 != string::npos)
      {
       take2="1"; 
      }
       string sub3 = "0010";//2 to 3		 31
       unsigned int pos3 = getch1.find(sub3,0);
      if(pos3 != string::npos)
      {
       take2="2"; 
      }
       string sub4 = "0011";//2 to 3		 31
       unsigned int pos4 = getch1.find(sub4,0);
      if(pos4 != string::npos)
      {
       take2="3"; 
      }
       string sub5 = "0100";//2 to 3		 31
       unsigned int pos5 = getch1.find(sub5,0);
      if(pos5 != string::npos)
      {
       take2="4"; 
      }
         string sub6 = "0101";//2 to 3		 31
       unsigned int pos6 = getch1.find(sub6,0);
      if(pos6 != string::npos)
      {
       take2="5"; 
      }
          string sub7 = "0110";//2 to 3		 31
       unsigned int pos7 = getch1.find(sub7,0);
      if(pos7 != string::npos)
      {
       take2="6"; 
      }
          string sub8 = "0111";//2 to 3		 31
       unsigned int pos8 = getch1.find(sub8,0);
      if(pos8 != string::npos)
      {
       take2="7"; 
      }
        string sub9 = "1000";//2 to 3		 31
       unsigned int pos9 = getch1.find(sub9,0);
      if(pos9 != string::npos)
      {
       take2="8"; 
      }
       string sub10 = "1001";//2 to 3		 31
       unsigned int pos10 = getch1.find(sub10,0);
      if(pos10 != string::npos)
      {
       take2="9"; 
      }
    
       string sub11 = "1010";//2 to 3		 31
       unsigned int pos11 = getch1.find(sub11,0);
      if(pos11 != string::npos)
      {
       take2="A"; 
      }
        string sub12 = "1011";//2 to 3		 31
       unsigned int pos12 = getch1.find(sub12,0);
      if(pos12 != string::npos)
      {
       take2="B"; 
    
      }
       string sub13 = "1100";//2 to 3		 31
       unsigned int pos13 = getch1.find(sub13,0);
      if(pos13 != string::npos)
      {
       take2="B"; 
      }
       string sub14 = "1101";//2 to 3		 31
       unsigned int pos14 = getch1.find(sub14,0);
      if(pos14 != string::npos)
      {
       take2="D"; 
      }
        string sub15 = "1110";//2 to 3		 31
       unsigned int pos15 = getch1.find(sub15,0);
    ...

    http://www.sql.ru/forum/1269897/delaem-arhivator
    Вореционное зожатие битов

    j123123, 21 Сентября 2017

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    (* /*
    C > /) 2> /dev/null & echo hello world!; exit
    *       This file is correct input for:
    *       sh, cc, pc, f77
    */ main(program)) { puts("hello world!"); /*
    *) program main(output);begin writeln('hello world!')end. {
          write( *, '("hello world!")')
          end
    */ return &program; }

    Bash: https://ideone.com/HKy5RJ
    C: https://ideone.com/KFbJsK
    Pascal (fpc): https://ideone.com/4zcc51

    inkanus-gray, 12 Сентября 2017

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    (*a/*/ % #)(PostScript)/Helvetica 40 selectfont 9 400 moveto show%v"f"a0
    true showpage quit%#) 2>/dev/null;echo bash;exit #*/);int main()/*>"eb"v
    %a*0)unless print"perl\n"__END__*/{printf("C\n");/*>>#;"egnu">:#,_@;,,,<
    *)begin writeln(*\output={\setbox0=\box255}\eject\shipout\hbox{\TeX}\end
    *)('pascal');end.{*/return 0;}

    C: https://ideone.com/Ntu3S0
    Pascal (fpc): https://ideone.com/A9qZ0x
    Bash: https://ideone.com/TYr7cu
    Perl: https://ideone.com/fAUhiv

    inkanus-gray, 12 Сентября 2017

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

    +1

    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
    (*O/*_/
    Cu  #%* )pop mark/CuG 4 def/# 2 def%%%%@@P[TX---P\P_SXPY!Ex(mx2ex("SX!Ex4P)Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*------------------------------------------------------------------*+Ex=
    CuG #%*   POLYGLOT - a program in eight languages      15 February 1991  *+Ex=
    CuG #%*   10th Anniversary Edition                      1 December 2001  *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*   Written by Kevin Bungard, Peter Lisle, and Chris Tham          *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*   Polyglot suports the following languages:                      *+Ex=
    CuG #%*     1. COBOL (ANSI)                                              *+Ex=
    CuG #%*     2. Pascal (ISO)                                              *+Ex=
    CuG #%*     3. Fortran (ANSI, f77)                                       *+Ex=
    CuG #%*     4. C (ANSI-ish)                                              *+Ex=
    CuG #%*     5. PostScript                                                *+Ex=
    CuG #%*     6. Linux/Unix shell script (bash, sh, csh)                   *+Ex=
    CuG #%*     7. x86 machine language (MS-DOS, Win32, Linux)               *+Ex=
    CuG #%*     8. Perl (version 5)                                          *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*   Usage:                                                         *+Ex=
    CuG #%*     1. Rename this file to polyglot.[cob|pas|f77|c|ps|sh|com|pl] *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*     2. Compile and run with your favorite compiler and operating *+Ex=
    CuG #%*        system.                                                   *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*   Notes:                                                         *+Ex=
    CuG #%*     1. We have attempted to use only standard language features. *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*     2. Without the -traditional flag gcc will issue a warning.   *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*     3. When transferring from Unix to DOS make sure that a LF    *+Ex=
    CuG #%*        is correctly translated into a CR/LF.                     *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*     4. Keep the black lines at the start of the program. They    *+Ex=
    CuG #%*        are important.                                            *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*     5. This text is a comment block in all eight languages.      *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*   Please mail any comments, corrections or additions to          *+Ex=
    CuG #%*   [email protected]                                       *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*------------------------------------------------------------------*QuZ=
    CuG #%*                                                                  *+Ex=
    CuG #%*!Mx)ExQX5ZZ5SSP5n*5X!)Ex+ExPQXH,B+ExP[-9A-9B(g?(gA'UTTER_XYZZXX!X *+
    CuG #(*                                                                  *(
    C   # */);                                                              /*(
    C   # *)  program        polyglot (output);                             (*+
    C   #     identification division.
    C   #     program-id.    polyglot.
    C   #
    C   #     data           division.
    C   #     procedure      division.
    C   #
    C   # * ))cleartomark   /Bookman-Demi findfont 36 scalefont setfont     (
    C   # *                                                                 (
    C   #
    C   # *                  hello polyglots$
    C   #     main.
    C   #         perform
    C  /# * ) 2>_$$; echo   "hello polyglots"; rm _$$; exit;
    C   # * (
    C   #
    C     *0 ) unless print "hello polyglots\n"; __END__
                  print
    C             stop run.
         -*,                'hello polyglots'
    C
    C         print.
    C             display   "hello polyglots".                              (
    C     */  int i;                                                        /*
    C     */  main () {                                                     /*
    C     */      i=printf ("hello polyglots\n"); O= &i; return *O;         /*
    C     *)                                                                (*
    C     *)  begin                                                         (*
    C     *)      writeln  ('hello polyglots');                             (*
    C     *)                                                                (* )
    C     * ) pop 60 360                                                    (
    C     * ) pop moveto    (hello polyglots) show                          (
    C     * ) pop showpage                                                  ((
    C     *)
               end                                                          .(* )
    C)pop%     program       polyglot.                                      *){*/}

    C: https://ideone.com/LzLeJH
    Pascal (gpc): https://ideone.com/J7VAQk
    Perl: https://ideone.com/AmODLG

    К сожалению, не все языки удалось проверить имеющимися интерпретаторами/компиляторами.

    inkanus-gray, 12 Сентября 2017

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

    +5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    else {
          !this.isRight ?
            this.reachedPoints = 0 :
            this.reachedPoints = this.points;
    }

    Витя, как же ты заебал уже со своими ебучими тернарками!

    Bullsquid, 11 Сентября 2017

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

    −17

    1. 1
    Когда уже HACTEHbKA напишет программу, которая выводит "bormand one love", который можно скомпилировать компиляторами двух разных ЯП

    d_fomenok, 11 Сентября 2017

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

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    #ifdef _MSC_VER
    #  if ( _MSC_VER <= 1800) // MSVC 2012 / 2013
    typedef std::vector<char>& vector_ref;
    #  else
    typedef std::vector<char>&& vector_ref;
    #  endif
    #else
    typedef std::vector<char>&& vector_ref;
    #endif
    
    auto func = std::bind([this](vector_ref v) { /* ... */ }, std::placeholders::_1);

    тут говна вагон и маленькая тележка
    Во-первых, версии студии, компилятора студии и _MSC_VER всегда разные. Сложно даже представить человека который решил "а давайте распространять компилятор по версии SDK, а проверять по левому числу, не являющемуся ни тем ни другим?"
    Во-вторых, поддержка c++11 в msvc 2012/2013 удручает. В 2012 нет даже type aliases, потому и typedef.
    В-третьих, кривая реализация bind (rvalue-версия не соберется в студиях 12/13, lvalue - в более поздних).

    Antervis, 11 Сентября 2017

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

    0

    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
    if ($session_data['iam']) {
                    $newparam = $param = " AND member_gender = '" . $session_data['iam'] . "' ";
                }
    
                if ($session_data['add_title_new']) {
                    $newparam = $param = " AND member_name like '%" . $session_data['add_title_new'] . "%' ";
                }
    
                if ($session_data['i_am']) {
                    $param = " AND member_gender = '" . $session_data['i_am'] . "' ";
                }
    
                if ($session_data['looking']) {
                    $newparam .= $param .= " AND member_looking_for = '" . $session_data['looking'] . "' ";
                }
    
                if ($session_data['agefrom'] != '0' && $session_data['agefrom'] != '') {
                    $param .= " AND partner_age_range_from = '" . $session_data['agefrom'] . "' ";
                }

    Ладно, зачем-то присваивание сразу двух переменных, которые названы совершенно невнятно. Но что делает .= $param .= я вообще боюсь представить (и честно говоря лень проверять)

    gorsash, 11 Сентября 2017

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

    0

    1. 1
    normalSport.Regions.First().Leagues.FirstOrDefault(x => x.LeagueId == rootCompanyOdds.leagues[i].id).Games.FirstOrDefault(x => x.GameId == rootCompanyOdds.leagues[i].events[j].id).Markets.AddRange(factory.CreateGameFromCompanyEvent(rootCompanyOdds.leagues[i].events[j]).Markets)

    инлайн змiй

    govnoBet, 11 Сентября 2017

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

    −2

    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
    public static function GenerateMenu()
        {
            $item = [];
            $section = self::find()->all();
            $count_section = 0;
    
            foreach ($section as $model_section) {
                $item[] = ['label' => $model_section->name, 'url' => '#'];
                $category = \common\models\Category::find()->where(['id_section' => $model_section->id])->all();
                $count_category = 0;
                foreach ($category as $model_category) {
                    $item[$count_section]['items'][$count_category] = ['label' => $model_category->name, 'url' => '#'];
                    $subcategory = \common\models\Subcategory::find()->where(['id_category' => $model_category->id])->all();
                    $count_subcategory = 0;
                    foreach ($subcategory as $model2) {
                        $item[$count_section]['items'][$count_category]['items'][$count_subcategory] = ['label' => $model2->name, 'url' => '#'];
                        $count_subcategory++;
                    }
                    $count_category++;
                }
                $count_section++;
            }
    
            return $item;
        }

    Феерическое решение для вывода tree из трех категорий.

    qstd, 09 Сентября 2017

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