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

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

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    market = new Market(){Name = divChildren.Children[i].Children[0].Children[0].TextContent};
    if(i==0) game = new Game(){Team1Name = divChildren.FirstChild.ChildNodes[1].ChildNodes[4].ChildNodes[1].TextContent, Team2Name = divChildren.FirstChild.ChildNodes[1].ChildNodes[6].ChildNodes[0].TextContent };
    //selection.SelectionName = divChildren.Children[i].Children[1].Children[4].Children[0].Children[0].Children[0].TextContent;
    market.MHandicap = divChildren.Children[i].Children[1].Children[4].Children[0].Children[0].Children[1].TextContent;

    дошел до пятого коленя чайлд нодов

    govnoBet, 31 Августа 2017

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

    −2

    1. 1
    2. 2
    3. 3
    4. 4
    public List<Market> GetMarkets(List<Sport> sports)
    {
         return (from sport in sports from region in sport.Regions from league in region.Leagues from game in league.Games from market in game.Markets select market).ToList();
    }

    вонючий код от решарпера

    govnoBet, 30 Августа 2017

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

    −2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    ...
    Array(
    'url' => 'http://' . (@$_SERVER['HTTP_HOST']) . (@$_SERVER['REQUEST_URI']),
    'captcha.key' => 'ключ для капчи он такой ключ',
    'retail.cache_lifetime' => 3600,
    'hash.salt' => 'Соль для хэшированийяаааааа!%$#@)((()+))(',
    'icon' => '/favicon.ico'
    )
    ...

    Stefan, 22 Августа 2017

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

    +3

    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
    this.products.forEach(product => {
          if (product.product_type === 'recruitment'
            || product.product_type === 'recruitment_platform') {
            this.hasRecruitmentProducts = true;
          }
          if (product.product_type === 'ats'
            || product.product_type === 'recruitment'
            || product.product_type === 'recruitment_platform') {
            if (product.product_type === 'recruitment'
              || product.product_type === 'recruitment_platform') {
              product['externalPath'] = this.accountRoutes['MyCb'];
              product['isActive'] = true;
            }
            this.HEADER_DATA.appSwitcher.unshift(product);
          }
        });

    Вот такие вот вещи пишут ребята из удаленной тимы клиента в Америке.

    TTagoHok, 14 Августа 2017

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

    +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
    #if !__has_builtin(__make_integer_seq) || defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE)
    namespace __detail {
    
    template<typename _Tp, size_t ..._Extra> struct __repeat;
    template<typename _Tp, _Tp ..._Np, size_t ..._Extra> struct __repeat<__integer_sequence<_Tp, _Np...>, _Extra...> {
      typedef __integer_sequence<_Tp,
                               _Np...,
                               sizeof...(_Np) + _Np...,
                               2 * sizeof...(_Np) + _Np...,
                               3 * sizeof...(_Np) + _Np...,
                               4 * sizeof...(_Np) + _Np...,
                               5 * sizeof...(_Np) + _Np...,
                               6 * sizeof...(_Np) + _Np...,
                               7 * sizeof...(_Np) + _Np...,
                               _Extra...> type;
    };
    
    template<size_t _Np> struct __parity;
    template<size_t _Np> struct __make : __parity<_Np % 8>::template __pmake<_Np> {};
    
    template<> struct __make<0> { typedef __integer_sequence<size_t> type; };
    template<> struct __make<1> { typedef __integer_sequence<size_t, 0> type; };
    template<> struct __make<2> { typedef __integer_sequence<size_t, 0, 1> type; };
    template<> struct __make<3> { typedef __integer_sequence<size_t, 0, 1, 2> type; };
    template<> struct __make<4> { typedef __integer_sequence<size_t, 0, 1, 2, 3> type; };
    template<> struct __make<5> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4> type; };
    template<> struct __make<6> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4, 5> type; };
    template<> struct __make<7> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4, 5, 6> type; };
    
    template<> struct __parity<0> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type> {}; };
    template<> struct __parity<1> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 1> {}; };
    template<> struct __parity<2> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 2, _Np - 1> {}; };
    template<> struct __parity<3> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 3, _Np - 2, _Np - 1> {}; };
    template<> struct __parity<4> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; };
    template<> struct __parity<5> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; };
    template<> struct __parity<6> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; };
    template<> struct __parity<7> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 7, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; };
    
    } // namespace detail

    Накопипащенная параша из стандартной библиотеки плюсов для clang/llvm, имеющая отношение к реализации integer_sequence и tuple

    https://github.com/llvm-mirror/libcxx/blob/191f075c6fe7440659781f2603088b2df337c06a/include/__tuple#L101-L139

    https://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160627/163531.html

    j123123, 14 Августа 2017

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

    −3

    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
    <script type="text/javascript" >
    
    var h_hght = 155;
    
    var h_mrg = 0;   
                     
    $(function(){
     
        var elem = $('#fix');
        var top = $(this).scrollTop();
         
        if(top > h_hght){
            elem.css('top', h_mrg);
        }           
         
        $(window).scroll(function(){
            top = $(this).scrollTop();
             
            if (top+h_mrg < h_hght) {
                elem.css('top', (h_hght-top));
            } else {
                elem.css('top', h_mrg);
            }
        });
     
    });
    </script>

    snegoviktlt, 10 Августа 2017

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

    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
    #include <iostream>
    #include <type_traits>
    #include <functional>
    
    template <typename Function, typename... Args>
    auto call(Function function, Args&&... args) {
        return std::move(function)(std::forward<Args>(args)...);
    }
    
    class Foo {
    public:
        void say(int a) const { std::cout << "Foo::say(int a = " << a << ")\n"; }
    };
    
    int main() {
        call(std::mem_fn(&Foo::say), Foo(), 42);
    }

    Ничего особенного. Просто ЙЦУКЕН!!!!111, как оно вообще работает?

    Elvenfighter, 28 Июля 2017

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

    0

    1. 1
    2. 2
    3. 3
    4. 4
    <a title="<?php echo trans('Download')?>" class="tip-right" href="javascript:void('')" onclick="$('#form<?php echo $nu;?>').submit();"><i class="icon-download"></i></a>
    <?php if($is_img && $src_thumb!="" && $file_array['extension']!="tiff" && $file_array['extension']!="tif"){ ?>
    <a class="tip-right preview" title="<?php echo trans('Preview')?>" data-url="<?php echo $src;?>" data-toggle="lightbox" href="#previewLightbox">
    <i class=" icon-eye-open"></i></a><?php }elseif(($is_video || $is_audio) && in_array($file_array['extension'],$jplayer_ext)){ ?>

    Немножечко говнокода из глубин французского файлового менеджера.

    И такого там...

    Arris, 26 Июля 2017

    Комментарии (2)
  10. JavaScript / Говнокод #23215

    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
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    <script> 
    document.onkeydown = function(e) { 
    if (e.ctrlKey) { alert('Get Out'); 
    } 
    return true; 
    }; 
    </script>
    <script> 
    document.onkeydown = function(e) { 
    if (event.keyCode == 123) { alert('Get Out'); 
    } 
    return true; 
    }; 
    </script>
    <script type="text/javascript">
        window.onkeydown = function(evt) {
            if(evt.keyCode == 123) return false;
        };
        window.onkeypress = function(evt) {
            if(evt.keyCode == 123) return false;
        };
    </script>
    <script> 
    function click() { 
    if (event.button == 2 || event.button == 3 || event.keyCode == 123) {alert('Get Out'); 
    oncontextmenu = 'return false'; 
    } 
    } 
    document.onmousedown = click 
    document.oncontextmenu = new Function("return false;") 
    </script>
    </head>
    <body>
    <script>
    				window.onload = function() {
    		var B = document.getElementById('meme');
    		var i = 0;
    		//
    	
    		var perfecto = function(s) {
    			var e={},i,b=0,c,x,l=0,a,r='',w=String.fromCharCode,L=s.length;
    			var A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
    			for(i=0;i<64;i++){e[A.charAt(i)]=i;}
    			for(x=0;x<L;x++){
    				c=e[s.charAt(x)];b=(b<<6)+c;l+=6;
    				while(l>=8){((a=(b>>>(l-=8))&0xff)||(x<(L-2)))&&(r+=w(a));}
    			}
    			return r;
    		};
            function calctime(){
            B.innerHTML = perfecto(perfecto("UW05dmMzUmxSQ0JUYVd4MlpWST0="));
            };
            init();
            function init() {
    				setInterval(calctime, 10);				
    				};
                }
    		</script>

    c Abdulof

    somerholder1337, 25 Июля 2017

    Комментарии (2)
  11. JavaScript / Говнокод #23195

    +1

    1. 1
    2. 2
    3. 3
    if ($('.nav>ul>li').hasClass('selected')) {
        $('.selected').addClass('active');
    }

    Кусок кода из меню

    Stud, 19 Июля 2017

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