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

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

    +1

    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
    // https://github.com/shanecoughlan/OpenGEM/blob/ac06b1a3fec3f3e8defcaaf7ea0338c38c3cef46/source/OpenGEM-7-RC3-SDK/OpenGEM-7-SDK/GEM%20AES%20AND%20SOURCE%20CODE/FreeGEM%20AES%203.0%20(source%20code)/GEMEVLIB.C#L143
    /*
    *	Do a multi-wait on the specified events.
    */
    	WORD
    ev_multi(flags, pmo1, pmo2, tmcount, buparm, mebuff, prets)
    	REG WORD	flags;
    	REG MOBLK	*pmo1;
    	MOBLK		*pmo2;
    	LONG		tmcount;
    	LONG		buparm;
    	LPVOID		mebuff;
    	WORD		prets[];
    {
    	QPB		m;
    	REG EVSPEC	which;
    	REG WORD	what;
    	REG CQUEUE	*pc;
    #if MULTIAPP
    	WORD		evbuff[8];
    	WORD		pid;
    	SHELL		*psh;
    	LONG		ljunk;
    
    	pid = rlr->p_pid;
    	psh = &sh[pid];
    	if ( psh->sh_state & SHRINK )		/* shrink accessory	*/
    	{
    	  if (pr_shrink(pid, TRUE, &ljunk, &ljunk))
    	    ap_exit(TRUE); /* if no swap space terminate acc */ 
    	  psh->sh_state &= ~SHRINK;
    	}
    #endif
    
    						/* say nothing has 	*/
    						/*   happened yet	*/
    	what = 0x0;
    		 				/* do a pre-check for a	*/
    						/*   keystroke & then	*/
    						/*   clear out the forkq*/
    	chkkbd();
    	forker();
    						/*   a keystroke	*/
    	if (flags & MU_KEYBD)
    	{
    						/* if a character is 	*/
    						/*   ready then get it	*/
    	  pc = &rlr->p_cda->c_q;
    	  if ( pc->c_cnt )
    	  {
    	    prets[4] = (UWORD) dq(pc);
    	    what |= MU_KEYBD;
    	  }
    	}
    						/* if we own the mouse	*/
    						/*   then do quick chks	*/
    	if ( rlr == gl_mowner )
    	{
    						/* quick check button	*/
    	  if (flags & MU_BUTTON)
    	  {
    	    if ( (mtrans > 1) &&
    		 (downorup(pr_button, buparm)) )
    	    {
    	      what |= MU_BUTTON;
    	      prets[5] = pr_mclick;
    	    }
    	    else
    	    {
    	      if ( downorup(button, buparm) )
    	      {
    	        what |= MU_BUTTON;
    	        prets[5] = mclick;
    	      }
    	    }
    	  }
    						/* quick check mouse rec*/
    	  if ( ( flags & MU_M1 ) &&	
    	       ( in_mrect(pmo1) ) )
    	      what |= MU_M1;
    						/* quick check mouse rec*/
    	  if ( ( flags & MU_M2 ) &&
    	       ( in_mrect(pmo2) ) )
    	      what |= MU_M2;
    	}
    						/* quick check timer	*/
    	if (flags & MU_TIMER)
    	{
    	  if ( tmcount == 0x0L )
    	    what |= MU_TIMER;
    	}
    						/* quick check message	*/
    	if (flags & MU_MESAG)
    	{
    	  if ( rlr->p_qindex > 0 )
    	  {
    #if MULTIAPP
    	    ap_rdwr(MU_MESAG, rlr, 16, ADDR(&evbuff[0]) );
    #endif
    #if SINGLAPP

    Уххх бля

    j123123, 13 Июля 2021

    Комментарии (10)
  3. JavaScript / Говнокод #27509

    +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
    async Create(id, subscribe_yyyymmdd) {
      const query = "INSERT INTO users(id,subscribe_yyyymmdd) VALUES ($1,$2) RETURNING *";
      const values = [id, subscribe_yyyymmdd];
      try {
        const result = await this.db.query(query, values);
        return result.rows[0].id;
      } catch (error) {
        this.logger.error(error);
      }
    },
    
    async Update() {
      const query = "UPDATE users SET subscribe_yyyymmdd = $1 where id=$2 RETURNING *";
      const values = [id, subscribe_yyyymmdd];
      try {
        const result = await this.db.query(query, values);
        return result.rows[0].id;
      } catch (error) {
        this.logger.error(error);
      }
    },

    Из https://vk.com/wall521764930_6553 .

    PolinaAksenova, 11 Июля 2021

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

    +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
    import std.stdio;
    
    template GenMix()
    {
      const char[] GenMix = 
        "template GenMix2()" ~
        "{" ~
        "  const char[] GenMix2 = \"writeln(\\\"Hello, Wandbox!\\\");\";" ~
        "};";
    }
    
    template MixMix(string Name)
    {
      const char[] MixMix = "mixin(" ~ Name ~ "!());";
    }
    
    mixin(GenMix!());
    
    
    void main()
    {
      mixin(GenMix2!());
      mixin(MixMix!("GenMix2"));
    }

    https://wandbox.org/permlink/1HpjfgrgVLyBSrXG

    ГОМОИКОННОСТЬ в D

    j123123, 10 Июля 2021

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

    +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
    class C {
        _length: number;
    
        constructor() {
            this._length = 10;
        }
    
        get length() {
            return this._length;
        }
        set length(value: number) {
            this._length = value;
        }
    }
    
    function main() {
        const c = new C();
    
        print(c.length);
        c.length = 20;
        print(c.length);
    
        delete c;
    
        print("done.");
    }

    пока вы тут балаболили я тут наговнокодил "property" или "accessors"

    ASD_77, 07 Июля 2021

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    public function isBooted()
    {
        return true === $this->booted;
    }

    Дичь

    deenmluzsxbpg, 07 Июля 2021

    Комментарии (42)
  7. PHP / Говнокод #27492

    +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
    <?php
    // bitrix/modules/main/classes/mysql/database.php:: 176
    
    if(!$result)
    {
    .......
    	if(!$bIgnoreErrors)
    	{
    .......
    
    		if(file_exists($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/php_interface/dbquery_error.php"))
    			include($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/php_interface/dbquery_error.php");
    		elseif(file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/dbquery_error.php"))
    			include($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/dbquery_error.php");
    		else
    			die("MySQL Query Error!");
    
    		die();
    	}
    	return false;
    }
    
    // bitrix/modules/main/include/dbquery_error.php
    <br>
    <table>
    //верстка html страницы со вставками переменных через <?= ?>
    </table>

    Исключения? Не, не слышали. Пусть конечный разработчик голову ломает, почему он не может отловить MySQL Query Error [1062] Duplicate entry ......

    crazzy501, 30 Июня 2021

    Комментарии (56)
  8. Python / Говнокод #27491

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    s=79; cur=[s//2,s//2]; prio=[[0,1],[1,0],[0,-1],[-1,0]]
    spiral = [[0 for i in range(0,s)] for l in range(0,s)]
    for cor in enumerate([[0,0]]+[prio[c] for c in [int(c) for c in ''.join([str(p%4)*((p+2)//2) for p in range(0,s**2//2)])]][:s**2-1],start=1):
        n=cor[0];cur=[cur[0]+cor[1][0],cur[1]+cor[1][1]];spiral[cur[0]][cur[1]]=n
    for c in spiral: print(str(('{:>'+str(len(str(s**2))+1)+'}')*len(c)).format(*c))

    А теперь попробуй повтори этот шедевр своими трясущимися ручками-веточками на своём С++

    pl7ofit, 29 Июня 2021

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

    +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
    // https://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/global/qglobal.h?h=v5.13.1#n1017
    
    #if __cplusplus >= 201703L
    // Use C++17 if statement with initializer. User's code ends up in a else so
    // scoping of different ifs is not broken
    #define Q_FOREACH(variable, container)                                   \
    for (auto _container_ = QtPrivate::qMakeForeachContainer(container);     \
         _container_.i != _container_.e;  ++_container_.i)                   \
        if (variable = *_container_.i; false) {} else
    #else
    // Explanation of the control word:
    //  - it's initialized to 1
    //  - that means both the inner and outer loops start
    //  - if there were no breaks, at the end of the inner loop, it's set to 0, which
    //    causes it to exit (the inner loop is run exactly once)
    //  - at the end of the outer loop, it's inverted, so it becomes 1 again, allowing
    //    the outer loop to continue executing
    //  - if there was a break inside the inner loop, it will exit with control still
    //    set to 1; in that case, the outer loop will invert it to 0 and will exit too
    #define Q_FOREACH(variable, container)                                \
    for (auto _container_ = QtPrivate::qMakeForeachContainer(container); \
         _container_.control && _container_.i != _container_.e;         \
         ++_container_.i, _container_.control ^= 1)                     \
        for (variable = *_container_.i; _container_.control; _container_.control = 0)
    #endif

    А можно ли свой foreach сделать через какую-нибудь шаблонопарашу? Или тут, как обычно, нужна гомоиконность?

    j123123, 28 Июня 2021

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

    +1

    1. 1
    IT Оффтоп #97

    #67: https://govnokod.ru/27049 https://govnokod.xyz/_27049
    #68: https://govnokod.ru/27061 https://govnokod.xyz/_27061
    #69: https://govnokod.ru/27071 https://govnokod.xyz/_27071
    #70: https://govnokod.ru/27097 https://govnokod.xyz/_27097
    #71: https://govnokod.ru/27115 https://govnokod.xyz/_27115
    #72: https://govnokod.ru/27120 https://govnokod.xyz/_27120
    #73: https://govnokod.ru/27136 https://govnokod.xyz/_27136
    #74: https://govnokod.ru/27160 https://govnokod.xyz/_27160
    #75: https://govnokod.ru/27166 https://govnokod.xyz/_27166
    #76: https://govnokod.ru/27168 https://govnokod.xyz/_27168
    #77: https://govnokod.ru/27186 https://govnokod.xyz/_27186
    #78: https://govnokod.ru/27219 https://govnokod.xyz/_27219
    #79: https://govnokod.ru/27254 https://govnokod.xyz/_27254
    #80: https://govnokod.ru/27270 https://govnokod.xyz/_27270
    #81: https://govnokod.ru/27280 https://govnokod.xyz/_27280
    #82: https://govnokod.ru/27284 https://govnokod.xyz/_27284
    #83: https://govnokod.ru/27296 https://govnokod.xyz/_27296
    #84: https://govnokod.ru/27336 https://govnokod.xyz/_27336
    #85: https://govnokod.ru/27381 https://govnokod.xyz/_27381
    #86: https://govnokod.ru/27405 https://govnokod.xyz/_27405
    #87: https://govnokod.ru/27429 https://govnokod.xyz/_27429
    #88: https://govnokod.ru/27432 https://govnokod.xyz/_27432
    #89: https://govnokod.ru/27435 https://govnokod.xyz/_27435
    #90: https://govnokod.ru/27439 https://govnokod.xyz/_27439
    #91: https://govnokod.ru/27449 https://govnokod.xyz/_27449
    #92: https://govnokod.ru/27460 https://govnokod.xyz/_27460
    #93: https://govnokod.ru/27463 https://govnokod.xyz/_27463
    #94: https://govnokod.ru/27466 https://govnokod.xyz/_27466
    #95: https://govnokod.ru/27473 https://govnokod.xyz/_27473
    #96: https://govnokod.ru/27478 https://govnokod.xyz/_27478

    nepeKamHblu_nemyx, 26 Июня 2021

    Комментарии (2969)
  11. JavaScript / Говнокод #27476

    +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
    function main() {
    
        let a = 10;
    
        function f() {
            print(a);
        }
    
        f();
    
        print("done.");
    }

    С виду этот простой кодик - это то что не может С и я так долго трахался что бы смочь его проимлементировать.... но я бля сделал

    ASD_77, 21 Июня 2021

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