1. C++ / Говнокод #16172

    +1

    1. 1
    chunksLst.erase(++it1);

    laMer007, 16 Июня 2014

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

    −164

    1. 1
    2. 2
    3. 3
    Процедура глЗагрузитьЗаказы() Экспорт
    	ОткрытьФорму("Отчет",,"\\SQLDSTR\1C\ExtERT\InvoiceLoader.ert");
    КонецПроцедуры

    Встретил в самописке в клюшках. Если поменяется имя сервера или каталога - всё рухнет).

    zinkovskiy, 16 Июня 2014

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

    +108

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    if (needParce)
    {
        try
        {
            count = decimal.Parse(tb_count.Text.Replace(".", ","));
        }
        catch
        {
            count = decimal.Parse(tb_count.Text.Replace(",", "."));
        }  
    }

    ffosbs, 16 Июня 2014

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

    +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
    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
    [Serializable]
    public class CSScriptCompiler
    {
    	//file name of script  including full path
    	string sFileNameWithPath;
    
    	System.Reflection.Assembly m_assembly = null;
    
    	public CSScriptCompiler(string ScriptFileName)
    	{
    		this.sFileNameWithPath = Path.GetFullPath(ScriptFileName);
    
    		try
    		{
    			//load Assembly of *.cs file
    			m_assembly = CSScript.Load(sFileNameWithPath, null, true);
    		}
    		catch (Exception ex)
    		{
    			m_assembly = null;
    			MessageBox.Show(ex.Message);
    			
    			throw (ex);
    		}
    	}
    
    	public bool Initialize(params object[] InitArgs)
    	{
    		if (m_assembly == null)
    		{
    			return false;
    		}
    
    		try
    		{
    			var InitFuntion = m_assembly.GetStaticMethod("*.Initialize", InitArgs);
    
    			//call initialize function
    			InitFuntion(InitArgs);
    		}
    		catch (Exception ex)
    		{
    			MessageBox.Show(ex.Message);
    			return false;
    		}
    
    		return true;
    	}
    
    
    	public object CallFunction(String sFunctionName, params object[] args)
    	{
    		object result = null;
    
    		sFunctionName = "*." + sFunctionName;
    		try
    		{
    			var theFunction = m_assembly.GetStaticMethod(sFunctionName, args);
    		   
    			//call the method with your own arguements
    			result = theFunction(args);
    		}
    		catch (Exception ex)
    		{
    			MessageBox.Show(ex.Message);
    		}
    
    		return result;
    	}
    }

    Ну что тут скажешь...
    Велосипедист...

    blackhearted, 16 Июня 2014

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

    +138

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    public string GetStringOfEnum(object myEnum)
    {
    	string sValue = "";
    
    	sValue = Enum.GetName(myEnum.GetType(), myEnum);
    
    	return sValue;
    }

    Nuff said...

    blackhearted, 16 Июня 2014

    Комментарии (1)
  6. JavaScript / Говнокод #16167

    +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
    function deposit(){ 
        if(document.getElementById("no_of_year").value=="1") { 
          document.getElementById("interest_rate").value="9.5" 
        } 
        if(document.getElementById("no_of_year").value=="2") { 
          document.getElementById("interest_rate").value="10" 
        } 
        if(document.getElementById("no_of_year").value=="3") { 
          document.getElementById("interest_rate").value="10.5" 
        } 
        if(document.getElementById("no_of_year").value=="4") { 
          document.getElementById("interest_rate").value="11" 
        } 
        if(document.getElementById("no_of_year").value=="5") { 
          document.getElementById("interest_rate").value="11.5" 
        } 
      }

    отсюда - http://stackoverflow.com/questions/24236980/values-not-passing-in-to-database

    zed_0xff, 16 Июня 2014

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

    +164

    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
    function EscapePHPString($str)
    {
    	$str = str_replace("\\", "\\\\", $str);
    	$str = str_replace("\$", "\\\$", $str);
    	$str = str_replace("\"", "\\"."\"", $str);
    	return $str;
    }
    
    function UnEscapePHPString($str)
    {
    	$str = str_replace("\\\\", "\\", $str);
    	$str = str_replace("\\\$", "\$", $str);
    	$str = str_replace("\\\"", "\"", $str);
    	return $str;
    }

    Bitrix.

    TBoolean, 16 Июня 2014

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

    +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
    // Выше PHP + HTML
    
    $redirect = "
    <script language='JavaScript'> 
      window.location.href = 'http://www.p-ride.ru'
    </script>
    ";
    
    // ...
    
    $query1 = "SELECT main_id FROM email WHERE email = '$email'";
    $idquery = mysql_query($query1);
    $id = mysql_fetch_row($idquery);
    
    // ...
    
    if(in_array($id[0], $idarray2))
    {
    	echo $starthtml;
    	echo $redirect;
    	// ^ тут
    	echo "<p>Такой почтовый адрей уже используется, ведите пожалуйста другой адрес или восстановите пароль. Вы сейчас будете перенаправлены на главную страницу, если этого не произошло, кликните <a href='http://p-ride.ru'>сюда</a>.</p>";
    	echo $endhtml;
    }

    Редирект аля ПоХаПэ + отображение сообщение которое не будет показано.

    volter9, 15 Июня 2014

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

    +165

    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
    /* Выше HTML ... */
    
    include_once "config/mysql.php";
    
    $email = $_POST['email'];
    $password = $_POST['password'];
    $confirm = $_POST['confirm'];
    
    $email = stripslashes($email);
    $email = htmlspecialchars($email);
    $email = trim($email);
    
    $password = stripslashes($password);
    $password = htmlspecialchars($password);
    $password = trim($password);
    
    $confirm = stripslashes($confirm);
    $confirm = htmlspecialchars($confirm);
    $confirm = trim($confirm);
    
    /* ... больше ПоХаПэ */

    Мммм... О функциях не слышали?

    volter9, 14 Июня 2014

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

    +89

    1. 1
    (1 until n) flatMap (i => (1 until i) filter (j => isPrime(i+j)) map (j => (i, j)))

    Скала говна.

    LispGovno, 13 Июня 2014

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