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

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

    +150

    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
    <?php
    
    function DaysDiff($d1,$d2){
    	$d2=1+strtotime($d2);
    	$d1=1+strtotime($d1);
    	
    	return floor(($d2-$d1)/86400);
    }
    
    ?>
    
    а надо бы:
    
    <?php
    
    function DaysDiff($d1,$d2){
    	return bcdiv(strtotime($d2)-strtotime($d1),86400);
    }
    
    ?>

    ferry-very-good, 08 Сентября 2010

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

    +156

    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
    <?php
    	
    	class Train {
    		
    		private $strFrom;
    		private $strTo;
    		private $strName;
    		....................................
    		
    		public function __construct($arrParameters) {
    			$objThis = $this;
    			
    			$objThis->strFrom = $arrParameters['strFrom'];
    			$objThis->strTo   = $arrParameters['strTo'];
    			$objThis->strName = $arrParameters['strName'];
    			
    			................................
    			
    			$intCount = count($arrParameters);
    			for ($intI = 0; $intI < $intCount; $intI++) {
    				............................
    			}
    			
    			................................
    			
    			foreach ($arrParameters as $strKey => $mixedValue) {
    				............................
    			}
    		}
    		
    		....................................
    	}

    Интересно ваше мнение о венгерской нотации

    doroshenkoes, 05 Июля 2010

    Комментарии (48)
  4. Куча / Говнокод #3375

    +132

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    <table width="500" height="10">
    <td>
     <br>
    
    </tr>
    </table>

    Дипломная работа... no comments

    Sinless, 02 Июня 2010

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

    +940.8

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    bool checkForExe(std::string ext)
    {
        return ext==".exe" ? true : 
                  ext==".Exe" ? true :
                  ext==".eXe" ? true :
                  ext==".EXe" ? true :
                  ext==".exE" ? true :
                  ext==".ExE" ? true :
                  ext==".eXE" ? true :
                  ext==".EXE" ? true : false;
    }

    Нашел в одной моей очень древней программе-шутке. Регистронезависимая проверка на расширение .exe.

    frp, 29 Марта 2010

    Комментарии (48)
  6. Go / Говнокод #28254

    +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
    package main
    
    import "log"
    
    func foo(x int) (int, error) {
        return x + 1, nil
    }
    
    func main() {
        x := 5
        if x % 2 == 1 {
            x, err := foo(x)
            if err != nil {
                log.Fatalf("Error")
            }
            log.Println(x)
        }
        log.Println(x)
    }

    Счастливой отладки, суки.

    https://godbolt.org/z/6GWsq7W7q

    3_dar, 29 Июня 2022

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

    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
    import ballerina/auth;
    import ballerina/config;
    import ballerina/http;
    import ballerina/log;
    
    auth:InboundBasicAuthProvider basicAuthProvider = new;
    http:BasicAuthHandler basicAuthHandler = new (basicAuthProvider);
    
    listener http:Listener ep = new (9090, config = {
        auth: {
            authHandlers: [basicAuthHandler]
        },
    
        secureSocket: {
            keyStore: {
                path: config:getAsString("b7a.home") +
                      "/bre/security/ballerinaKeystore.p12",
                password: "ballerina"
            }
        }
    });
    
    @http:ServiceConfig {
        basePath: "/hello",
        auth: {
            scopes: ["scope1"]
        }
    }
    
    service echo on ep {
    
        @http:ResourceConfig {
            methods: ["GET"],
            path: "/sayHello",
            auth: {
                scopes: ["scope2"]
            }
        }
    
        resource function hello(http:Caller caller, http:Request req) {
            error? result = caller->respond("Hello, World!!!");
            if (result is error) {
                log:printError("Error in responding to caller", result);
            }
        }
    }

    Кто что думает про https://ballerina.io?

    Desktop, 19 Апреля 2020

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

    +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
    setTimeout(function(){
            document.getElementById('message').innerHTML = 'Это окно браузера закончило свою работу и может быть закрыто.' +
                '<br>' +
                '<button onclick="window.close()">Закрыть окно</button>';
        },3000);
    
            function objectValues(obj) {
                var res = [];
                for (var i = 0; i < obj.length; i++) {
                    if (obj.hasOwnProperty(i)) {
                        res.push(obj[i]);
                    }
                }
                return res;
            }
    
            sendMessage = function () {
                var args = objectValues(arguments),
                    func = args.splice(1,1);
                if (typeof window.postMessage !== 'undefined') {
                    window.opener.postMessage({
                        mine: 'uLogin',
                        func: func,
                        args: args
                    }, '*');
                } else {
                    sendMessage = function () {
                        window.opener[func].apply(null, args);
                    };
                }
            };
    
            if(/fill.php/.test("'ffdfdssdffsdfewfewfewfwf','redirect','https://dfssfd/login.php'")) {
                try{
                    if(typeof window.opener.fill !== 'undefined') {
                        window.opener.fill('869becd1b998ec0add011915c7f4022e','redirect','https://asdasd/login.php');
                    } else {
                        sendMessage('869becd1b998ec0add011915c7f4022e','redirect','https://biglike.org/login.php');
                    }
                } catch(e){
                    sendMessage('869becd1b998ec0add011915c7f4022e','redirect','https://asdas/login.php');
                }
            } else {
                sendMessage('869becd1b998ec0add011915c7f4022e','redirect','https://sfdsfd/login.php');
            }
    
        window.close();

    ulogin которым пользуются миллионы

    codershitter, 02 Декабря 2019

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

    −1

    1. 1
    https://www.youtube.com/watch?v=lfdAwl3-X_c

    OlegUP, 30 Августа 2019

    Комментарии (47)
  10. Си / Говнокод #25593

    +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
    #define paehal int i = 0; char arr[30000]; memset(arr, 0, sizeof(arr));
    #define go i++;
    #define  nozad i--;
    #define plusegg arr[i]++;
    #define minusegg arr[i]--; 
    #define vivodeg putchar(arr[i]);	
    #define tipavhile while(arr[i]){	
    #define nevhile }
    int main() {
    setlocale(0, "");
    paehal
    plusegg plusegg plusegg plusegg plusegg tipavhile plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg  go nozad minusegg nevhile go vivodeg go plusegg plusegg plusegg tipavhile go plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg go minusegg nevhile go vivodeg 
    return 0;
    }

    брайнфак на минималках
    выводит a!

    pozhiloy, 07 Мая 2019

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

    +1

    1. 1
    2. 2
    #include <type_traits>
    int main() { return std::is_assignable_v<int, int>; }

    --> 0

    WTF?

    Elvenfighter, 17 Апреля 2019

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