1. JavaScript / Говнокод #9817

    +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
    if (
            (_methodName == "invoke") ||
            (_methodName == "auth") ||
            (_methodName == "resetAuth") ||
            (_methodName == "registerMethod") ||
            (_methodName == "registerAllMethods")
           )
        {
           throw "Illegal method name " +_methodName +" - service method with this name already exist";
        }
        else
        {
            eval("ComponentClient.prototype."+_methodName+" = function (_parameters) {return this.invoke(\""+_methodName+"\", _parameters)}")
        }

    И там много ещё такого

    konsoletyper, 30 Марта 2012

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

    −117

    1. 1
    2. 2
    CGSize size = [[CCDirector sharedDirector] winSize];
    [[DeviceManager sharedManager] SetIpad:(size.height > 500)];

    Незнаете как определить iPad ли у вас?
    А человек знает:

    mrWindMak3r, 30 Марта 2012

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

    −89

    1. 1
    columns = [col for col in self.load_column_data()['columns']]

    Вот так мы копируем списки.

    zealotous, 30 Марта 2012

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

    +161

    1. 1
    wp_list_categories('orderby=order&hide_empty=0&title_li&echo=0&exclude=13,14,19,20,21,36,37,42,43,44,45,46,47,48,70,126,127,167,75,128,129,130,131,132,133,53,68,69,134,135,136,117,118,119,168,146,120,121,122,67,150,123,142,124,54,125,149,66,104,105,144,106,107,108,55,109,110,111,112,57,113,114,115,116,162,175,95,96,97,98,99,100,59,163,49,101,145,102,103,158,153,157,174,169,160,147,148,151,172,152,161,154,165,173,170,171,177,166,176,155,159,156,164,87,180,181,182,183,184,185,186,191,193,22,194,78,16,82,89,88,28,83,73,85,71,72,30,23,58,86,90,26,25,190,41,34,35,39,40,50,51,52,56,74,62,91,92,93,94,178,187,188,192,18,31,33,63,61,65,60,64,29,32,79,80,81');

    Как вы заебали..

    varg242, 30 Марта 2012

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

    −90

    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
    def runRidor():
    	isDirty = 0
    	#Except (DebugSize <= 14) and (ImageVersion <= 760) and (VirtualSize2 > 992) and (ExportSize <= 80.5) => isDirty = 1  (1702.0/16.0) [855.0/5.0]
    	if input.DebugSize <= 14 and input.ImageVersion <= 760 and input.VirtualSize2 > 992 and input.ExportSize <= 80.5:
    		isDirty = 1
    #Except (DebugSize <= 14) and (ImageVersion <= 4525) and (ExportSize <= 198.5) and (ResourceSize <= 37532) and (VirtualSize2 <= 6) and (ResourceSize <= 7348) and (ResourceSize > 1773) => isDirty = 1  (106.0/0.0) [48.0/0.0]
    	elif input.DebugSize <= 14 and input.ImageVersion <= 4525  and input.ExportSize <= 198.5 and input.ResourceSize <= 7348 and input.VirtualSize2 <=6 and input.ResourceSize > 1773:
    		isDirty = 1
    #Except (DebugSize <= 14) and (ImageVersion <= 4950) and (ExportSize <= 192) and (IatRVA > 256) and (VirtualSize2 > 42) and (ExportSize <= 56) and (NumberOfSections > 3.5) => isDirty = 1  (193.0/0.0) [91.0/0.0]
    	elif input.DebugSize <= 14 and input.ImageVersion <= 4950 and input.ExportSize <= 56 and input.IatRVA > 256 and input.VirtualSize2 > 42 and input.NumberOfSections > 3.5:
    		isDirty = 1
    #Except (DebugSize <= 14) and (ImageVersion <= 4950) and (VirtualSize2 <= 6) and (ResourceSize <= 37532) and (ResourceSize <= 17302) => isDirty = 1  (388.0/0.0) [216.0/7.0]
    	elif input.DebugSize <= 14 and input.ImageVersion <= 4950 and input.VirtualSize2 <= 6 and input.ResourceSize > 17302:
    		isDirty = 1
    #Except (DebugSize <= 14) and (NumberOfSections > 2.5) and (ResourceSize > 1776) and (IatRVA <= 6144) and (ExportSize <= 219.5) and (VirtualSize2 > 2410) and (VirtualSize2 <= 61224) => isDirty = 1  (238.0/0.0) [116.0/0.0]
    	elif input.DebugSize <= 14 and input.NumberOfSections >= 2.5 and input.ResourceSize <= 1776 and input.IatRVA <= 6144 and input.ExportSize <= 219.5 and input.VirtualSize2 > 2410 and input.VirtualSize2 <= 61224:
    		isDirty = 1

    Пример того, как не надо писать на питоне, показывает Adobe. Полная версия: http://voxel.dl.sourceforge.net/project/malclassifier.adobe/AdobeMalwareClassifier.py

    SvartalF, 30 Марта 2012

    Комментарии (4)
  6. Pascal / Говнокод #9812

    +94

    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
    var
       one, two, free, four:string;
    begin
       one:=sLabel14.Caption+slabel14.caption;
       two:=sLabel1.Caption+slabel15.caption;
       free:=sLabel10.Caption+slabel16.caption;
       four:=sLabel7.Caption+slabel17.caption;
    
       if ((one = two) or (one = free) or (one = four)
       or (two = one) or (two = free) or (two = four)
       or (free = one) or (free = two) or (free = four)
       or (four = one) or (four = two) or (four = free))
       then begin
           showmessage('Значения должны быть различными');
       end
       else begin
           showmessage('Успешно сохранено');
       end;

    Ну не лол?

    penkovsky1, 29 Марта 2012

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

    +153

    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
    require_once('adodb/adodb.inc.php');
    
    class adoDbConnector
    {
        private static $instance = null;
    	
        public static function getInstance()
        {
    	if (self::$instance == NULL)
    	{
    		self::$instance = new adoDbConnector();
    	}
    		
    	return self::$instance;
        }
    
        private function __construct() { }
    	
        public function __clone()
        {
            trigger_error('No __clone()!', E_USER_ERROR);
        }
    
        public function __wakeup()
        {
            trigger_error('No __wakeup()!', E_USER_ERROR);
    	}
    	
    	public function connect($connectionType, $connectionData)
    	{
    		switch($connectionType)
    		{
                        case 0: 
    			return self::generalConnect($connectionData);
    			break;
    			
                        case 1: 
    			return self::dsnConnect($connectionData);
    			break;
    				
                        case 2: 
    			return self::xmlConnect($connectionData);
    			break;
    				
                        default:
    			throw new Exception('Wrong type of connection!');
    		}
    	}
    	
    	private static function generalConnect($connectionData)
    	{	
    		if(is_array($connectionData))
    		{
    			$conn = &ADONewConnection($connectionData[0]); 
    				
    			$conn->PConnect($connectionData[1], $connectionData[2], 
                                    $connectionData[3], $connectionData[4]);
    				
    			return $conn;
    		}
    		else throw new Exception('Wrong type of connection data, must be an array!');
    	}
    	
    	private static function dsnConnect($connectionData)
    	{		
    		if(is_string($connectionData))
    		{
    			$conn = ADONewConnection($connectionData);
    				
    			return $conn;
    		}
    		else throw new Exception('Wrong type of connection data, must be a string!');
    	}
    	
    	private static function xmlConnect($connectionData)
    	{
    		if(is_string($connectionData) && file_exists($connectionData))
    		{
    			$xml = simplexml_load_file($connectionData);
    			
    			foreach($xml as $x)
    			{
    				$connArr[] = trim($x);
    			}
    			
    			$conn = &ADONewConnection($connArr[0]);
    			
    			$conn->PConnect($connArr[1], $connArr[2], $connArr[3], $connArr[4]);
    				
    			return $conn;
    		}
    		else throw new Exception('Wrong file name or connection type!');
    	}
    		
    }

    Archont12, 29 Марта 2012

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

    +28

    1. 1
    2. 2
    3. 3
    function _spb_similar_similar_video_html(&$item, $key) {
      $item = htmlspecialchars($item, ENT_NOQUOTES);
    }

    brainstorm, 29 Марта 2012

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

    +130

    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
    int i,j;
    	char alph[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    	//Подстановка по таблице 1
    	int S_there[26][8]={{1,0,0,1,1,0,0,1},{1,0,0,0,1,0,0,0},{1,0,1,0,1,0,1,0},{0,0,1,1,0,0,1,1},{1,1,1,0,0,0,0,1},
    {1,0,0,0,0,1,1,1},{1,1,1,1,1,1,1,1},{1,1,0,1,0,0,1,0},{0,1,1,1,1,0,0,0},{1,1,0,0,0,0,1,1},{1,0,1,0,0,1,0,1},{0,1,0,0,1,0,1,1},
    {0,0,0,1,1,1,1,0},{0,1,0,1,0,1,0,1},{1,1,0,0,1,1,0,0},{0,0,0,1,0,0,0,1},{1,1,0,1,1,1,0,1},{1,0,1,1,0,1,0,0},{0,0,1,0,1,1,0,1},
    {0,0,0,0,0,0,0,0},{0,1,1,0,0,1,1,0},{0,1,0,0,0,1,0,0},{1,1,1,1,0,0,0,0},{0,0,1,1,1,1,0,0},{0,1,1,0,1,0,0,1},{0,0,1,0,0,0,1,0}};
    	
    	char str[]="THIISATESTFILEFORCHECKINGCYPHERMODULE";
    	int len=strlen(str);
        	int num[len];//массив с порядковыми номерами
    	int vector[len][8];//массив с ОТ, переведённым в двоичные вектора длины 8
    
    	for (i=0; i< len; i++)//Присваиваем каждой букве порядковый номер (а=0,b=1 и т.д.)
    	{
    		num[i]=((strchr(alph, str[i])-alph)% 26 + 0x01);
    		num[i]--;
    	}
    
    	for (i=0; i<len; i++)//Меняем букву на двоичный вектор длины 8 согласно порядковому номеру
    	{
    		int number=num[i];//счётчик текста
    		for (j=0; j<8; j++)
    		{
    			vector[i][j]=S_there[number][j];
    		}
    	}
    	for (i=0; i<len; i++)//Вывод на экран ОТ
    	{
    		for (j=0; j<8; j++)
    		{
    			printf("%u",vector[i][j]);
    		}
    		printf(" %c\n",str[i]);
    	}

    Нашёл в своей очень старой лабе...Нужно было буквы на входе преобразовать в двоичные вектора (например, а=10011001, b=10001000 и т.д.) ну и дальше ковыряться с этими векторами...почему я категорически не захотел тогда использовать case - хз :)))

    Pecho, 29 Марта 2012

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

    +118

    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
    Params.Name                 =   GetControl(pnlName) ? edName.Text : "";                                    
    Params.DateMeasurement      =   TOperation.GetDateValue(edDateTime);            
    Params.HalfYear             =   pnlHalfYear.Tag                        != null &&      
                                                    pnlHalfYear.Tag                        is bool && 
                                                    (bool)pnlHalfYear.Tag                          &&
                                                    edHalfYear.SelectedItem         != null &&
                                                    edHalfYear.SelectedItem.Value   != null &&
                                                    edHalfYear.SelectedItem.Value   is byte ? (byte)
                                                    edHalfYear.SelectedItem.Value   : (byte)0;
    Params.IdDepSource          =   GetControl(pnlDepSource) ? TDataList.GetComboRecId(edDepSource) : 0;          
    Params.IdDepSource2         =   pnlDepSource2.Tag                        != null &&      
                                                    pnlDepSource2.Tag                        is bool && 
                                                    (bool)pnlDepSource2.Tag                          ?
                                                    TDataList.GetComboRecId(edDepSource2) : 0;
    Params.Salt                 =   pnlDepSource2.Tag                        != null &&      
                                                    pnlDepSource2.Tag                        is bool && 
                                                    (bool)pnlDepSource2.Tag                          ?
                                                    getSalt()                               : 0;
    Params.Description          =   edComment.Text;

    ацкий код сохранения параметров. Досталось в наследство. Автор кода естественно имеет в/о факультета компьютерных педиков.

    gcoder, 29 Марта 2012

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