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

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

    +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
    namespace Ifaces {
        interface IFoo {
            foo(): number;
        }
    }
    
    class Cls1 implements Ifaces.IFoo
    {
    	foo(): number
    	{
    		print("Hello");
    		return 1;
    	}
    }
    
    function main()
    {
    	const cls1 = new Cls1();
    	cls1.foo();
    
    	const ifoo: Ifaces.IFoo = cls1;
    	ifoo.foo();
    }

    Алилуя. я вам интерфейсы принес... узрите теперь дампик

    ASD_77, 27 Июля 2021

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

    −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
    function main() {
        // Arrays
        const trees = ["redwood", "bay", "cedar", "oak", "maple"];
        print(0 in trees); // returns true
        print(3 in trees); // returns true
        print(6 in trees); // returns false
    
        for (let i = 0; i in trees; i++)
        {
    	print (trees[i]);
        }
    
        print("done.");
    }

    Продолжаем будни говнокодера говнокомпилятора. Сравниваем с компилятором "С".

    как говориться, а ты так можешь?

    ASD_77, 07 Июня 2021

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

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    char* to_str(int i) {
        char* s = malloc(12);
        sprintf(s, "%d", i);
        return s;
    }

    Как в сишке без RAII принято жить? Пиздец какой-то. Буфер в функцию передавать?

    Что мешает завезти RAII в сишку?

    3_dar, 30 Января 2021

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

    +3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    var src = "c:\src";
    var dest = "c:\dest";
    var cmp = CompressionLevel.NoCompression;
    var zip = source_folder + ".zip";
    
    ZipFile.CreateFromDirectory(src, zip, cmp, includeBaseDirectory: false);
    ZipFile.ExtractToDirectory(zip, dest_folder);
    
    File.Delete(zip);

    Интересный способ для копирования всех файлов в директории и поддиректориях.

    https://stackoverflow.com/questions/58744/copy-the-entire-contents-of-a-directory-in-c-sharp

    groser, 23 Октября 2020

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

    0

    1. 1
    2. 2
    3. 3
    Если Ложь Тогда
    	Объ = Документы.ПоступлениеТоваровУслуг.СоздатьДокумент();	
    КонецЕсли;

    Умиляет

    sandvich, 13 Октября 2020

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

    −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
    using System;
    
    namespace c_2
    {
        class Program
        {
            static void Main(string[] args)
            {
            start: 
            Console.WriteLine("введите первое число");
            var a = Convert.ToDouble(Console.ReadLine());;
            Console.WriteLine("введите второе число");
            var b = Convert.ToDouble(Console.ReadLine());;
            Console.WriteLine("Введите действие(+ - * /)");
            string act=Console.ReadLine();
            if (act == "+") 
            {
                Console.WriteLine(a+b);
            } 
            else
            {
                if (act == "-")
                {
                    Console.WriteLine(a - b); 
                }
                else
                {
                    if(act=="*")
                    {
                        Console.WriteLine(a*b);
                    }
                    else
                    {
                        if (act == "/")
                        {
                            Console.WriteLine(a/b); 
                        }
                    }
            }
            Console.WriteLine("Выйти?(y/n)");
            string exit = Console.ReadLine();
            if (exit == "y" )
            {
                Environment.Exit(0);
    
            }
            else
            {
                if (exit == "n")
                {
                    goto start;
                }
                
                {
                    
                }
            }
            }
            }
            
        }
    }

    Калькулятор(моя первая прога на шарпе)

    abrewbrew, 30 Сентября 2020

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

    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
    async def register_experiment(self, pool):
        async with pool.acquire() as conn:
            async with conn.cursor() as cur:
                sql = "INSERT INTO " + str(self.auxname) + "." + 
                    str(self.auxtable)
                sql += " VALUES(NULL, '" 
                sql += str(self.dbname) 
                sql += "', '" 
                sql += str(self.encoder) 
                sql += "', 0, '" #goodEncoder
                sql += str(self.lattices) 
                sql += "', 0, '" #goodLattices
                sql += str(self.complex) 
                sql += "', 0, '" #goodComplex 
                sql += str(self.verges_total) 
                sql += "', 0, " #goodVerges
                sql += str(self.verges_total) 
                sql += ", '" 
                sql += str(self.trains) 
                sql += "', 0, '" #goodTrains 
                sql += str(self.tests) 
                sql += "', 0, '" #goodTests 
                sql += str(self.hypotheses) 
                sql += "', 0, '" #goodHypotheses 
                sql += str(self.type)
                sql += "')"
                await cur.execute(sql)
                await conn.commit()

    https://habr.com/ru/post/509338/
    > Web-сервер машинного обучения «ВКФ-решатель»

    gost, 03 Июля 2020

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

    +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
    function connect( $db_user, $db_pass, $db_name, $db_location )
     {
     $db_location = explode( ":", $db_location );
     if ( isset( $db_location[1] ) ) {
      $this->db_object = @mysqli_connect( $db_location[0], $db_user, $db_pass, $db_name, $db_location[1] );
      }
     else {
      $this->db_object = @mysqli_connect( $db_location[0], $db_user, $db_pass, $db_name );
      }
     if ( ! $this->db_object ) {
      $this->display_error( mysqli_connect_error(  ), '1' );
      }
     $this->mysql_version = mysqli_get_server_info( $this->db_object );
     mysqli_query( $this->db_object, "SET NAMES '" . COLLATE . "'" );
     mysqli_set_charset( $this->db_object, "utf8" );
     return true;
     }

    https://profiphp.ru/useful/class_mysqli.html
    немного ООП ПХП

    MAKAKA, 22 Апреля 2020

    Комментарии (28)
  10. Perl / Говнокод #26407

    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
    $the_cow = <<EOC;
          $thoughts
           $thoughts                            @@@###==#######@#@@@@@@@@@@@@
                                       @@@###====***====##########@@@@#
                                       @@@###===***++********===###@@@#
                                      #@@###==*****+++++++++**===##@@@#
                                      =@@#####==****++++++++***==###@@@
                                     #@@=##======*++*+++++***===###@@#
                                     #@#===###===#**+++++*+***==###@#
                                     @###**#=*++==#=****==#===####@@#
                                    ##====**==***+==++==##@###=###@@#
                     ###=====***=######====*******==*+*=*+***=##=###
                ###====******+++*=#####===******===**==*****====##
              #===*******++++++++=######==******#=***==******==##
            #===******+++++++++++*=#####==**+++=#=*+*==****==####
          #===****++++++++++++++++*=####=**++++**=====*+***==###=###
        ##==****++++++++++++++++++*=####===***===*=*=**+***==##**===###
       ##==***++++++++++++++++++++*#######=======*====****==##=***====###
      ##==***+++++++++++++++:+++++*######===#@@@@@@##=====##===****=====##
      #===***++++++++++++++++++++*=########===@@@@@@@######=====**++*=====##@@
     ##===*****++*++++++++++++++**=####@@@@@##=====####@##=======******====###
    ###===***********+++++++++++***=####@#@######=##@@###===#===*********====#
    ##====*************+*****+******=###@@#@##@##@@@####======*****+******====
    ###===***************************=##@@@@@@@@######=======****++++*+****===
    @##=====**************************===#########=#========*****++++++++**===
    ###======*********************========######================**********====
    ####=======****=**********==================================**=*==***=====
    ####============***====*=======================================*=**======#

    Пахом для cowsay

    ExModE, 03 Февраля 2020

    Комментарии (28)
  11. PHP / Говнокод #26000

    +1

    1. 1
    SCRIPT="<?php http_response_code(429); ob_clean(); //" php -S localhost:80 /proc/self/environ

    sql injection is for kids, grownups use environment variable injection

    Fike, 28 Октября 2019

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