1. JavaScript / Говнокод #14200

    +157

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    var infoDiv = "<div id='fastInfo' style='font-size:16px !important;padding: 6px;padding-bottom:10px; z-index:1000000;position:fixed;top:20%;width:3px;right:0;background:white;border: 1px solid green;border-right:0;'></div>";
    $('#navi').before(infoDiv);
    var ggwp = $('a[href*="user_info="]');
    $.each(ggwp, function(index, value) {
    	value.setAttribute("onmouseenter", "$('#fastInfo').animate({'width': '300px'}, 200);function received(data) { if ($($(data).find('.gradient_block1:has(\"table\")')[0]).html() == undefined) {dtxs = $($(data).find('.stnd_padd:has(\"table\")')[0]).html().replace('img', 'xuimg');} else {dtxs = $($(data).find('.gradient_block1:has(\"table\")')[0]).html().replace('img', 'xuimg');}	$('#fastInfo').html('<span style=\"font-size:small\">' + dtxs + '<hr style=\"border:0;height:1px;background-color:black;margin:6px;color:black\" /><div style=\"padding-left:13px\">' + $($(data).find('.bottom_link_block')[0]).html() + '</div><hr style=\"border:0;height:1px;background-color:black;margin:6px;color:black\" /><div style=\"padding-left:13px;font-size:small\">' + $($(data).find('.blue_border_bottom')[0]).html().replace(/padding-bottom:10px;/gim, ''));}$.ajax({'url': 'http://spaces.ru/anketa/?name=" + value.href.match(/user_info=([a-zA-Z0-9\-\_]+)/gim)[0].replace("user_info=", "") + "', success: received});");
    	value.setAttribute("onmouseleave", "$('#fastInfo').animate({'width': '3px'}, 200);function clrscr() {$('#fastInfo').html('');} setTimeout(clrscr, 200);");
    });

    Ребят, это диагноз?
    Навесить обработчик через .on/.bind/.live не смог.

    Efog, 09 Декабря 2013

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

    +122

    1. 1
    2. 2
    3. 3
    Не смог выделить 100 строк, объединённых общей логикой, да и всей картины это бы не передавало.
    Для любителей покопаться в. 
    Ссылка в описании.

    https://github.com/KustoSoft/ru2ch-toolset
    © Корпорация KustoSoft

    jsgovno, 08 Декабря 2013

    Комментарии (24)
  3. Java / Говнокод #14198

    +78

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    public class LocalizedMatcher implements Matcher, ContainsExtraTypeInformation, CapturesArguments, MatcherDecorator, Serializable {
    
        ...
     
        public void _dont_implement_Matcher___instead_extend_BaseMatcher_() {
            // yeah right
        }
    
        ...
    
    }

    Порадовал именно коммент :)

    myzone, 08 Декабря 2013

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

    +9

    1. 1
    #   define BOOST_MPL_AUX_NTTP_DECL(T, x) T x

    Очень интересный стайлгайд Алексей Гуртового

    crastinus, 07 Декабря 2013

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

    +9

    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
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    int numBlock = 0;
        for(int i = 0; i < 16; i++)
            for(int j = 0; j < 25; j++)
            {
    
            if(levelInfo[i][j].active)
            {
            if(levelInfo[i][j].part && levelInfo[i][j].type) continue;
            if(levelInfo[i][j].type)
            {
                tempLevel[numBlock*8  ] = i*24;
                tempLevel[numBlock*8+1] = (j)*24;
                tempLevel[numBlock*8+2] = (i+2)*24;
                tempLevel[numBlock*8+3] = (j)*24;
                tempLevel[numBlock*8+4] = (i+2)*24;
                tempLevel[numBlock*8+5] = (j+1)*24;
                tempLevel[numBlock*8+6] = i*24;
                tempLevel[numBlock*8+7] = (j+1)*24;
            }
            else
            {
                tempLevel[numBlock*8  ] = i*24;
                tempLevel[numBlock*8+1] = (j)*24;
                tempLevel[numBlock*8+2] = (i+1)*24;
                tempLevel[numBlock*8+3] = (j)*24;
                tempLevel[numBlock*8+4] = (i+1)*24;
                tempLevel[numBlock*8+5] = (j+1)*24;
                tempLevel[numBlock*8+6] = i*24;
                tempLevel[numBlock*8+7] = (j+1)*24;
            }
    
            if(levelInfo[i][j].type)
                for(int k = 0; k < 8; k++) tempTex[numBlock*8+k] = coord[0][k];
            else
                for(int k = 0; k < 8; k++) tempTex[numBlock*8+k] = coord[1][k];
            }
            else
            {
            tempLevel[numBlock*8  ] = i*24;
            tempLevel[numBlock*8+1] = (j)*24;
            tempLevel[numBlock*8+2] = (i+1)*24;
            tempLevel[numBlock*8+3] = (j)*24;
            tempLevel[numBlock*8+4] = (i+1)*24;
            tempLevel[numBlock*8+5] = (j+1)*24;
            tempLevel[numBlock*8+6] = i*24;
            tempLevel[numBlock*8+7] = (j+1)*24;
            for(int k = 0; k < 8; k++) tempTex[numBlock*8+k] = coord[2][k];
            }
            numBlock++;
            }
    
        for(int i = 0; i < 2; i++)
            for(int j = 0; j < 3; j++)
            {
                if(!fallBlocks[i][j].active) continue;
                if(fallBlocks[i][j].part && fallBlocks[i][j].type) continue;
                if(!fallBlocks[i][j].type)
                {
                    tempLevel[numBlock*8  ] = (fallPosX+i)*24;
                    tempLevel[numBlock*8+1] = (fallPosY-j)*24;
                    tempLevel[numBlock*8+2] = (fallPosX+i+1)*24;
                    tempLevel[numBlock*8+3] = (fallPosY-j)*24;
                    tempLevel[numBlock*8+4] = (fallPosX+i+1)*24;
                    tempLevel[numBlock*8+5] = (fallPosY-j+1)*24;
                    tempLevel[numBlock*8+6] = (fallPosX+i)*24;
                    tempLevel[numBlock*8+7] = (fallPosY-j+1)*24;
                    for(int k = 0; k < 8; k++) tempTex[numBlock*8+k] = coord[1][k];
                }
                else
                {
                    tempLevel[numBlock*8  ] = (fallPosX+i)*24;
                    tempLevel[numBlock*8+1] = (fallPosY-j)*24;
                    tempLevel[numBlock*8+2] = (fallPosX+i+2)*24;
                    tempLevel[numBlock*8+3] = (fallPosY-j)*24;
                    tempLevel[numBlock*8+4] = (fallPosX+i+2)*24;
                    tempLevel[numBlock*8+5] = (fallPosY-j+1)*24;
                    tempLevel[numBlock*8+6] = (fallPosX+i)*24;
                    tempLevel[numBlock*8+7] = (fallPosY-j+1)*24;
                    for(int k = 0; k < 8; k++) tempTex[numBlock*8+k] = coord[0][k];
                }
                numBlock++;
            }

    Нямка. В унитаз уже не помещается, вылью сюда

    pelmenka, 07 Декабря 2013

    Комментарии (17)
  6. PHP / Говнокод #14193

    +155

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    if ($localize && is_array($results))
    	foreach ($results as $_k => $_row)
    		foreach ((array) $_row as $_rc => $_col)
    			if ($_col_unserialized = unserialize($_col))
    				if (is_array($_col_unserialized))
    					if (isset($_col_unserialized[$_SESSION['language']]))
    						$results[$_k]->{$_rc} = $_col_unserialized[$_SESSION['language']];
    					else
    						$results[$_k]->{$_rc} = array_shift($_col_unserialized);

    fidelcomandante, 07 Декабря 2013

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

    +28

    1. 1
    QVector<double*>*** ElemBoundCond = tbc->getElementsBC();

    Abbath, 06 Декабря 2013

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

    +133

    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
    var firstLocation = new Tuple<Point, Point>(new Point(12, 444 - 38), new Point(30, 446 - 38));
    var secondLocation = new Tuple<Point, Point>(new Point(12, 464 - 38), new Point(30, 464 - 38));
    var thirdLocation = new Tuple<Point, Point>(new Point(12, 486 - 38), new Point(30, 484 - 38));
    
    var first = new Tuple<Control, Control>(chbDimaGaugeNewContractPS, lblDimaGaugeNewContractPS);
    var second = new Tuple<Control, Control>(chbDimaGaugeNewContractIBanking, lblDimaGaugeNewContractIBanking);
    var third = new Tuple<Control, Control>(chbDimaGaugeNewContractActivePS, lblDimaGaugeNewContractActivePS);
    
    var controls = new List<Tuple<Control, Control>> { first, second, third };
    var points = new List<Tuple<Point, Point>> { firstLocation, secondLocation, thirdLocation };
    
    int i = 0;
    
    foreach (var t in controls.Where(x => !x.Item1.Enabled))
    {
      t.Item1.Location = points[i].Item1;
      t.Item2.Location = points[i].Item2;
      i++;
    }

    кортежи в .NET - хорошо или плохо?

    taburetka, 06 Декабря 2013

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

    +16

    1. 1
    2. 2
    3. 3
    function<future<int> (int)> f = [](int a){ cout << a << '\n'; return mreturn(a + 6); };
    int a = (mreturn(5) >>= f).get();
    cout << a;

    HaskellGovno, 06 Декабря 2013

    Комментарии (14)
  10. Java / Говнокод #14188

    +73

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    int k = 0;
    for (int i = 1; i<=str.length(); i++){
      k = i;
    }
    System.out.println("dlina: "+k);

    Счётчик длины строки....

    fedes, 06 Декабря 2013

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