1. Java / Говнокод #17649

    +74

    1. 1
    2. 2
    3. 3
    4. 4
    /**
     * singletone staff:
     */
    private static LogisticsAppContext local;

    Однотонный посох?

    someone, 16 Февраля 2015

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

    +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
    if ( !defined ('BX_SKIP_INSTALL_CHECK') && file_exists( $dir['root'] . 'install' ) ) {
        $ret = <<<EOJ
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
    <head>
        <title>Dolphin Installed</title>
        <link href="{$site['url']}install/general.css" rel="stylesheet" type="text/css" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </head>
    <body class="bx-def-font">
        <div class="adm-header">
            <div class="adm-header-content">
                <div class="adm-header-title bx-def-margin-sec-left">
                    <img class="adm-header-logo" src="{$site['url']}administration/templates/base/images/logo.png" />
                    <div class="adm-header-text bx-def-font-h1">Dolphin {$site['ver']}</div>
                    <div class="clear_both">&nbsp;</div>
                </div>
                <div class="clear_both">&nbsp;</div>
            </div>
        </div>
        <div id="bx-install-main" class="bx-def-border bx-def-round-corners bx-def-margin-top">
            <div id="bx-install-content" class="bx-def-padding">
                <div class="bx-install-header-caption bx-def-font-h1 bx-def-margin-bottom">
                    Well done, mate! Dolphin is now installed.
                </div>
                <div class="bx-install-header-text bx-def-font-large bx-def-font-grayed">
                    Remove directory called <b>"install"</b> from your server and <a href="{$site['url']}administration/modules.php">proceed to Admin Panel to install modules</a>.
                </div>
            </div>
        </div>
    </body>
    </html>
    EOJ;
        echo $ret;
        exit();
    }

    Какой веселый вывод HTML (Dolphin 7)

    jey-val-star, 15 Февраля 2015

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

    +138

    1. 1
    2. 2
    3. 3
    if (r_ptr->flags1 & (RF1_FEMALE)) my_strcpy(desc, "себя", max);
    else if (r_ptr->flags1 & (RF1_MALE)) my_strcpy(desc, "себя", max);
    else my_strcpy(desc, "себя", max);

    Может, я чего-то не понимаю?

    CYB3R, 15 Февраля 2015

    Комментарии (8)
  4. Java / Говнокод #17646

    +76

    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
    private List< String > extractMetaDataLines()
    {
       final ArrayList< String > metaDataLines = new ArrayList< String >();
       int currentLineIndex = 0;
       int start = 0;
       int end = 0;
    
       for ( final String line : getLines() )
       {
          if ( line.contains( METADATA_TAG ) )
          {
             if ( line.contains( "</" ) )
             {
                end = currentLineIndex
                      - ( getLines().get( currentLineIndex - 1 ).contains( "]]>" ) ? 1
                                                                                  : 0 );
                if ( line.contains( "<fx" )
                      || line.contains( "<mx" ) )
                {
                   start = end;
                }
                break;
             }
             if ( line.contains( "<" ) )
             {
                start = currentLineIndex
                      + ( getLines().get( currentLineIndex + 1 ).contains( "CDATA[" ) ? 2
                                                                                     : 1 );
             }
          }
          currentLineIndex++;
       }
       metaDataLines.addAll( getLines().subList( start,
                                                 end ) );
       return metaDataLines;
    }

    build.xml:413: java.lang.IllegalArgumentException: fromIndex(12) > toIndex(11)
    at java.util.ArrayList.subListRangeCheck(ArrayList.java:964)
    at java.util.ArrayList.subList(ArrayList.java:954)
    at com.adobe.ac.pmd.files.impl.MxmlFile.extractMetaDataLines(MxmlFile.java:262)
    at com.adobe.ac.pmd.files.impl.MxmlFile.copyScriptLinesKeepingOriginalLineIndices(MxmlFile.java:191)

    Адоб, как обычно, порадовал. (Это типа линт, который должен проверять мелкие ошибки / стиль). В проекте примерно 300 файлво в которых есть тег "метадата", пойди пойми на каком оно валится... Самому собрать это говно - нереально сложно изза каких-то уебищных зависимостей, конфликтов версий мейвена и т.п.

    wvxvw, 15 Февраля 2015

    Комментарии (1)
  5. PHP / Говнокод #17645

    +160

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    <?php
    namespace MultipleHashMapQueueMessageRetrieverCriterias\Domain\MultipleHashMapQueueMessageRetrieverCriterias\Adapters\Exceptions;
    use MultipleHashMapQueueMessageRetrieverCriterias\Domain\Exceptions\MultipleHashMapQueueMessageRetrieverCriteriaException;
    
    final class CannotConvertMultipleHashMapQueueMessageRetrieverCriteriaToMultipleQueueMessageRetrieverCriteriaException extends MultipleHashMapQueueMessageRetrieverCriteriaException {
        const CODE = 1;
        public function __construct($message, MultipleHashMapQueueMessageRetrieverCriteriaException $parentException = null) {
            parent::__construct($message, self::CODE, $parentException);
        }
    }

    http://www.reddit.com/r/lolphp/comments/2vrgr6/irestfulmultiplehashmapqueuemessageretri evercriter/
    https://github.com/irestful/MultipleHashMapQueueMessageRetrieverCrit erias/blob/master/MultipleHashMapQueueMessageRetrieverCrit erias/Domain/MultipleHashMapQueueMessageRetrieverCrit erias/Adapters/Exceptions/CannotConvertMultipleHashMapQueueMessage RetrieverCriteriaToMultipleQueueMessageR etrieverCriteriaException.php

    Алсо, обратите внимание на структуру гитхабовских репозиториев

    myaut, 15 Февраля 2015

    Комментарии (8)
  6. 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)
  7. Си / Говнокод #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)
  8. 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)
  9. 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)
  10. 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)