1. Си / Говнокод #17396

    +135

    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
    /*
         * Lack of time prevents me from writing this segment properly.
         * May Krishna have mercy on my soul.
         */
        static const uint32_t pal            = 720 * 576 * 2;
        static const uint32_t ntsc_composite = 720 * 507 * 2;
        static const uint32_t ntsc_sdi       = 720 * 480 * 2;
        uint16_t new_width = width, new_height = height;
    
        if (height == 0) {
            new_width = 1920;
            new_height = 1080;
        }
    
        if (format == PAL) {
            rv = pal;
            memset(out_payload, 0x3F, rv);
        }
        else if (format == NTSC) {
            if (source == SDI_VIDEO) {
                rv = ntsc_sdi;
                memset(out_payload, 0x3F, rv);
            }
            else {
                rv = ntsc_composite;
                memset(out_payload, 0x3F, rv);
            }
        }
        else {
            rv = new_width * new_height * 2;
            memset(out_payload, 0x3F, rv);
        }

    Вот что переизбыток мочи делает.

    codemonkey, 31 Декабря 2014

    Комментарии (5)
  2. Куча / Говнокод #17395

    +137

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    void main()
    {
      printf("HAPPY NEW YEAR!");
      printf("Forever alone! Vodka!");
      Sleep(INFINITE);
    }

    LispGovno, 31 Декабря 2014

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

    +154

    1. 1
    <input type="submit" name="sub" value="регистрация" class="buttom2_activ" onmouseover="this.className='buttom2_activ'" onmouseout="this.className='buttom2'">

    CSS :hover, лол

    heyzea1, 31 Декабря 2014

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

    +97

    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
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    using System;
    using Microsoft.Win32;
     
    namespace Reester
    {
        class Program
        {
            static void Main(string[] args)
            {
                RegCreatySubKey();
            }
     
            private static void RegCreatySubKey()
            {
                RegistryKey regKey = Registry.LocalMachine;
                string[] shell = new[] { "SOFTWARE", "Microsoft", "Windows", "CurrentVersion", "Explorer", "CommandStore", "shell" };
     
                string prog = "Programma";
    1)            using (regKey = Registry.LocalMachine.OpenSubKey(shell[0],true))// тут regKey равно{HKEY_LOCAL_MACHINE}
    2)                {                                                    //сдеть уже regKey   равно {HKEY_LOCAL_MACHINE\SOFTWARE}
     
     
    3)                    if (regKey != null)//и тут уже regkey равно Null.А дальше программа не идет.
                        {
                            using (regKey = Registry.LocalMachine.OpenSubKey(shell[1], true))
                            {
                                if (regKey != null)
                                {
                                    using (regKey = Registry.LocalMachine.OpenSubKey(shell[2], true))
                                    {
                                        if (regKey != null)
                                        {
                                            using (regKey = Registry.LocalMachine.OpenSubKey(shell[3], true))
                                            {
                                                if (regKey != null)
                                                {
                                                    using (regKey = Registry.LocalMachine.OpenSubKey(shell[4], true))
                                                    {
                                                        if (regKey != null)
                                                        {
                                                            using (regKey = Registry.LocalMachine.OpenSubKey(shell[5], true))
                                                                
                                                            {
                                                                if (regKey != null)
                                                                {
                                                                    using (regKey = Registry.LocalMachine.OpenSubKey(shell[6], true))
                                                                    {
                                                                        if (regKey != null)
                                                                        {
                                                                            regKey.CreateSubKey(prog);
                                                                        }
                                                                    }
                                                                 }
     
                                                              }
                                                          }
                                                      }
                                                    }
                                                 }
                                               }
                                            }
                                          }
                                        }
                                     }
                                  }
                              }
                        
                       }
                  }

    Работаем с реестром

    Psilon, 31 Декабря 2014

    Комментарии (15)
  5. Куча / Говнокод #17392

    +127

    1. 1
    alias Foo(V : V[]) = V;

    dlang, угадайте, что этот код делает.

    DlangGovno, 31 Декабря 2014

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

    +57

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    /* Fix NAN constant for VisualC++. */
       #ifdef _MSC_VER
          #ifndef NAN
              static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff};
              #define NAN (*(const float *) __nan)
          #endif
       #endif

    ????

    Pythoner, 30 Декабря 2014

    Комментарии (22)
  7. PHP / Говнокод #17390

    +162

    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
    if ($n > '25') {
        $list = floor($n / 25) + 1;
        $str .= '<div id="srt_page" align="center">';
        for ($q = 1; (($q) <= $list); $q++) {
            if ((((isset($_GET['page'])) && ($_GET['page'] == $q)) || ((!isset($_GET['page'])) && ($q == 1))))
                $str .= ' <b>' . $q . '</b> ';
            else {
                if ((($q == ($pg - 1)) && (($pg - 1) != 1) && (($pg - 1) != $list)) || (($q == ($pg - 2)) && (($pg - 2) != 1) && (($pg - 2) != $list)) || (($q == ($pg - 3)) && (($pg - 3) != 1) && (($pg - 3) != $list)) || (($q == ($pg - 4)) && (($pg - 4) != 1) && (($pg - 4) != $list)) || (($q == ($pg + 1)) && (($pg + 1) != 1) && (($pg + 1) != $list)) || (($q == ($pg + 2)) && (($pg + 2) != 1) && (($pg + 2) != $list)) || (($q == ($pg + 3)) && (($pg + 3) != 1) && (($pg + 3) != $list)) || (($q == ($pg + 4)) && (($pg + 4) != 1) && (($pg + 4) != $list)) || ($q == $list) || ($q == 1)) {
                    if (($q == $list) && (($pg + 4) < ($list - 1)))
                        $str .= '...';
                    $str .= ' <a class="link_page" href="?page=' . $q . '"> ' . $q . ' </a> ' . "\n";
                    if (($q == 1) && (($pg - 4) > 2))
                        $str .= '...';
                }
            }
        }
        $str .= '</div>';
    }
    return $str;

    Кто не понял, это такой pagination %))

    AgentSIB, 30 Декабря 2014

    Комментарии (1)
  8. Java / Говнокод #17389

    +74

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    private void showProgress() {
        if(mIndProgressVisible && mIndProgress != null && mIndProgress.isShowing()) return;
        if(!mIndProgressVisible && (mIndProgress == null || !mIndProgress.isShowing())) return;
    
        ...
    }

    Не ходите, дети, в Африку гулять

    StanDalone, 30 Декабря 2014

    Комментарии (2)
  9. C# / Говнокод #17388

    +96

    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
    _catalogDb.Categories
                     .Where(w => w.Resources.Where(r => _catalogDb.Resources
                        .Where(a => _catalogDb.Persons.Where(b => b.EmployeeNumber == employeeNumber)
                            .Select(c => c.VIP).FirstOrDefault() || !a.VIP)
                     .Where(a => _catalogDb.Persons.Where(b => b.EmployeeNumber == employeeNumber)
                         .Select(c => c.InnerEmployee).FirstOrDefault() || !a.InnerEmployee)
                     .Where(a => !a.Paths.Any()
                         || a.Paths.Where(wer => wer.Name == null).Any()
                            || a.Paths.Where(pt => pt.Name != null && _catalogDb.Persons
                                .Where(b => b.EmployeeNumber == employeeNumber)
                                    .Select(c => c.Path).FirstOrDefault().Contains(pt.Name)).Any())
                     .Where(a => !a.Filials.Any() || a.Filials.Where(wer => wer.Code == null).Any() || a.Filials
                         .Where(pt => pt.Code != null && pt.Code == _catalogDb.Persons
                             .Where(b => b.EmployeeNumber == employeeNumber)
                                .Select(c => c.Filial).FirstOrDefault()).Any())
                     .Select(a => a.UNID).Contains(r.UNID)).Any())
                        .Select(s => s.ID).Distinct().ToList();

    Кто сказал что Entity framework облегчает жизнь...

    SuperCuke, 30 Декабря 2014

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

    +51

    1. 1
    static void operator()(int atan)

    Wat?

    LispGovno, 30 Декабря 2014

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