1. Куча / Говнокод #12418

    +127

    1. 1
    2. 2
    3. 3
    4. 4
    <select name="animals">
    		<option value="1" addTags="<div class='kv'></div>">Медведь</option>
    		<option value="2" addTags="<input type='checkbox' />">Волк</option>
    </select>

    html в js - это прошлый век =)
    http://www.xiper.net/collect/html-and-css-tricks/verstka-form/nice-select-jquery.html

    RedMonkey, 14 Января 2013

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

    −89

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def") {
                    options.ad_started();
                    var fn:Function = function ():void {
                        options.ad_finished();
                    };
                    setTimeout(fn, 100);
                    return;
                }

    сегодня в выпуске - как задизаблить мойшеадс лёгким движением руки в любой флешке, скомпиленной со стандартной либой

    makc3d, 14 Января 2013

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

    −107

    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
    -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {	
    	return 6;
    }
    
    -(UITableViewCell *) tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
    	static NSString *kCellIdentifier = @"";
    	switch (indexPath.row) 
    	{
    		case 0:
    			kCellIdentifier = @"SpaceCell";
    			break;
    		case 1:
    			kCellIdentifier = @"LoginCell";
    			break;
    		case 2:
    			kCellIdentifier = @"PasswordCell";
    			break;
    		case 3:
    			kCellIdentifier = @"EmailCell";
    			break;
    		case 4:
    			kCellIdentifier = @"BirhtdayCell";
    			break;
    		default:
    			kCellIdentifier = @"ForgotCell";
    			break;
    	}
    	UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:kCellIdentifier] autorelease];
    	cell.selectionStyle = UITableViewCellSelectionStyleNone;
    	cell.backgroundColor = [UIColor clearColor];
    	cell.backgroundView.backgroundColor = [UIColor clearColor];
    
    	if (indexPath.row == 1)
    	{
    		[self backgroundCells:cell fileImage:@"top_downlayer.png"];
    		self.loginTextField.text = userName;
    		self.loginTextField.placeholder = @"User Name";
    		self.loginTextField.frame = CGRectMake(10.0f, 10.0f, 300.0f, 30.0f);
    		[cell.contentView addSubview:self.loginTextField];
    	}
    	else if (indexPath.row == 2)
    	{
    		[self backgroundCells:cell fileImage:@"middle_downlayer.png"];
    		self.passwordTextField.text = password;
    		self.passwordTextField.placeholder = @"Password";
    		self.passwordTextField.frame = CGRectMake(10.0f, 8.0f, 300.0f, 30.0f);
    		[cell.contentView addSubview:self.passwordTextField];
    	}
    	else if (indexPath.row == 3)
    	{
    		[self backgroundCells:cell fileImage:@"middle_downlayer.png"];
    		self.email.text = emailString;
    		self.email.placeholder = @"Email";
    		self.email.frame = CGRectMake(10.0f, 7.0f, 300.0f, 30.0f);
    		[cell.contentView addSubview:self.email];
    	}
    	else if (indexPath.row == 4)
    	{
    		[self backgroundCells:cell fileImage:@"middle_downlayer.png"];
    		UIImageView *inputIV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"input_login.png"]];
    		inputIV.frame = CGRectMake(20, 8, 280, 28);
    		[inputIV setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
    		[cell addSubview:inputIV];
    		[inputIV release];
    						
    		if (![resultsDate.text length])
    		{
    			UILabel *birhtdayLabel = [[UILabel alloc] initWithFrame:CGRectMake(29, 12, 150, 20)];
    			birhtdayLabel.text = @"Birthday";
    			[birhtdayLabel setTextAlignment:UITextAlignmentLeft];
    			[birhtdayLabel setFont: [UIFont fontWithName:@"Arial" size:17.0f]];
    			[birhtdayLabel setTextColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:0.25]];
    			[birhtdayLabel setHighlightedTextColor:[UIColor whiteColor]];
    			[birhtdayLabel setBackgroundColor:[UIColor clearColor]];
    			[birhtdayLabel setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
    			[cell addSubview:birhtdayLabel];
    			[birhtdayLabel release];
    		}
    		else
    			[cell addSubview:resultsDate];
    	}
    	else if (indexPath.row == 5)
    	{
    		[self backgroundCells:cell fileImage:@"down_downlayer.png"];
    		UIImage *buttonBackgroundPressed = [UIImage imageNamed:@"search_btn_act.png"];
    		UIImage *buttonBackground = [UIImage imageNamed:@"search_btn.png"];
    		UIButton *singUpButton = [CustomButton buttonWithTitle:@"SIGN UP" target:self selector:@selector(singUpTouchAction:) frame:CGRectMake(20, 6, 280, 28) image:buttonBackground imagePressed:buttonBackgroundPressed];
    		singUpButton.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
    		singUpButton.autoresizingMask = UIViewAutoresizingFlexibleWidth;
    		[cell addSubview:singUpButton];
    	}
    	return cell;
    }

    Старый проект. Открыл класс наугад.

    Так кто-то строил форму для регистрации юзера. Каждое поле в форме - уникально.

    QuickNick, 14 Января 2013

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

    +55

    1. 1
    2. 2
    3. 3
    $result["rg"][count($result["rg"])-1]["status"][] = Array();
    $c_res = count($result["rg"][count($result["rg"])-1]["status"])-1;
    $result["rg"][count($result["rg"])-1]["status"][$c_res] = $arr_source_data[$i];

    Им за число строк платят, что ли?

    clauclauclau, 14 Января 2013

    Комментарии (15)
  5. JavaScript / Говнокод #12414

    +157

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    var onClear = function(e)
                {
                    if(e.value == "Логин" || e.value == "Пароль")
                        {
                            e.value = "";
                        }
                }

    <input type="text" name="login" value="Логин" onclick="onClear(this);"/>
    Ох блин...

    Govnisti_Diavol, 14 Января 2013

    Комментарии (22)
  6. C++ / Говнокод #12413

    +23

    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
    volatile bool b;
    
    class BoolKeeper
    {
      bool &fb;
    public:
      BoolKeeper(bool &b) 
      {
        while (b);
        b = true;
      }
      ~BoolKeeper ()
      {
        b = false;
      }  
    }
    
    void Thread1
    {
      BoolKeeper ololo(b);
      // что-то делаем
    }
    
    void Thread2
    {
      // что-то делаем
      BoolKeeper ololo(b); 
      // что-то делаем, причём в этом месте нам важен факт, что Thread1 не выполняется
    }

    http://www.gamedev.ru/flame/forum/?id=171558

    LispGovno, 13 Января 2013

    Комментарии (219)
  7. C++ / Говнокод #12412

    +19

    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
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <iostream>
    }
    void main (){
    int prog=0,n;
    
    printf ("Which programm?  ");
    scanf ("%d",&prog);
    
    if (prog==1){
    int glas=0,sogl=0,j=0,k=0;
     char *s,*l,*m;
     s=(char*)calloc(20,sizeof(char));
     l=(char*)calloc(20,sizeof(char));
     m=(char*)calloc(20,sizeof(char));
     flushall();
     printf ("\nEnter text:  ");
     gets(s);
     n=strlen(s);
     /*Разбиваем на два массива исходную строку*/
     for (int i=0;i<n;i++){
    if(s[i]=='a'||s[i]=='q'||s[i]=='e'||s[i]=='y'||s[i]=='u'||s[i]=='i'||s[i]=='o'||s[i]=='j'){ l[j]=s[i]; glas++;j++;}
    if(s[i]=='g'||s[i]=='f'||s[i]=='d'||s[i]=='s'||s[i]=='p'||s[i]=='t'||s[i]=='r'||s[i]=='w'||s[i]=='h'||s[i]=='k'||s[i]=='l'||s[i]=='z'||s[i]=='x'||s[i]=='c'||s[i]=='v'||s[i]=='b'||s[i]=='b'||s[i]=='n'||s[i]=='m'){ m[k]=s[i];sogl++;k++;}
       }
        printf ("\nDivided:\n");
     puts(l);puts(m);
    /*Сортируем каждый массив*/
     char c=51,d=11;
     for(j=0;j<sogl;j++) {for (int i=0;i<sogl;i++){if (m[i]>m[i+1] && (i+1)<sogl){d=m[i+1];  m[i+1]=l[i];  m[i]=d;}}}
     for(j=0;j<glas;j++){ for (int i=0;i<glas;i++){if (l[i]>l[i+1] && (i+1)<glas){c=l[i+1];  l[i+1]=l[i];  l[i]=c;}}}
     
      printf ("\nFinal:\n");
     puts(l);
     flushall();
     puts(m);
     }

    Источник: http://otvety.google.ru/otvety/thread?tid=78a81d7ac11a8804&table=/otvety/topics?clk=lftpn&tab=wtmtosb
    Цитата: "Задача: Написать программу для обработки строки следующим образом: вначале должны идти гласные буквы, упорядоченные по возрастанию (aaeeiioo), затем согласные, упорядоченные по убыванию.
    Написал программу, она нормально сортирует гласные, но когда переходит к согласным - совершенно не работает."

    10a10b1s, 12 Января 2013

    Комментарии (171)
  8. C++ / Говнокод #12411

    +13

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    long a=1;
    for(;;)
    {
       long  *p_ex = new long;
       *p_ex = a++;
       std::cout << *p_ex << std::endl;
    }

    "У кого больше?" Или пытки компа утечкой памяти)

    FreeLife, 12 Января 2013

    Комментарии (34)
  9. C++ / Говнокод #12410

    +11

    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
    #include <QVector>
    #include <QString>
    
    template< class TYPE> 
      class call
      {
        public:
          call( TYPE& vl ): value(vl){}
          TYPE& value;
      };
    template< class TYPE> 
      call<TYPE> all( TYPE& vl ) 
        { return call<TYPE>(vl); }
    
    template< class TYPE_OUT, class TYPE> 
      void operator << ( TYPE_OUT& out, call<TYPE>& in )
    {
      TYPE& value = in.value;
      for( TYPE::iterator itr = value.begin() ; itr!=value.end(); itr++)
        out << *itr;
    }
    
    //**********************************************************************
    
    QVector<int> arr;
    QVector<QString> arrStr;
    class Cstream{} stream;
    
    void operator << ( Cstream& , const int value)
    {
      printf("%i\n",value);
    }
    void operator << ( Cstream& , const QString& value)
    {
      printf("%s\n",value.toAscii().data());
    }
    
    
    int main(int argc, char *argv[])
    {
      for( int i=0; i<6;i++)
        arr.push_back(i);
      arrStr << "asd" << "sadas" << "sadsa";
    
      stream << all(arr);
      stream << all(arrStr);
    return 0;
    }

    http://www.gamedev.ru/flame/forum/?id=171504
    > @При копирование на говнокод сохранять авторство.

    LispGovno, 11 Января 2013

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

    +127

    1. 1
    mainChartArea.Area3DStyle.Enable3D = (ShowIn3D.Checked) ? true : false;

    Если true - значит true)))

    tvv, 11 Января 2013

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