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

    +154

    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
    <script type="text/javascript">
        if (parent && parent != window && (browser.msie || browser.opera || browser.mozilla || browser.chrome || browser.safari || browser.iphone)) {
          document.getElementsByTagName('body')[0].innerHTML = '';
        } else {
          domReady();
          updateMoney(0);
    gSearch.init();
    if (window.qArr && qArr[5]) qArr[5] = [5, "by item", "", "goods", 0x00000100];
    if (browser.iphone || browser.ipad || browser.ipod) {
      setStyle(bodyNode, {webkitTextSizeAdjust: 'none'});
    }
    if (0) {
      hide('support_link_td');
    }
    var ts_input = ge('ts_input'), oldFF = browser.mozilla && parseInt(browser.version) < 8;
    if (browser.mozilla && !oldFF) {
      setStyle(ts_input, {padding: (vk.rtl ? '3px 20px 6px 40px' : '3px 41px 6px 20px')});
    }
    placeholderSetup(ts_input, {back: false, reload: true});
    if (browser.opera || browser.msie || browser.mozilla) {
      setStyle(ts_input, {padding: (vk.rtl ? '4px 20px 5px 40px' : '4px 41px 5px 20px')});
    } else if (browser.chrome || browser.safari) {
      setStyle(ts_input, {padding: (vk.rtl ? '4px 21px 5px 40px' : '4px 40px 5px 21px')});
    }
    
    ...
    
    window.tsHintsEnabled = 1;;setTimeout(function() {  try {    var elem = ge(String.fromCharCode.apply(null,[118,107,98,95,97,100,118]));    if (elem) {      ajax.post('/al_profile.php', {act: 'pro', section: 1, hash: '3f8471898e6269d08b'}, {onDone: function() {}, onFail: function() { return true; }});    }  } catch (e) {}}, 5000);
    __adsLoaded = false;
    
    ...
    
    cur.lang = extend(cur.lang || {}, {
      wall_link_label: 'Link',
      wall_my_friends_only: 'Only your friends can see this post',

    Перестала грузиться понятно какая соцсеточка, от нечего делать опять полез в сорцы html. Вперемешку инициализация поиска, битмаски и какой-то qArr[5], уконтрапупивание всего body по непонятному условию, стилизация, if(0), табуляция в соответствии с каким-то особым стандартом, локализация, вторая половина которой зачем-то подтягивается отдельным файлом. Про установку всех переменных прямо в window явно и неявно молчу.

    Fike, 08 Июля 2014

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

    +28

    1. 1
    2. 2
    // Пароль админа
    const unsigned int AdminPassword = 42;

    Откопал в своем старом коде. Кто тут говорил, что Борманд не говнокодит?

    bormand, 08 Июля 2014

    Комментарии (31)
  3. Куча / Говнокод #16286

    +131

    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
    if (SceneTextureIndex == 0)    return float4(CalcSceneColor(UV), 0);
        else if (SceneTextureIndex == 1)    return ScreenSpaceData.GBuffer.Depth;
        else if (SceneTextureIndex == 2)    return float4(ScreenSpaceData.GBuffer.DiffuseColor, 0);
        else if (SceneTextureIndex == 3)    return float4(ScreenSpaceData.GBuffer.SpecularColor, 0);
        else if (SceneTextureIndex == 4)    return float4(ScreenSpaceData.GBuffer.SubsurfaceColor, 0);
        else if (SceneTextureIndex == 5)    return float4(ScreenSpaceData.GBuffer.BaseColor, 0);
        else if (SceneTextureIndex == 6)    return ScreenSpaceData.GBuffer.Specular;
        else if (SceneTextureIndex == 7)    return ScreenSpaceData.GBuffer.Metallic;
        else if (SceneTextureIndex == 8)    return float4(ScreenSpaceData.GBuffer.WorldNormal, 0);
        else if (SceneTextureIndex == 9)    return 1; // todo
        else if (SceneTextureIndex == 10)    return ScreenSpaceData.GBuffer.Opacity;
        else if (SceneTextureIndex == 11)    return ScreenSpaceData.GBuffer.Roughness;
        else if (SceneTextureIndex == 12)    return ScreenSpaceData.GBuffer.GBufferAO;
        else if (SceneTextureIndex == 13)    return ScreenSpaceData.GBuffer.CustomDepth;
        else if (SceneTextureIndex == 14)    return Texture2DSample(PostprocessInput0, PostprocessInput0Sampler, UV);
        else if (SceneTextureIndex == 15)    return Texture2DSample(PostprocessInput1, PostprocessInput1Sampler, UV);
        else if (SceneTextureIndex == 16)    return Texture2DSample(PostprocessInput2, PostprocessInput2Sampler, UV);
        else if (SceneTextureIndex == 17)    return Texture2DSample(PostprocessInput3, PostprocessInput3Sampler, UV);
        else if (SceneTextureIndex == 18)    return Texture2DSample(PostprocessInput4, PostprocessInput4Sampler, UV);
        else if (SceneTextureIndex == 19)    return Texture2DSample(PostprocessInput5, PostprocessInput5Sampler, UV);
        else if (SceneTextureIndex == 20)    return Texture2DSample(PostprocessInput6, PostprocessInput6Sampler, UV);
        else if (SceneTextureIndex == 21)    return ScreenSpaceData.GBuffer.DecalMask;
        else if (SceneTextureIndex == 22)    return float4(GetLightingModelColor(ScreenSpaceData.GBuffer), 1);
        else if (SceneTextureIndex == 23)    return ScreenSpaceData.AmbientOcclusion;

    LispGovno, 08 Июля 2014

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

    +133

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if chkyandex.Checked then
    	
        reg.Expression:='([a-zA-Z0-9]+[\.]{0,}[\_]{0,}[-]{0,})+@([ya]{2}[ndex]{0,4}|[xaker]{5})\.[a-zA-Z]{2,3}\s{0,4}[:;]\s{0,4}[a-zA-Z0-9\.\_]+'; 
        else
        reg.Expression:='([a-zA-Z0-9]+[\.]{0,}[\_]{0,}[-]{0,})+@([mail]{4}|[inbox]{5}|bk{2}|list{4})\.([a-zA-Z]{2,3}\s{0,4}[:;]\s{0,4}[_\-a-zA-Z\d\.\_]+)';

    RegEXP головного мозга.
    Работает.

    brutushafens, 08 Июля 2014

    Комментарии (23)
  5. Java / Говнокод #16284

    +81

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    public static final String EMPTY_STRING = "";
    public static final String SLASH = "/";
    public static final String BACKSLASH = "\\";
    
    public static final char SLASH_CHAR = '/';
    public static final char CARRIAGE_RETURN_CHAR = '\r';
    public static final char NEW_LINE_CHAR = '\n';
    public static final char LEFT_BRACKET= '[';
    public static final char RIGHT_BRACKET= ']';

    Константа головного мозга.

    pingw33n, 07 Июля 2014

    Комментарии (69)
  6. Java / Говнокод #16283

    +69

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    public static boolean isEmpty(CharSequence str) {
        if (str == null || str.length() == 0)
            return true;
        else
            return false;
    }

    Я считаю это странным
    Нашёл в android.text.TextUtils

    jonasas, 07 Июля 2014

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

    +162

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    function wait($time)
    {
        $tmp_time = time();
        $i = $tmp_time;
        $time = $tmp_time + $time;
        while ($i < $time)
        {
            If (time() != $i) { $i++; }
        }
    }

    Автор сего творения явно не подозревал о существовании функции sleep

    phpcoder, 07 Июля 2014

    Комментарии (91)
  8. PHP / Говнокод #16281

    +166

    1. 1
    2. 2
    3. 3
    function array_min_recursive($arr, &$peaks = array(), $current_key = '') {
      return array_max_recursive($arr, $peaks, $current_key, true); // Неожиданно, правда?
    }

    DIX315, 05 Июля 2014

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

    +127

    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
    boolean loadPPOGroupCompleted(string customerRef, string competence, string marketArea) {
        int i = 0;
        table sceData = getPPOPODGroupSCEs(customerRef, competence, marketArea);
        table dceData = getPPOPODGroupDCEs(customerRef, competence, marketArea);
        table sbilData = getPPOPODGroupSbil(customerRef, competence, marketArea);
        while (i < tableRowCount(sceData)) {
            EventRec sce = convertStoredSCRtoEventRec(false, sceData, i, "", competence);
            if ((string)tableGet(sceData, i, "ACTION_TYPE") == ACTION_REP) {
                udrRoute(sce, "toSE_Agg_rer");
                isReplaceAction = true;
            } else {
                udrRoute(sce, "toSE_Agg_evt");
            }
            i = i+ 1;
        }
        i = 0;
        while (i < tableRowCount(dceData)) {
            EventRec dce = convertStoredDCRtoEventRec(false, dceData, i, "", competence);
            if ((string)tableGet(dceData, i, "ACTION_TYPE") == ACTION_REP) {
                udrRoute(dce, "toSE_Agg_rer");
                isReplaceAction = true;
            } else {
                udrRoute(dce, "toSE_Agg_evt");
            }
            i = i+ 1;
        }
        i = 0;
        while (i < tableRowCount(sbilData)) {
            EventRec sbilEvent = convertStoredSbiltoEventRec(sbilData, i, PPO_ZONALE, competence);
            if ((string)tableGet(sbilData, i, "ACTION_TYPE") == ACTION_REP) {
                udrRoute(sbilEvent, "toSE_Agg_rer");
                isReplaceAction = true;
            } else {
                udrRoute(sbilEvent, "toSE_Agg_evt");
            }
            i = i + 1;
        }
        return true;
    }
    
    boolean loadGroupCompleted(string customerRef, string competence, date minStartDate) {
        table sceData = getGroupSCEs(customerRef, competence);
        table dceData = getGroupDCEs(customerRef, competence);
        int i = 0;
        string extPODCode, hour_date, hour_value, eventDTM, hourlyConsumption, totalF0GroupConsumption, treatmentType, consumptionType, actionType, edmID;       
        while (i < tableRowCount(sceData)) {
            EventRec sce = convertStoredSCRtoEventRec(true, sceData, i, "", competence);
            if ((string)tableGet(sceData, i, "ACTION_TYPE") == ACTION_REP) {
                udrRoute(sce, "toSE_Agg_rer");
                isReplaceAction = true;
            } else {
                udrRoute(sce, "toSE_Agg_evt");
            }
            i = i + 1;
        }
        i = 0;
        while (i < tableRowCount(dceData)) {
            EventRec dce = convertStoredDCRtoEventRec(true, dceData, i, "", competence);
            if ((string)tableGet(dceData, i, "ACTION_TYPE") == ACTION_REP) {
                udrRoute(dce, "toSE_Agg_rer");
                isReplaceAction = true;
            } else {
                udrRoute(dce, "toSE_Agg_evt");
            }
            i = i + 1;
        }
        if (isGroupHasPPO(customerRef, minStartDate)) {
            table sbilData = getPPOGroupSbil(customerRef, competence);   
            i = 0;
            while (i < tableRowCount(sbilData)) {
                EventRec sbilEvent = convertStoredSbiltoEventRec(sbilData, i, PPO_ZONALE, competence);
                if ((string)tableGet(sbilData, i, "ACTION_TYPE") == ACTION_REP) {
                    udrRoute(sbilEvent, "toSE_Agg_rer");
                    isReplaceAction = true;
                } else {
                    udrRoute(sbilEvent, "toSE_Agg_evt");
                }
                i = i + 1;
            }   
        }
        return true;
    }

    ctrl+c, ctrl+v

    n924, 04 Июля 2014

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

    +155

    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
    var colData = portfolioTable.getAvailableColumns();
    	        var colspecs = [];
    	        for (var i = 0, len = colData.length; i < len; i++) {
    	            var colspec = { 'field': colData[i].id, 'width': colData[i].width };
    	            colspecs.push(colspec);
    	        }
    	        var flag;
    
    		// бл, это ппц! для чего и тут accountNumber?!
    	        for (var i = 0, len = colspecs.length; i < len; i++) {
    	            if (colspecs[i].field !== 'AccountNumber') {
    	                flag = true;
    	            } else {
    	                flag = false;
    	                break;
    	            }
    	        }
    	        if (flag) {
    	            colspecs.unshift({ 'field': 'AccountNumber', 'width': 120 });
    	        }

    Из одного проекта, в котором больше половины кода - натурально индусский.

    And, 04 Июля 2014

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