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

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

    −120

    1. 1
    |РАЗНОСТЬДАТ(ДАТАВРЕМЯ(1980, 1, 1), НакладнаяНаОтпускМатериалы.ДатаВозврата, ДЕНЬ) + 2444240 КАК ДатаВозврата,

    Внезапно! Календарь майя

    safer_bwd, 19 Декабря 2014

    Комментарии (3)
  3. PHP / Говнокод #17289

    +156

    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
    <?php	if(!isset($_REQUEST['doGo'])){?>
    			<form action=4.php>
    Введите ФИО <input type=text name="text" value="" size=40><br>
    			<input type=submit name="doGo" value="knopka">
    					<?php } 
    				else {
    					$tas=trim($_REQUEST['text']);
    					$text_arr=str_split($tas);	 
    					$i=0;
    					while($text_arr[$i]!==" ")
    					{
    						echo $text_arr[$i]."";
    						$i++;
    					}
    					for($i=0; $i<count($text_arr); $i++)
    					{
    						if($text_arr[$i]==" ") echo " ".$text_arr[$i+1]."."; continue;
    					}
    				}					
    ?>

    Задача обрезать имя и фамилию

    aut0, 11 Декабря 2014

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

    +158

    1. 1
    $scope.pageCount = (newValue / $scope.pageSize | 0) || +!!newValue;

    Кратскость - сестра таланта

    dr_abstract, 10 Декабря 2014

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

    +158

    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
    var firstpostime = 1417254005;var numpos = 1; //номер посещения
    var sredvrem  = 0; //среднее время на каждой странице
    var lasdo15sek = 0;
    
    function debug444(ff) {
    	console.log(ff);
    	//alert(ff);
    }
    var newTxt="!!";
    var oldTxt=document.title;
    function migalka(){
        if(document.title==oldTxt){
            document.title=newTxt;
        }else{
            document.title=oldTxt;
        }
    } 
    function neuspeli() {
    	var element55577 = document.createElement('div');
    	element55577.innerHTML = '<img style="width:1px;height:1px;" src="http://rbcall.com/neuspeli.php?&tel='+document.getElementById('wi_tele233').value+'&site=47&user=159">', 
    	element55577.id = 'wi_r223';
    	document.body.appendChild(element55577);
    	document.getElementById("superjalobal").style.display='block';
    } 
    
    function jduzvonka() {
    	if (zvonim == 1) { return true; }
    	if(document.getElementById("wi_tele233").value.length>=8 || document.getElementById("wi_tele233").value == 400){
    		wiyacall();
    		
    		insertscript(document.getElementById("wi_tele233").value);
    		
    	} else { 
    		document.getElementById("wi_tele233").style.border="1px solid red"; 
    	}
    }
    
    ...... и весь скрипт такой

    http://rbcall.com/ ROBOCALL - технологии будущего (они же: технологии ИИ)

    xjester0, 29 Ноября 2014

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

    +51

    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
    PVOID ZDbgDoc::getVaByName(PCSTR name)
    {
    	PLIST_ENTRY head = &_dllListHead, entry = head;
    
    	while ((entry = entry->Flink) != head)
    	{
    		ZDll* pDll = static_cast<ZDll*>(entry);
    
    		if (PWSTR ImageName = pDll->_ImageName)
    		{
    			PCSTR sz = name;
    __loop:
    			int c = tolower(*sz++);
    
    			if (!c || c != towlower(*ImageName++))
    			{
    				continue;
    			}
    
    			if (c != '.')
    			{
    				goto __loop;
    			}
    
    			pDll->Parse(this);
    
    			return pDll->getVaByName(sz, this);
    		}
    	}
    
    	return 0;
    }

    zhukas, 29 Ноября 2014

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

    +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
    private static List<User> Users
    {
        get
       {
           if (_customers == null) {             _customers = new List<Customer>(); }
            lock (((ICollection)_customers).SyncRoot)
           {
                    return _customers;
           }
    }
    set
      {
          lock (((ICollection)Customer).SyncRoot)
          {
                _customers = value;
           }
       }

    one12351, 27 Ноября 2014

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

    +50

    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
    size_t __stdcall ZAsmView::addrSet(DIS const *pDis, unsigned __int64 Va, wchar_t * buf, size_t cb, unsigned __int64 * displacement)
    {
    	FORMATDATA* pf = (FORMATDATA*)pDis->PvClient();
    	size_t fixupLen = pf->fixupLen;
    	pf->fixupLen = 0;
    	*displacement = 0;
    	BOOL f = TRUE;
    	PVOID _Va = (PVOID)Va;
    	ZDbgDoc* pDoc = pf->pDoc;
    	
    __loop:
    	if (PCSTR Name = pDoc->getNameByVa((PVOID)Va))
    	{
    		char cc[256];
    		PCSTR fName = unDNameEx(cc, Name, sizeof(cc), UNDNAME_NAME_ONLY);
    		int len = _snwprintf(buf, cb, L"%S(%p)", fName, Va);
    		if (len < 0)
    		{
    			buf[len = (DWORD)cb - 1] = 0;
    		}
    		else
    		{
    			buf[0] |= 0x4000, buf[len - 3 - 2*sizeof(PVOID)] |= 0x8000;
    		}
    		return len;
    	}
    
    	if (f && 2*sizeof(PVOID)+2<cb)
    	{
    		switch (pDis->Trmta())
    		{
    		case DIS::a_jmp_u_2:
    		case DIS::a_jmp_u_5:
    		case DIS::a_jmp_c_2:
    		case DIS::a_jmp_c_6:
    			_snwprintf(buf, cb, L"%p %c", (PVOID)Va, Va > pf->pLI->Va ? 0x2193 : 0x2191);
    			buf[0] |= 0x4000, buf[2*sizeof(PVOID)-1] |= 0x8000;
    			return 2*sizeof(PVOID)+2;
    		}
    	}
    
    	if (fixupLen)
    	{
    		if (0 <= pDoc->Read((PVOID)Va, &Va, sizeof(PVOID)))
    		{
    			fixupLen = 0, f = FALSE;
    			goto __loop;
    		}
    	}
    
    	if (2*sizeof(PVOID)+2<cb && pDoc->getDllByVaNoRef(_Va))
    	{
    		_snwprintf(buf, cb, L"%p", _Va);
    		buf[0] |= 0x4000, buf[2*sizeof(PVOID)-1] |= 0x8000;
    		return 2*sizeof(PVOID);
    	}
    
    	return 0;
    }

    zhukas, 27 Ноября 2014

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

    +134

    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
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    public void OnKillEvent_ServerOnly(PhotonPlayer player)
        {
        case MatchTypeInfo.TDM:
    
                    if (player != null)
                    {
                        var hash = player.customProperties;
    
                        if (hash != null)
                        {
                            var team = (int) hash["team"];
    
                            var realScore = match.GetTeamScores();
    
                            var teamAScor = team == 0 ? realScore.x + TeamDeathScores : realScore.x;
                            var teamBScor = team == 1 ? realScore.y + TeamDeathScores : realScore.y;
    
                            //DebugModule("Kill Processed On Server completed: " + team + "// " + teamAScor + "/" + teamBScor);
    
                            match.ChangeTeamScores((int)teamAScor, (int)teamBScor);
                        }
                        else
                        {
                            Debug.LogError("OnKillEvent_ServerOnly ERROR Team hash");
                        }
                    }
    
                    break;
    }  {
    //через 500 строк кода
       private void LocalUpdate()
        { 
        if (Application.isEditor)
            {
                if (Input.GetKeyDown(KeyCode.Y))
                {
                    switch (MatchType)
                    {
    
                        case MatchTypeInfo.TDM:
                            ChangeTeamScores((int)(_teamScores.x - 1), (int)(_teamScores.y - 1), true);
                            break;   }
    
                    SendTeamScoresToUI();
                }
            }
    
       switch (MatchType)
            {
                case MatchTypeInfo.TDM:
                   // DebugModule("Load TDM type game");
                    break;
    }
    }
    //ещё 500 строк
     public void ChangeTeamScores(int a, int b, bool force = false)
        {
    
            if (PhotonNetwork.isMasterClient)
            {
                // check server rules
                var rules = GetGameRules();
                if (rules != null)
                {
                    if (!rules.CheckPlayerCountRules() && !force)
                    {
                        Debug.LogError("Game is not started, beacuse server has no players: " + rules.MinimumPlayerToPlay + "/" +
                                       PhotonNetwork.room.playerCount);
                        return;
                    }
                }
                else
                {
                    Debug.LogError("Rule error");
                    return;
                }
    
                _teamScores.x = Mathf.Clamp(a, 0, float.MaxValue);
                _teamScores.y = Mathf.Clamp(b, 0, float.MaxValue);
    
                var matchIsCompleted = false;
    
                switch (MatchType)
                {
                    case MatchTypeInfo.TDM:
                        matchIsCompleted = _teamScores.x <= 0 || _teamScores.y <= 0;
                        break;
                }
                   if (matchIsCompleted)
                {
                    Server_CallEndRound();
                }
                else
                {
                    // Call Event??
                  }
    }
    }

    Чтобы я ещё раз полез помогать инди-разработчикам, мать их за ногу.

    noshitleft, 26 Ноября 2014

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

    +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
    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
    public void Login(ClientHandlers<int> actions)
            {
                var request = GetGetRequest("/user/xml/{0}", _login);
    
                var act = new Action<IRestResponse<GetUserInfoResult>>(response =>
                    {
                        if (CheckUserInfo(response))
                        {
                            throw new Exception("Невозможно получить информацию о пользователе\r\nНеобработанное исключение");
                        }
    
                        UserInfo = response.Data.UserInfo;
                        actions.Completed(UserInfo.idUser);
                    });
                _client.ExecuteAsync(request, act);
            }
    
            private bool CheckUserInfo(IRestResponse<GetUserInfoResult> response)
            {
                if (response != null && response.Data != null && response.Data.UserInfo != null && response.Data.UserInfo.idUser != 0)
                {
                    return true;
                }
    
                var message = "Невозможно получить информацию о пользователе";
                if (response == null)
                {
                    message = string.Format("{0}\r\n{1}", 
                                            message, 
                                            "Response is null");
                    throw new Exception(message);
                }
    
                message = string.Format("{0}\r\nResponse data is null\r\nContext: {1}", 
                                        message, 
                                        response.Content);
    
                if (response.Data == null)
                {
                    throw new Exception(message);
                }
    
                message = string.Format("{0}\r\nIs exception: {1}\r\nMessage: {2}", 
                                        message, 
                                        response.Data.IsException, 
                                        response.Data.Message);
    
                if (response.Data.UserInfo == null)
                {
                    throw new Exception(message);
                }
    
                message = string.Format("{0}\r\nSiteName: {1}\r\nUserName: {2}\r\nUserRole: {3}", 
                                        message, 
                                        response.Data.UserInfo.SiteName, 
                                        response.Data.UserInfo.UserName, 
                                        response.Data.UserInfo.UserRole);
                if (response.Data.UserInfo.idUser == 0)
                {
                    throw new Exception(message);
                }
    
                return false;
            }

    Внимательность, внимательность и еще раз внимательность...

    HellMaster_HaiL, 26 Ноября 2014

    Комментарии (3)
  11. SQL / Говнокод #17168

    −864

    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
    sResult:= '';
       select  code||' '||h.longname into sResult
            from tbl1 mo, tbl2 ob, g_cli c, tbl3 h
          where mo.m_dep_id = ob.obj_dep_id and mo.m_id = ob.obj_id
              and ob.dep_id = nDepId and ob.id = nId
              and  mo.cli_dep_id = c.dep_id and mo.cli_id = c.id
              and c.id = h.id and c.dep_id = h.dep_id and p_operday between h.FROMDATE and h.TODATE;
             return sResult; 
      exception
        when NO_DATA_FOUND then return null;
        when TOO_MANY_ROWS then          
              for rec in(   select  distinct code as cli_code, h.longname as cli_name 
            from tbl1 mo, tbl2 ob, g_cli c, tbl3 h
          where mo.m_dep_id = ob.obj_dep_id and mo.m_id = ob.obj_id
              and ob.dep_id = nDepId and ob.id = nId
              and  mo.cli_dep_id = c.dep_id and mo.cli_id = c.id
              and c.id = h.id and c.dep_id = h.dep_id and dT between h.FROMDATE and h.TODATE)
                loop
                  if nvl(length(sResult),0) = 0 then
                    sResult:= rec.cli_code||' '||rec.cli_name;
                  else
                    sResult:= sResult||', '||rec.cli_code||' '||rec.cli_name;
                  end if;
                end loop;
                return sResult;   
         when others then return null;

    ColvirBydlokod, 25 Ноября 2014

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