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

    +72

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    Date convertedDate = new Date();
    		SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy:MM:dd",
    				Locale.getDefault());
    
    		try {
    			convertedDate = dateFormatter.parse("" + year + ":" + month + ":"
    					+ day);
    		} catch (ParseException e) {
    			e.printStackTrace();
    		}
    		SimpleDateFormat fmtOut = new SimpleDateFormat("MM/dd/y");
    		String curDate = fmtOut.format(convertedDate).toString();

    andrew91, 13 Июня 2014

    Комментарии (9)
  9. ActionScript / Говнокод #16159

    −102

    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
    x = 1;
    					x = (x >> 11);
    					x = (x + 1);
    					x = (x >> 9);
    					x = (x + 1);
    					x = (x >> 7);
    					x = (x + 1);
    					x = (x >> 5);
    					x = (x + 1);
    					x = (x >> 3);
    					x = (x + 1);
    					x = (x >> 10);
    					x = (x + 1);
    					x = (x >> 8);
    					x = (x + 1);
    					x = (x >> 6);
    					x = (x + 1);
    					x = (x >> 4);
    					x = (x + 1);
    					x = (x >> 2);
    					x = (x + 1);
    					if (x == 1)
    					{
    						ge.ha = true;
    					};

    из недр не менее изощрённого распковщика обфусцированного xml

    makc3d, 13 Июня 2014

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

    +125

    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
    // ------------------------------
    // config on all machines
    akka {
      actor {
       provider = akka.remote.RemoteActorRefProvider
       deployment {
         /greeter {
           remote = akka.tcp://MySystem@machine1:2552
         }
       }
     }
    }
     
    // ------------------------------
    // define the greeting actor and the greeting message
    case class Greeting(who: String) extends Serializable
     
    class GreetingActor extends Actor with ActorLogging {
      def receive = {
        case Greeting(who) ⇒ log.info("Hello " + who)
     }
    }
     
    // ------------------------------
    // on machine 1: empty system, target for deployment from machine 2
    val system = ActorSystem("MySystem")
     
    // ------------------------------
    // on machine 2: Remote Deployment - deploying on machine1
    val system = ActorSystem("MySystem")
    val greeter = system.actorOf(Props[GreetingActor], name = "greeter")
     
    // ------------------------------
    // on machine 3: Remote Lookup (logical home of “greeter” is machine2, remote deployment is transparent)
    val system = ActorSystem("MySystem")
    val greeter = system.actorSelection("akka.tcp://MySystem@machine2:2552/user/greeter")
    greeter ! Greeting("Sonny Rollins")

    Где найти такую же няшку под кресты?

    laMer007, 13 Июня 2014

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