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

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

    +1

    1. 1
    2. 2
    3. 3
    use Unicornify::URL;
     
    my $url = unicornify_url( email => '[email protected]' );

    https://metacpan.org/pod/Unicornify::URL

    PACTPOBblu_nemyx, 30 Октября 2019

    Комментарии (78)
  3. 1C / Говнокод #26004

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    Функция УбратьПробел(стрЧисло)
    	//убирает пустой пробел
    	нСтр = "";
    	Для п=1 По СтрДлина(стрЧисло) Цикл
    		р = Сред(стрЧисло,п,1);
    		Если р = "1" ИЛИ р = "2" ИЛИ р = "3" ИЛИ р = "4" ИЛИ р = "5" ИЛИ р = "6" ИЛИ р = "7" ИЛИ р = "8" ИЛИ р = "9" ИЛИ р = "0" ИЛИ р = "," Тогда
    			нСтр = нСтр+р;
    		КонецЕсли;
    	КонецЦикла;
    	Возврат нСтр;
    КонецФункции

    Senior

    sandvich, 30 Октября 2019

    Комментарии (37)
  4. Perl / Говнокод #26003

    +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
    #!/usr/bin/perl
    
    # Fetch all JS from govno
    use strict;
    use warnings FATAL => 'all';
    use LWP;
    
    my $res = LWP::UserAgent->new->request(HTTP::Request->new("GET" => "http://govnokod.xyz/"));
    die "Failed: " . $res->code unless $res->is_success;
    
    for (split /\n/, $res->content) {
        print if /<script/ ... /script>/ and !m/[<>]/;
    }

    кууик.

    Официальный тред для ржания над пятым перлом

    MAKAKA, 29 Октября 2019

    Комментарии (43)
  5. Python / Говнокод #26001

    +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
    import re, copy, json
    
    config = {}
    
    
    def domain_mapper(domain):
    	def injector(f):
    		if domain not in config:
    			config[domain] = []
    		config[domain].append(f)
    	return injector
    
    def default(f):
    	config['default'] = [f]
    	return f
    
    @domain_mapper("gmail.com")
    @default
    def google_filter(content):
    	regex = r"([^\!\?\.]*?offer.*?[\!\?\.])"
    	repl = r""
    	return re.sub(regex, repl, content, re.M)
    
    @domain_mapper("gmail.com")
    def another_google_filter(content):
    	return content
    
    @domain_mapper("yandex.ru")
    def yandex_filter(content):
    	regex = r"<img src=[\"'](.+?)[\"'].*/>"
    	repl = r"\1"
    	return re.sub(regex, repl, content, re.M)
    
    @domain_mapper("mail.ru")
    def mail_filter(content):
    	regex = r"<img src=[\"'](.+?)\.gif[\"'].*/>"
    	repl = r"<img src='\1.png'/>"
    	return re.sub(regex, repl, content, re.M)

    Говно или нет?

    miwomare, 28 Октября 2019

    Комментарии (85)
  6. 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)
  7. Java / Говнокод #25998

    +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
    import java.util.Scanner;
    
    public class ComputeTax {
    
    public static void main(String[] args) {
    // Create a Scanner
    Scanner input = new Scanner(System.in);
    
    // Prompt the user to enter filing status
    System.out.print(
        "(0-single filer, 1-married jointly or qualifying widow(er)",
        + "\n2-married separately, 3-head of household)\n" +
        "Enter the filing status: ");
    int status = input.nextInt();
    
    // Prompt the user to enter taxable income
    System.out.print("Enter the taxable income: ");
    double income = input.nextDouble();
    
    // Compute tax
    double tax = 0;
    
    if (status == 0) {// Compute tax for single filers
        if (income <= 8350)
              tax = income * 0.10;
        else if (income <= 33950)
              tax = 8350 * 0.10 + (income - 8350) * 0.15;
        else if (income <= 82250)
              tax = 8350 * 0.10 + (33950 - 8350) * 0.15 +
             (income - 33950) * 0.25;
        else if (income <= 171550)
              tax = 8350 * 0.10 + (33950 - 8350) * 0.15 +
             (82250 - 33950) * 0.25 + (income - 82250) * 0.28;
        else if (income <= 372950)
              tax = 8350 * 0.10 + (33950 - 8350) * 0.15 +
              (82250 - 33950) * 0.25 + (171550 - 82250) * 0.28 +
              (income - 171550) * 0.33;
        else
              tax = 8350 * 0.10 + (33950 - 8350) * 0.15 +
             (82250 - 33950) * 0.25 + (171550 - 82250) * 0.28 +
             (372950 - 171550) * 0.33 + (income - 372950) * 0.35;
    }
    else if (status == 1) {
    // Left as exercise
    // Compute tax for married file jointly or qualifying widow(er)
    }
    else if (status == 2) {
    // Compute tax for married separately
    // Left as exercise
    }
    else if (status == 3) {
    // Compute tax for head of household
    // Left as exercise
    }
    else {
        System.out.println("Error: invalid status");
        System.exit(1);
    }
    // Display the result
    System.out.println("Tax is " + (int)(tax * 100) / 100.0);
    
    }

    Ksyrx, 26 Октября 2019

    Комментарии (52)
  8. JavaScript / Говнокод #25993

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    const getSizeString = (size: number) => {
        const mesuarments = ["Б", "кБ", "МБ", "ГБ"];
        let i = 0;
        for (; size/1024 > 1; size /= 1024, i++)
            ;
    
        return ${Math.floor(size) === size ? size : (size).toFixed(1)} ${mesuarments[i]};
    }

    m_sandman, 25 Октября 2019

    Комментарии (3)
  9. Python / Говнокод #25986

    +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
    class Container:
        def __init__(self, liquid):
            self.liquid = liquid
    
        def look_inside(self):
            return f"{self.liquid} in container"
    
        @classmethod
        def create_with(cls, liquid):
            return cls(liquid)
    
    
    class Bottle(Container):
        def look_inside(self):
            return f"bottle full of {self.liquid}"
    
    
    class Glass(Container):
        def look_inside(self):
            return f"A glass of {self.liquid}"
    
    
    for c in (c.create_with("beer") for c in [Glass, Bottle]):
        print(c.look_inside())

    ми маємо class polymorphism

    DypHuu_niBEHb, 23 Октября 2019

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    <p oncopy="return false" ondragstart="return false"></p>
    <p oncopy="return false" ondragstart="return false"></p>
    <p oncopy="return false" ondragstart="return false"></p>
    <p oncopy="return false" ondragstart="return false"></p>
    <p oncopy="return false" ondragstart="return false"></p>
    <p oncopy="return false" ondragstart="return false"></p>
    <p oncopy="return false" ondragstart="return false"></p>
    <p oncopy="return false" ondragstart="return false"></p>
    <p oncopy="return false" ondragstart="return false"></p>

    Защита контента для самых маленьких

    bootcamp_dropout, 22 Октября 2019

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

    +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
    #include <cstdio>
    
    class tag;
    
    template<class>
    struct type { friend constexpr auto get(type); };
    
    template<class TKey, class TValue>
    struct set { friend constexpr auto get(TKey) { return TValue{}; } };
    
    void foo() {            // never called
      if constexpr(false) { // never true
        if (false) {        // never true
            constexpr auto call = [](auto value) { std::printf("called %d", value); };
            void(set<type<tag>, decltype(call)>{});
        }
      }
    }
    
    int main() {
      get(type<tag>{})(42); // prints called 42
    }

    https://twitter.com/krisjusiak/status/1186363017329594368
    Какой C++20 )))

    j123123, 21 Октября 2019

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