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

    В номинации:
    За время:
  2. Куча / Говнокод #29251

    0

    1. 1
    Пиздец-оффтоп #128

    #98: https://govnokod.ru/28932 https://govnokod.xyz/_28932
    #99: https://govnokod.ru/28936 https://govnokod.xyz/_28936
    #100: https://govnokod.ru/28940 https://govnokod.xyz/_28940
    #101: https://govnokod.ru/28949 https://govnokod.xyz/_28949
    #102: https://govnokod.ru/28978 https://govnokod.xyz/_28978
    #103: https://govnokod.ru/28982 https://govnokod.xyz/_28982
    #104: https://govnokod.ru/28989 https://govnokod.xyz/_28989
    #105: https://govnokod.ru/29052 https://govnokod.xyz/_29052
    #106: https://govnokod.ru/29069 https://govnokod.xyz/_29069
    #107: https://govnokod.ru/29086 https://govnokod.xyz/_29086
    #108: https://govnokod.ru/29102 https://govnokod.xyz/_29102
    #109: https://govnokod.ru/29126 https://govnokod.xyz/_29126
    #110: https://govnokod.ru/29136 https://govnokod.xyz/_29136
    #111: https://govnokod.ru/29142 https://govnokod.xyz/_29142
    #112: https://govnokod.ru/29155 https://govnokod.xyz/_29155
    #113: https://govnokod.ru/29160 https://govnokod.xyz/_29160
    #114: https://govnokod.ru/29165 https://govnokod.xyz/_29165
    #115: https://govnokod.ru/29173 https://govnokod.xyz/_29173
    #116: https://govnokod.ru/29174 https://govnokod.xyz/_29174
    #117: https://govnokod.ru/29182 https://govnokod.xyz/_29182
    #118: https://govnokod.ru/29191 https://govnokod.xyz/_29191
    #119: https://govnokod.ru/29196 https://govnokod.xyz/_29196
    #120: https://govnokod.ru/29205 https://govnokod.xyz/_29205
    #121: https://govnokod.ru/29216 https://govnokod.xyz/_29216
    #122: https://govnokod.ru/29219 https://govnokod.xyz/_29219
    #123: https://govnokod.ru/29232 https://govnokod.xyz/_29232
    #124: https://govnokod.ru/29237 https://govnokod.xyz/_29237
    #125: https://govnokod.ru/29239 https://govnokod.xyz/_29239
    #126: https://govnokod.ru/29244 https://govnokod.xyz/_29244
    #127: https://govnokod.ru/29248 https://govnokod.xyz/_29248

    nepeKamHblu_nemyx, 28 Апреля 2026

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

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    public function getResource(): ResourceInterface
    {
        $locale = $this->localeRepository->getByKey($this->getCurrentLocaleKey());
    
        return new Resource($locale->getKey());
    }

    tre, 29 Апреля 2026

    Комментарии (4)
  4. Haskell / Говнокод #29250

    +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
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    {-# LANGUAGE OverloadedStrings #-}
    import qualified Data.Text.Lazy.IO as LIO
    import GHC.IO.StdHandles
    import Text.Regex.TDFA
    import qualified Text.Regex.TDFA.Text.Lazy as RL
    import Data.Array
    import qualified Data.Text.Lazy as TL
    import System.Environment
    import System.Exit
    import System.IO
    import qualified Language.C.Syntax.Constants as CC
    import Data.Char
    
    printMatch t matches i =
        let (offset, len) = matches ! i in
        let offset' = fromIntegral offset in
        let len' = fromIntegral len in
        LIO.putStr $ TL.take len' $ TL.drop offset' t
    
    printHead t matches =
        let (offset, len) = matches ! 0 in
        let offset' = fromIntegral offset in
        let len' = fromIntegral len in
        LIO.putStr $ TL.take offset' t
    
    printTrail t matches =
        let (offset, len) = matches ! 0 in
        let offset' = fromIntegral offset in
        let len' = fromIntegral len in
        LIO.putStr $ TL.drop (offset' + len') t
    
    need_capture_trail acc ".*" = (False, reverse acc)
    need_capture_trail acc [] = (True, reverse acc)
    need_capture_trail acc (c : rest) = need_capture_trail (c : acc) rest
    
    getRE :: [String] -> Either String (RL.Regex, Bool, String)
    getRE args =
        case args of
          (re_str : repl_str : _) ->
              let (trail_needed, re_str') = need_capture_trail [] re_str in
              let re_text = TL.pack $ CC.unescapeString re_str' in
              case RL.compile defaultCompOpt defaultExecOpt re_text of
                Right re ->
                    Right (re, trail_needed, CC.unescapeString repl_str)
                Left err ->
                    Left err
          _ ->
              Left "Regexp expected"
    
    -- replacement :: TL.Text -> Int -> _ -> String -> IO ()
    replacement _ _ _ [] = return ()
    replacement t n_matches matches (c : rest)
        | ord c <= n_matches = do
               printMatch t matches (ord c)
               replacement t n_matches matches rest
        | True = do
            putChar c
            replacement t n_matches matches rest
    
    exitError :: String -> IO ()
    exitError msg = do
      hPutStrLn stderr msg
      exitWith (ExitFailure 1)
    
    main :: IO ()
    main = do
        args <- getArgs
        case getRE args of
          Right (re, trail_needed, repl) -> do
              t <- LIO.hGetContents stdin
              case RL.execute re t of
                Right (Just matches) ->
                    do
                      let n_matches = snd $ bounds matches
                      -- print matches
                      printHead t matches
                      replacement t n_matches matches repl
                      if trail_needed then
                          printTrail t matches
                      else
                          return ()
                Right Nothing -> do
                    exitError "Pattern not found"
                Left err -> do
                    exitError err
          Left err -> do
             exitError err

    Текст UNIX-way утилиты fed
    Капча: p2ux

    CHayT, 25 Апреля 2026

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