1. PHP / Говнокод #17644

    +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
    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
    function display_form($value){
    		switch($value){
    			case "page_title":
    				return "<input type='text' id='page_title' name='settings[page_title]' value='".$this->values[$value]."'/>";
    			break;
    			case "admin_email":
    				return "<input type='text' id='admin_email' name='settings[admin_email]' value='".$this->values[$value]."'/>";
    			break;
    			case "max_rental":
    				return "<input type='text' id='max_rental' name='settings[max_rental]' value='".$this->values[$value]."'/>";
    			break;
    			case "offset":
    				return "<input type='text' id='offset' name='settings[offset]' value='".$this->values[$value]."'/>";
    			break;
    			case "launch_limit":
    				return "<input type='text' id='offset' name='settings[launch_limit]' value='".$this->values[$value]."'/>";
    			break;
    			
    			case "page_text":
    				return "<textarea id='page_text' class='ckeditor' name='settings[page_text]'>".$this->values[$value]."</textarea>";
    			break;
    			
    			case "email_text":
    				return "<textarea id='page_text' class='ckeditor' name='settings[email_text]'>".$this->values[$value]."</textarea>";
    			break;
    			
    			case "confirm_message":
    				return "<textarea id='page_text' class='ckeditor' name='settings[confirm_message]'>".$this->values[$value]."</textarea>";
    			break;
    			
    			case "general_hours":
    				$hours = unserialize($this->values[$value]);
    				return "
    					<table id='hours'>
    					<tr><th></th>
    						<th>Sunday</th>
    						<th>Monday</th>
    						<th>Tuesday</th>
    						<th>Wednesday</th>
    						<th>Thursday</th>
    						<th>Friday</th>
    						<th>Saturday</th>
    					</tr>
    					<tr>
    						<th>Open</th>
    						<td>".$this->display_hour_options("Sunday","start",$hours['Sunday']['start'])."</td>
    						<td>".$this->display_hour_options("Monday","start",$hours['Monday']['start'])."</td>
    						<td>".$this->display_hour_options("Tuesday","start",$hours['Tuesday']['start'])."</td>
    						<td>".$this->display_hour_options("Wednesday","start",$hours['Wednesday']['start'])."</td>
    						<td>".$this->display_hour_options("Thursday","start",$hours['Thursday']['start'])."</td>
    						<td>".$this->display_hour_options("Friday","start",$hours['Friday']['start'])."</td>
    						<td>".$this->display_hour_options("Saturday","start",$hours['Sunday']['start'])."</td>
    					</tr>
    					<tr>
    						<th>Close</th>
    						<td>".$this->display_hour_options("Sunday","end",$hours['Sunday']['end'])."</td>
    						<td>".$this->display_hour_options("Monday","end",$hours['Monday']['end'])."</td>
    						<td>".$this->display_hour_options("Tuesday","end",$hours['Tuesday']['end'])."</td>
    						<td>".$this->display_hour_options("Wednesday","end",$hours['Wednesday']['end'])."</td>
    						<td>".$this->display_hour_options("Thursday","end",$hours['Thursday']['end'])."</td>
    						<td>".$this->display_hour_options("Friday","end",$hours['Friday']['end'])."</td>
    						<td>".$this->display_hour_options("Saturday","end",$hours['Saturday']['end'])."</td>
    					</tr>
    					</table>
    				";
    			break;
    			
    			case "interests":
    				$interests = unserialize($this->values[$value]);
    				return "<strong>Display:</strong> <br /><input type='text' name='settings[interests][display]' value='".$interests['display']."'/><br />
    						<strong>Options: </strong><small>(Seperated by \"|\")</small> <br /><textarea id='page_title' name='settings[interests][choices]'>".implode("|",$interests['choices'])."</textarea>";
    			break;
    			
    			case "occasions":
    				$occasions = unserialize($this->values[$value]);
    				return "<strong>Display:</strong> <br /><input type='text' name='settings[occasions][display]' value='".$occasions['display']."'/><br />
    						<strong>Options: </strong><small>(Seperated by \"|\")</small> <br /><textarea id='page_title' name='settings[occasions][choices]'>".implode("|",$occasions['choices'])."</textarea>";
    			break;
    		}
    	}

    ActiveForm на все случаи жизни

    dejust, 15 Февраля 2015

    Комментарии (3)
  2. Си / Говнокод #17643

    +140

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    GNET::ChatBroadCast::~ChatBroadCast(&cbc);
      }
      else if ( v9 > 9 && v9 == 14 )
      {
        v4 = this->roleid;

    Декомпилил тут игруху, а там такое в псевдокоде.

    DesmondHume, 14 Февраля 2015

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

    +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
    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
    using UnityEngine;
    using System.Collections;
    
    public class move : MonoBehaviour {
    	public GameObject walk;
    	public GameObject Stay;
    	public Transform wgon;
    	// Use this for initialization
    	void Awake () 
    	{
    	walk.SetActive(false);
    	Stay.SetActive(false);
    	}
    	
    	// Update is called once per frame
    	void Update () 
    	{
    	if(Input.GetKey(KeyCode.W))
    	{
    	walk.SetActive(true);
    	Stay.SetActive(false);
    	wgon.transform.Translate(0.0f, 0.0f, 0.3f);
    	}
    		if(Input.GetKeyUp(KeyCode.W))
    		{
    			walk.SetActive(false);
    			Stay.SetActive(true);
    		}
    		if(Input.GetKey(KeyCode.D))
    		{
    			wgon.transform.Rotate(0.0f, 0.5f, 0.0f);
    		}
    		if(Input.GetKey(KeyCode.A))
    		{
    			wgon.transform.Rotate(0.0f, -0.5f, 0.0f);
    		}
    	}
    }

    koe-kto, 14 Февраля 2015

    Комментарии (0)
  4. bash / Говнокод #17641

    −503

    1. 1
    2. 2
    3. 3
    4. 4
    if (( $(true; echo $?) != 0 )); then
        echo >&2 "Oops, we're running on a non-existing platform."
        exit 1 # Хм, а вдруг здесь 1 == EXIT_SUCCESS?...
    fi

    (c) anonymous
    https://www.linux.org.ru/forum/development/11317153?cid=11318931

    Elvenfighter, 13 Февраля 2015

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

    +125

    1. 1
    2. 2
    3. 3
    Console.WriteLine("Say my name");
               Console.ReadLine();
               Console.WriteLine("Yes, damn right!");

    Worldoorboll, 13 Февраля 2015

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

    +143

    1. 1
    2. 2
    3. 3
    char value[60] = {0};
    int data;
    snprintf(value, sizeof(value-1), "|%7u\n", data);

    coverity полагал что заменить sprintf на snprintf было бы безопаснее

    Yeiradohr, 13 Февраля 2015

    Комментарии (27)
  7. Си / Говнокод #17637

    +145

    1. 1
    2. 2
    char bStr[1000];
    strncpy(bStr, "  [\0", strlen("  [\0"));

    Потому что в man:
    Warning: If there is no null byte among the first n bytes of src, the string placed in dest will not be null terminated.

    Yeiradohr, 13 Февраля 2015

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

    +159

    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
    define([ "t5/core/dom" ], function(dom) {
    	return function() {
    		dom.scanner("select,input[type=text]", function(el) {
    			el.on("focus", function(e) {
    				var focusholder = this.findParent("form").find("input.focusholder");
    				if (focusholder.length)
    					focusholder[0].element.value = el.element.id;
    				el.element.select();
    			});
    		});
    		dom.scanner("select,input[type=text]", function(el) {
    			el.on("change", function(e) {
    				var form = this.findParent("form");
    				var submit = form.find("input[type=submit]");
    				if (submit.length)
    					submit[0].element.disabled = "disabled";
    				setTimeout(function() {form.trigger("submit");}, 1);
    			});
    		});
    		dom.scanner("input[type=checkbox],input[type=radio]", function(el) {
    			el.on("click", function(e) {
    				return this.findParent("form").trigger("submit");
    			});
    		});
    		dom.scanner("form", function(el) {
    			el.on("submit", function(e) {
    				var form=this;
    				setTimeout(function() {
    					var children = form.find("select,input[type=text],input[type=checkbox],input[type=radio]");
    					if (children.length)
    						for(var i=0;i<children.length;i++)
    							children[i].element.readOnly = "readOnly";
    					var submit = form.find("input[type=submit]");
    					if (submit.length)
    						submit[0].element.disabled = "disabled";
    				}, 1);
    			});
    		});
    		return dom;
    	};
    });

    код превращается, код превращается... в говно!

    Lure Of Chaos, 13 Февраля 2015

    Комментарии (13)
  9. Си / Говнокод #17635

    +142

    1. 1
    2. 2
    #define PHYSICAL        unsigned long
    #define VIRTUAL         unsigned long

    прикольное legacy

    cerevra, 13 Февраля 2015

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

    +103

    1. 1
    if (openFileDialog1.ShowDialog().ToString() == "OK")

    не хватает еще

    if(1.ToString() == "1")

    Lokich, 13 Февраля 2015

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