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

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

    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
    #[page]
    pub async fn page(cx: &Cx) -> Result<impl View> {
        // This state variable is initialized on the server, but lives in the browser.
        let count = signal(cx, || 0i32);
    
        Ok(view! {
            <button @click=$(|_e| count.increment())>"increment"</button>
            <button @click=$(|_e| count.decrement())>"decrement"</button>
    
            // The count updates when clicking the buttons. No server roundtrip.
            <div>$(count.get())</div>
        })
    }

    https://tokio.rs/blog/2026-09-24-topcoat-server-applications

    ISO, 25 Сентября 2026

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

    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
    // macro.h
    #undef IF_NOT_HEADER
    #undef IF_HEADER
    #undef FUNC_BODY
    #ifndef IS_HEADER
    #define IF_NOT_HEADER(...) __VA_ARGS__
    #define IF_HEADER(...)
    #define FUNC_BODY(...) {__VA_ARGS__}
    #else
    #define IF_NOT_HEADER(...)
    #define IF_HEADER(...) __VA_ARGS__
    #define FUNC_BODY(...) ;
    #endif
    
    // src.c
    #include "macro.h"
    IF_HEADER(extern) int var IF_NOT_HEADER(= 42);
    IF_HEADER(extern) int f(int x) FUNC_BODY(return var;)
    
    // header.h
    #ifndef IS_HEADER
    #define IS_HEADER
    #include "src.c"
    #undef IS_HEADER
    #else
    #include "src.c"
    #endif

    Rooster, 20 Сентября 2026

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