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

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

    +113

    1. 1
    2. 2
    Стартовал форум работы еще много,  тестить уже можно 
    http://gvforum.ru/

    Vasiliy, 28 Декабря 2013

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

    0

    1. 1
    Type: Null

    https://bulbapedia.bulbagarden.net/wiki/Type:_Null_(Pok%C3%A9mon)

    vistefan, 23 Ноября 2018

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

    +21

    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 socket_exception                                                                                                                        
    {                                                                                                                                              
    public:                                                                                                                                    
                char *buf;                                                                                                                             
                int ret;                                                                                                                               
                socket_exception()                                                                                                                    
                {                                                                                                                                      
                    buf=new char[10000];                                                                                                               
                    ret=RET_OK;                                                                                                                        
                }                                                                                                                                      
                socket_exception(char *b, int r)                                                                                                      
                {                                                                                                                                      
                    buf=new char[10000];                                                                                                               
                    snprintf(buf,9999,"%s",b);                                                                                                         
                    ret=r;                                                                                                                             
                }                                                                                                                                      
                socket_exception(vsocket_exception &ex)                                                                                               
                {                                                                                                                                      
                    buf=new char[10000];                                                                                                               
                    snprintf(buf, 9999, "%s", ex.buf);                                                                                                 
                    ret=ex.ret;                                                                                                                        
                }                                                                                                                                      
                const char * what (){return buf;}                                                                                                      
                int get_ret(){return ret;}                                                                                                             
                ~socket_exception(){delete[] buf;}                                                                                                    
    };

    фрактал

    roman-kashitsyn, 20 Июня 2013

    Комментарии (178)
  5. Pascal / Говнокод #8664

    +102

    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
    function naq(a:integer;n:integer;m:integer):string;
    var astr:string;
    begin
      astr:=inttostr(a);
         case m of
           1: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*1)+'*p^'+inttostr(n+1);
           2: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*2)+'*p^'+inttostr(n+1)+'+'+inttostr(a*1)+'*p^'+inttostr(n+2);
           3: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*3)+'*p^'+inttostr(n+1)+'+'+inttostr(a*3)+'*p^'+inttostr(n+2)+'-'+inttostr(a*1)+'*p^'+inttostr(n+3);
           4: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*4)+'*p^'+inttostr(n+1)+'+'+inttostr(a*6)+'*p^'+inttostr(n+2)+'-'+inttostr(a*4)+'*p^'+inttostr(n+3)+'+'+inttostr(a*1)+'*p^'+inttostr(n+4);
           5: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*5)+'*p^'+inttostr(n+1)+'+'+inttostr(a*10)+'*p^'+inttostr(n+2)+'-'+inttostr(a*10)+'*p^'+inttostr(n+3)+'+'+inttostr(a*5)+'*p^'+inttostr(n+4)+'-'+inttostr(a*1)+'*p^'+inttostr(n+5);
           6: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*6)+'*p^'+inttostr(n+1)+'+'+inttostr(a*15)+'*p^'+inttostr(n+2)+'-'+inttostr(a*20)+'*p^'+inttostr(n+3)+'+'+inttostr(a*15)+'*p^'+inttostr(n+4)+'-'+inttostr(a*6)+'*p^'+inttostr(n+5)+'+'+inttostr(a*1)+'*p^'+inttostr(n+6);
           7: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*7)+'*p^'+inttostr(n+1)+'+'+inttostr(a*21)+'*p^'+inttostr(n+2)+'-'+inttostr(a*35)+'*p^'+inttostr(n+3)+'+'+inttostr(a*35)+'*p^'+inttostr(n+4)+'-'+inttostr(a*21)+'*p^'+inttostr(n+5)+'+'+inttostr(a*7)+'*p^'+inttostr(n+6)+'-'+inttostr(a*1)+'*p^'+inttostr(n+7);
           8: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*8)+'*p^'+inttostr(n+1)+'+'+inttostr(a*28)+'*p^'+inttostr(n+2)+'-'+inttostr(a*56)+'*p^'+inttostr(n+3)+'+'+inttostr(a*70)+'*p^'+inttostr(n+4)+'-'+inttostr(a*56)+'*p^'+inttostr(n+5)+'+'+inttostr(a*28)+'*p^'+inttostr(n+6)+'-'+inttostr(a*8)+'*p^'+inttostr(n+7)+'+'+inttostr(a*1)+'*p^'+inttostr(n+8);
           9: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*9)+'*p^'+inttostr(n+1)+'+'+inttostr(a*36)+'*p^'+inttostr(n+2)+'-'+inttostr(a*84)+'*p^'+inttostr(n+3)+'+'+inttostr(a*126)+'*p^'+inttostr(n+4)+'-'+inttostr(a*126)+'*p^'+inttostr(n+5)+'+'+inttostr(a*84)+'*p^'+inttostr(n+6)+'-'+inttostr(a*36)+'*p^'+inttostr(n+7)+'+'+inttostr(a*9)+'*p^'+inttostr(n+8)+'+'+inttostr(a*1)+'*p^'+inttostr(n+9);
         end;
      end;

    Лень было искать алгоритм раскрытия (1-q)^n

    rob1nzon, 28 Ноября 2011

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

    +160

    1. 1
    2. 2
    3. 3
    4. 4
    $url = $_SERVER['HTTP_REFERER'];	
    	
    $pos = strrpos($url, 'id');
    $id = substr($url, $pos + 2);

    Получаем id человека)))

    OJA, 08 Октября 2011

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

    −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
    // POST /login
    exports.login = function login(req, res) {
        var email = req.body.email;
        var password = req.body.password;
    
        security.rateLimitRequest( 'reset', req, function( err ) {
            if ( err )
                return res.status( 400 ).send( err );
            db.Account.find({email: email, password: password}, function(err, account) {
                if ( err )
                    return res.status( 400 ).send( err );
                account.getAccountStatistics(account, function(err, account) {
                    if ( err )
                        return res.status( 400 ).send( err );
                    account.incrementAccountLoginCount(account, function(err) {
                        if ( err )
                           return res.status( 400 ).send( err );
                        res.send(account);
                    });
                });
            });
        });
    });

    У меня радость во все поля:

    // POST /login
    exports.login = function *login() {
    var email = req.body.email;
    var password = req.body.password;

    try
    {
    // Throws an error if rate limit exceeded
    yield security.rateLimitRequest( 'reset', req );

    // Query MongoDB for account
    var account = yield db.Account.find({email: email, password: password});
    account.statistics = yield account.getAccountStatistics(account);

    // Increment login count
    yield account.incrementAccountLoginCount(account);

    this.body = account;
    }
    catch( err ) {
    // Return the error as JSON
    return res.status( 400 ).send( err );
    }
    });

    LispGovno, 23 Марта 2016

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

    +3

    1. 1
    2. 2
    foreach($arResult['ITEMS'] as $key => &$arItem) {
    		$priceRes2 = CIBlockElement::GetList(array(), array("IBLOCK_ID" => 34, "PROPERTY_PERIOD" => 1, "PROPERTY_PERIOD_TYPE" => 85, "PROPERTY_OBJECT_RELATION" => $arItem['ID']), false, false, array("NAME"));

    "Я программист 1C-bitrix и с каждой новой итерацией я делаю новый запрос к инфоблоку."

    tutov2013, 01 Сентября 2015

    Комментарии (177)
  9. Куча / Говнокод #18437

    +119

    1. 1
    2. 2
    3. 3
    Почитываю иногда комменты на govnokod.ru
    Сложилось впечатление, что Stertor, bormand, kegdan, inkanus-gray, 1024--, и многие другие - один и тот же человек
    так ли это?

    besprincypniycentner, 04 Июля 2015

    Комментарии (177)
  10. C# / Говнокод #26533

    +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
    using System;
     
    namespace Test
    {
        public class HttpException : Exception
        {
            public HttpException(int status)
            {
                StatusCode = status;
            }
     
            public int StatusCode { get; set; }
        }
     
        class Program
        {
            static void TestCatch(int status)
            {
                try
                {
                    throw new HttpException(status);
                }
                catch (HttpException ex) when (ex.StatusCode == 404)
                {
                    Console.WriteLine("Not Found!");
                }
                catch (HttpException ex) when (ex.StatusCode >= 500 && ex.StatusCode < 600)
                {
                    Console.WriteLine("Server Error");
                }
                catch (HttpException ex)
                {
                    Console.WriteLine("HTTP Error {0}", ex.StatusCode);
                } 
            }
            static void Main(string[] args)
            {
                TestCatch(404);
                TestCatch(501);
                TestCatch(101);
            }
        }
    }

    https://ideone.com/zXstg3
    Именно поэтому я за «C#».

    gost, 27 Марта 2020

    Комментарии (176)
  11. C# / Говнокод #16513

    +143

    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
    private void bSaveLog_Click(object sender, EventArgs e)
            {
                String x = Game.choosen().name;
                String y = "Data\\" + x + ".txt";
                FileInfo file = new FileInfo(y);           
                DirectoryInfo di = Directory.CreateDirectory("Data\\");
                if (file.Exists == false)
                {  
                        file.Create();
                        using (StreamWriter sw = file.AppendText())
                    {                    
                        sw.WriteLine("Hello");
                        sw.WriteLine("And");
                        sw.WriteLine("Welcome");
                        sw.Flush();
                        sw.Close();
                    }
                }            
            }

    Помогите советом мудрым, почему при записи в файл выдаёт "Процесс не может получить доступ к файлу..."? Как сделать правильно?

    312312, 10 Августа 2014

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