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

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

    −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
    const connectToServerEpic = (
      action$,
    ) => (
      action$
      .pipe(
        ofType(CONNECT_TO_SERVER),
        switchMap(({
          hostname,
          port,
          protocol,
          protocolVersion,
          reconnectionTimeout,
        }) => (
          action$
          .pipe(
            ofType(RECONNECT_TO_SERVER),
            takeUntil(
              action$
              .pipe(
                ofType(DISCONNECT_FROM_SERVER),
              )
            ),
            startWith(null),
            map(() => (
              webSocket({
                protocol: protocolVersion,
                url: (
                  protocol
                  .concat('://')
                  .concat(hostname)
                  .concat(':')
                  .concat(port)
                ),
                WebSocketCtor: WebSocket,
              })
            )),
            switchMap((
              webSocketConnection$,
            ) => (
              webSocketConnection$
              .pipe(
                takeUntil(
                  action$
                  .pipe(
                    ofType(
                      RECONNECT_TO_SERVER,
                      DISCONNECT_FROM_SERVER,
                    ),
                  )
                ),
                catchError(() => (
                  timer(
                    reconnectionTimeout,
                  )
                  .pipe(
                    takeUntil(
                      action$
                      .pipe(
                        ofType(
                          RECONNECT_TO_SERVER,
                          DISCONNECT_FROM_SERVER,
                        ),
                      )
                    ),
                    mapTo(reconnectToServer()),
                  )
                )),
                map(receivedWebSocketMessage),
                startWith(
                  connectionReady(
                    webSocketConnection$,
                  )
                ),
              )),
            )),
          )
        )),
      )
    )

    https://itnext.io/simplifying-websockets-in-rxjs-a177b887f3b8

    DypHuu_niBEHb, 21 Апреля 2021

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

    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
    20. 20
    21. 21
    22. 22
    23. 23
    #include <stdio.h>
    
    int main()
    {
        goto a;
        h: printf("W"); goto i;
        g: printf(" "); goto h;
        m: printf("!"); goto n;
        i: printf("o"); goto j;
        n: printf("\n"); goto end;
        b: printf("e"); goto c;
        e: printf("o"); goto f;
        j: printf("r"); goto k;
        d: printf("l"); goto e;
        f: printf(","); goto g;
        a: printf("H"); goto b;
        k: printf("l"); goto l;
        l: printf("d"); goto m;
        c: printf("l"); goto d;
        end: ;
        
        return 0;
    }

    GDMaster, 01 Октября 2020

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

    +5

    1. 1
    [code]main[]__attribute__((section(".text"))) = {0xC0FFC031,0x7401FF83,0xFFE7F706,0xC3F5EBCF};[/code]

    Печатает факториал, от числа аргументов.
    капча: t4ar

    3.14159265, 18 Июля 2020

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

    +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
    template <typename function_type, typename vector_type>
    function_type read_memory(HANDLE hProcess, function_type base_address, std::vector< vector_type >&& offsets) {
        function_type tmp = base_address;
        for (function_type i : **reinterpret_cast< vector_type** >( &offsets )) {
            ReadProcessMemory(hProcess, reinterpret_cast< PBYTE* >( tmp + i ), &tmp, sizeof(function_type), nullptr);
        }
        return tmp;
    }
    
    int main() {
        std::vector< DWORD > offset = {
            0x10,
            0x14,
            0x158
        };
        auto buffer = read_memory< DWORD, DWORD >(hProcess, base_address, std::move(offset));
    }

    Полуговнокодер читает память чужого процесса...

    bcaoo, 10 Февраля 2020

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

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    PHP
    print 3 --0-- 5 == 8; // Parse error
    Java Script
    console.log(3 --0-- 5 == 8); // Uncaught SyntaxError: Invalid left-hand side expression in postfix operation
    Python
    print(3 --0-- 5 == 8) // true

    Именно поэтому я за "PHP" и "Java Script"

    phpBidlokoder2, 07 Февраля 2020

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

    0

    1. 1
    https://upload.wikimedia.org/wikipedia/commons/b/b5/Hexadecimal-counting.jpg

    Просто оставлю это здесь

    CEMEH, 25 Ноября 2019

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

    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
    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
    <?
    class CHISLO {
        private $arr = array('', 'один', 'два', 'три', 'четыре', 'пять', 'шесть', 'семь', 'восемь', 'девять', 'десять',
                             'одиннадцать', 'двенадцать', 'тринадцать', 'четырнадцать', 'пятнадцать',
                             'шестнадцать', 'семнадцать', 'восемнадцать', 'девятнадцать');
        private $arr2 = array('', 'сто', 'двести', 'триста', 'четыреста');
        private $ar = array(
            1=>array('тысяч', 'тысяча', 'тысячи', 'тысячи', 'тысячи', 'тысяч', 'тысяч', 'тысяч', 'тысяч', 'тысяч'),
            array('миллионов', 'миллион', 'миллиона', 'миллиона', 'миллиона', 'миллионов', 'миллионов',
                  'миллионов', 'миллионов', 'миллионов'),
            array('миллиардов', 'миллиард', 'миллиарда', 'миллиарда', 'миллиарда', 'миллиардов', 'миллиардов',
                  'миллиардов', 'миллиардов', 'миллиардов'),
            array('триллионов', 'триллион', 'триллиона', 'триллиона', 'триллиона', 'триллионов', 'триллионов',
                  'триллионов', 'триллионов', 'триллионов')
        );
     
        public function get_chislo($ch) {
            if( $ch<1000 )
                return $this->get_100($ch);
            $ch = preg_split('/(?=(\d{3})+(?!\d))/is', $ch, -1, PREG_SPLIT_NO_EMPTY);
            $ch = array_reverse($ch);
            $result[] = $this->get_100($ch[0]);
            for($i=1; $i<count($ch); $i++) {
                @$result[] = $this->get_100($ch[$i]) .' '. $this->ar[$i]{$ch[$i]%10};
            }
            $result[1] = str_replace('один', 'одна', $result[1]);
            // $result[1] = str_replace('два', 'две', $result[1]);
            return join(' ', array_reverse($result));
        }
        private function get_100($ch) {
            $c1 = (int)($ch / 100);
            $c2 = $ch % 100;
            if( $c1<5 )
                $result = $this->arr2[$c1];
            else 
                $result = $this->arr[$c1] . 'сот';
            return @$result .' '. $this->get_10($c2);
        }
        private function get_10($ch) {
            $c1 = (int)($ch / 10);
            $c2 = $ch % 10;
            if( $ch<20 ) {
                $result = $this->arr[$ch];
            } else if( $ch<40 ) {
                $result = $this->arr[$c1] . 'дцать';
            } else if( $ch<50 ) {
                $result = 'сорок';
            } else if( $ch<90 ) {
                $result = substr( $this->arr[$c1], 0, -1 ) . 'десят';
            } else if( $ch<100 ) {
                $result = 'девяносто';
            }
            if( $ch>20 && $c2!=0 )
                $result .= ' ' . $this->arr[$c2];
            return $result;
        }
    }?>

    Bitrix❤️

    eskrano, 21 Октября 2019

    Комментарии (39)
  9. PHP / Говнокод #25856

    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
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    ░████▓▓▓▓▓▓▓█▓█████████▓████▒           
                            >████▓▓▓▓▓██▓▓████████████████           
                            ▓█▓▓▒▒▒▓▓▓▓▓▓▓▓▓▓█▓▓▓▓▓▓▓▓████▓          
                            ███▓▒▒▒▒▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓█████          
                            ██▓▓▒▒░<_▒▓▓▓▓▓▓▓▓▓▒▓▒▒▒▒▓▓███▓          
                            ██▓▓▒▒▒_   <▒▒▒▒▒▒▒░░▒▒▒▒▒▒███▒          
                           ░██▓▒▒▒░              _░▒▒▒▒▓██░          
                           ██▓█▓░_░_             _▒▒▒▒▒▓██           
                           █▓▓█▓▒  <             <░▒▒▒▒▓██           
                           █▓▓▓▓▓▓░              <░▒▒▒▓▓█▓           
                           █▒▓▓▒▒▒▒▓▒              ▒▒▓▒▓██           
                           ▓▓ ▒█▓▓▓▓█▒        __▒▒▒▓▓▒▒███           
                           ▓█▒ █▓▒  ▓▓▓< _ ▒▒▓▓▓▒▒▒▓▓▒▒██_           
                      ▒▒▒▓▓▒▓▓ ▒▓<    ▓▒  ▒▓▓▒▓▓▓▓▓▒▓▒▓█<            
             ░░▒▒▒▒▒▓▓▓▓▓▓▓▒▒▓░  ░░░ ░▒  _░ _   \█▓>░▒▓▒             
         ▒▓▓▓▒▒░_    ▒▒▒▒▓▓▓▓▒░   ▒_▒▒▓  ▒\ _▒▒░▒▒  ▒▓▓▒             
       ▓▓▓▒░>         ▒▒▒▓▓▓▓▒░  __>▒▓▒  ▒░▒_      ▒▓▓▓▓▓▓░          
      ▓▒▒_            ░▒▒▓▓▓▒▒▒     ▓▒  ░▒▒_    \▒▒▒▓▓▒░▒▒▓▓▓        
    ▓▒▒░               ▒▒▒▓▓▒▒>    ▓█   <▓▒    >▒▒▒▓▓▓ _<▒▒▒▓▓▓      
    ▒_░                ▒▒ ▓▓▒▒<     █▓▒_▒▓     _░▒▒▓▓▒   <▒▒▒▒▓▓▓    
    _                  ▒▒░▓▓▒▒       ▒▒░▒_     ░▒▒▒▓▒▒▒   ░▒<░░▒▒▓▒  
    _                  ▓▒▒▓▓▒▒▒▒░  ░▒   <      ░▒▒▓▒▒▒▓<      ░░▒▒▓▓ 
                       ▓▓▒▓█▓▓▓▓▒▒░░_░▒_      _▒▒▓▒_▒▒▒▒\       _░▒▓▒
                       ░▓▒▓▓▓▓▓▒▒▓██▓▒▒▓▒>_▒▒_▒▒▓▓░_▒▒▒▒▒\   
                       _▓▓█▓▓▓▒▓▒▒▓███████▓▓▓▓▓▓▓▒▒▒▒▓▒▒▒░   
                       >▓▓▓▓▓▓▓▓█▓▒<▒▓▓▒▓▓▓▓██▓▓▒▒▒▒▓▒▒▒░   
                         ▓▓▓▓▓█▓▓▓█▓▓▒▒▒▒▓▓██▒▒▒▒▒▒▒▒▒▒_      
    _                     ▓▓▓▓▓▓▓▒▒▓▓▒▒▒▓██▓▒▒▒░▒▒▒▒▒▒\   
                           ▒▓▓██▓█▓▓▓▓▓██▓▓▒▒▒▒▒▒▒▒▒▒▒░░         
    _ _             ___ _   _▒▓███████▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒░_\

    booratihno, 18 Сентября 2019

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

    +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
    switch (field.type) {
        case 'checkbox':
        case 'notification':	
            if (field.type == 'notification') {
                fieldData.element.addClass('field-notification');
                $('<span class="notification-button" data-action="notification">').text('Принять').appendTo(body).on(
                    'click', function () {
    		    _class.wrapper.removeClass('notification');
    		    _class.notification.wrapper.removeClass('notification-active');
    		    _class.fields[index - 1].changeStatus();
    		    $Mediator.fire({
                            name: 'active:filter',
    			target: _class.fields[0].filter
    		    });
                });
            }
        break;
    }

    Вдруг SWITCH не сработал)

    JudiCortes, 21 Мая 2019

    Комментарии (39)
  11. Си / Говнокод #25349

    −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
    #include <stdio.h>
    #include <stdlib.h>
    #include <inttypes.h>
    
    int main(void)
    {
      char a[8], b[8];
      char *a_ptr = a+8;
      char *b_ptr = b;
      printf("a_ptr = %p, b_ptr = %p\n", a_ptr, b_ptr);
      if (a_ptr != b_ptr)
      {
        printf("a_ptr != b_ptr\n");
      }
      else
      {
        printf("a_ptr == b_ptr\n");
      }
      
      
      if ((uintptr_t)a_ptr != (uintptr_t)b_ptr)
      {
        printf("(uintptr_t)a_ptr != (uintptr_t)b_ptr\n");
      }
      else
      {
        printf("(uintptr_t)a_ptr == (uintptr_t)b_ptr\n");
      }
      return EXIT_SUCCESS;
    }

    Что по-вашему тут происходит?

    j123123, 02 Февраля 2019

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