1. Куча / Говнокод #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)
  2. Куча / Говнокод #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)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. Куча / Говнокод #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)
  8. 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)
  9. Java / Говнокод #16277

    +73

    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
    @SuppressWarnings("unchecked")
    	private <T> T convert(final String p, final Class<T> type) {
    		if (p == null) {
    			return null;
    		}
    		if (type == String.class) {
    			return (T) String.valueOf(p);
    		} else if (type == Integer.class) {
    			return (T) Integer.valueOf(p);
    		} else if (type == Boolean.class) {
    			return (T) Boolean.valueOf(p);
    		} else if (type == Double.class) {
    			return (T) Double.valueOf(p);
    		} else if (type == Long.class) {
    			return (T) Long.valueOf(p);
    		} else if (type == Float.class) {
    			return (T) Float.valueOf(p);
    		} else if (type == Short.class) {
    			return (T) Short.valueOf(p);
    		} else if (type == Byte.class) {
    			return (T) Byte.valueOf(p);
    		}
    		throw new UnsupportedOperationException(String.format("Cannot convert \"%s\" to %s", p, type));
    	}

    распарсь мне строку...

    Lure Of Chaos, 04 Июля 2014

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

    +19

    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
    wstring& delphi::IntToStr(int integer, wstring& str)
    {
    	if (0 == integer)		
    		return str = L"0";	
    	
    	str.clear();
    	wstring sign(L"");
    	if (integer < 0)
    	{
    		sign = L"-";
    		integer = -integer;
    	}
    	else
    		sign = L"";
    
    	while (integer >= 1)
    	{
    		str.push_back( (integer % 10) + 48 );  
    		integer /= 10;
    	}
    	str += sign;
    	std::reverse(str.begin(), str.end());
    			
    	return str;
    }

    snw, 03 Июля 2014

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