1. Список говнокодов пользователя ArtFeel

    Всего: 8

  2. Objective C / Говнокод #13969

    −121

    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
    @interface MICheckBox : UIButton{
        BOOL isChecked;
        AppDelegate * appp;
    }
    @property(nonatomic,assign)BOOL isChecked;
    @property(nonatomic,retain)AppDelegate * appp;
    -(IBAction) checkBoxClicked:(id)tt;
    @end
    
    
    @implementation MICheckBox
    
    - (id)initWithFrame:(CGRect)frame {
        self = [super initWithFrame:frame];
        appp=(AppDelegate *)[[UIApplication sharedApplication]delegate];
    
        if (self) {
            self.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
           [self setImage:[UIImage imageNamed:@"cb_dark_off.png"] forState:UIControlStateNormal];
           [self addTarget:self action:@selector(checkBoxClicked:)forControlEvents:UIControlEventTouchUpInside];
       }
        return self;
    }
    
    -(IBAction)checkBoxClicked:(id)tt{
        MICheckBox *ss = (MICheckBox *)tt;
    
        if(self.isChecked ==NO){
            self.isChecked =YES;
            [self setImage:[UIImage imageNamed:@"cb_dark_on.png"]forState:UIControlStateNormal];
    
            int JumpTo_swichCase = ss.tag/1000;
            NSLog(@"---------------------------------------------------------------");
            NSLog(@"AAAAAAA Which Swich CASE==%d",JumpTo_swichCase);
    
    switch (JumpTo_swichCase) {
                case 12:{
                    if(ss.tag>=12100){
                         NSLog(@"AAAAAAA CK.tag=%d",ss.tag);
                        int GG = ss.tag;
                        GG=GG-12100;
                         NSLog(@"You have Cheked CK===%@",[appp.Arr_ZWhyDiditHappen objectAtIndex:GG]);
                        [appp.ArrSTATUS_CKWhyDidHappen addObject:[appp.Arr_ZWhyDiditHappen  objectAtIndex:GG]];
                    }else if (ss.tag>=12000){
                        NSLog(@"AAAAAAA CK.tag=%d",ss.tag);
                        int GG = ss.tag;
                        GG=GG-12000;
                         NSLog(@"You have Cheked CK===%@",[appp.Arr_ZhowYouFelt objectAtIndex:GG]);
                        [appp.ArrSTATUS_CKHowyouFelt addObject:[appp.Arr_ZhowYouFelt objectAtIndex:GG]];
                    }
    }break;
    
    default:{
    }break;
    }
    }
    
    //------------------------------------------------------------------------------------------
        else{
        self.isChecked =NO;
        [self setImage:[UIImage imageNamed:@"cb_dark_off.png"]forState:UIControlStateNormal];
    
        int JumpTo_swichCase = ss.tag/1000;
        NSLog(@"---------------------------------------------------------------");
        NSLog(@"RRRRRRRR Which Swich CASE==%d",JumpTo_swichCase);
    
    switch (JumpTo_swichCase) {
        case 12:{
            if(ss.tag>=12100){
                NSLog(@"RRRRRRRR CK.tag=%d",ss.tag);
                int GG = ss.tag;
                GG=GG-12100;
                NSLog(@"You have Cheked CK===%@",[appp.Arr_ZWhyDiditHappen objectAtIndex:GG]);
                [appp.ArrSTATUS_CKWhyDidHappen removeObject:[appp.Arr_ZWhyDiditHappen  objectAtIndex:GG]];
            }else if (ss.tag>=12000){
                NSLog(@"RRRRRRRR CK.tag=%d",ss.tag);
                int GG = ss.tag;
                GG=GG-12000;
                NSLog(@"You have Cheked CK===%@",[appp.Arr_ZhowYouFelt objectAtIndex:GG]);
                [appp.ArrSTATUS_CKHowyouFelt removeObject:[appp.Arr_ZhowYouFelt objectAtIndex:GG]];
            }
        }break;
    
    default:{
    }break;
    }
    } 
    }

    Вот такой вот чекбокс. Пример использования внутри.

    ArtFeel, 18 Октября 2013

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

    −99

    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
    - (void)initPlayerViewController
    {
    	BOOL isSuccess = NO;
    	do {
    		NSString *linkString = nil;
    		unsigned long long objectID = [_videoID intValue];
    		
    		int index = GetElementIndex(objectID, _WidevineTestStubs, WIDEVINE_TEST_COUNT);
    		if (index >= 0) {
    			//linkString = GetLink(_WidevineTestServers[index], _WidevineTestFiles[index]);
    			linkString = _WidevineTestLinks[index];
    		}
    		else {
    			linkString = GetString([_videoLink objectForKey:@"src"]);
    		}
    		if(linkString == nil)
    			goto _end;
    
    		self.linkType = GetLinkType(linkString);
    		switch (_linkType) {
    			case LINK_TYPE_HLS:
    				break;
    			case LINK_TYPE_WV_ADAPTIVE:
    			case LINK_TYPE_WV_MULTI:
    				linkString = WidevinePlay(linkString);
    				if ([linkString length] <= 0) {
    					goto _end;
    				}
    				break;
    			default:
    				goto _end;
    		}
    		
    		NSURL *link = [NSURL URLWithString:linkString];
    		if(link == nil)
    			break;
    
    		self.playerViewController = [[[MPMoviePlayerViewController alloc] initWithContentURL:link] autorelease];
    		_playerViewController.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
    		_playerViewController.moviePlayer.controlStyle = MPMovieControlStyleFullscreen;
    
    		NSInteger startPosition = GetInteger([_videoLink objectForKey:@"play_start_time"]);
    		if(startPosition > 0) {
    			_playerViewController.moviePlayer.initialPlaybackTime = (NSTimeInterval)startPosition;
    		}
    		
    		[self addControlsView];
    		NSArray *audioTracks = [_videoLink objectForKey:@"audio_list"];
    		if ([audioTracks count] < 2) {
    			UIButton *audioButton = (UIButton *)[_controlsView viewWithTag:TAG_BUTTON_CHANGE_AUDIO];
    			audioButton.enabled = FALSE;
    		}
    		
    		isSuccess = YES;
    	} while(0);
    _end:
    	if(isSuccess) {
    		[_delegate onPlayerCreated:self];
            [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
    	}
    	else {
    		[_delegate onLinkError:self];
    	}
    }

    Тут есть все, и do while(0), и проваливающиеся case'ы, и TRUE/FALSE, и глобальные inline методы, и даже goto.

    ArtFeel, 13 Июня 2013

    Комментарии (15)
  4. Objective C / Говнокод #13095

    −81

    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
    - (void)setCategory:(NSDictionary *)newCategory
    {
    	id category = [newCategory retain];
    	[_category release];
    	_category = category;
    	if(_category != nil) {
    		NSString *categoryID = GetString([_category objectForKey:@"id"]);
    		const CategoryViewData *data = FindCategoryViewData(categoryID);
    		if(data == NULL)
    			goto _clearView;
    
    		UIImage *buttonImage = [UIImage imageNamed:GetCategoryIconName(categoryID)];
    		[_titleButton setImage:buttonImage forState:UIControlStateNormal];
    		NSString *buttonTitle = [NSString stringWithFormat:@"  %@ ➤", data->buttonTitle];
    		[_titleButton setTitle:buttonTitle forState:UIControlStateNormal];
    		UIImage *buttonColorImage = [UIImage imageNamed:buttonColorImageName];
    		[_titleButton setTitleColor:[UIColor colorWithPatternImage:buttonColorImage] forState:UIControlStateNormal];
    		
    		_pageControl.onImage = [UIImage imageNamed:data->pageControlOnImageName];
    		_pageControl.currentPage = 0;
    		_pageControl.numberOfPages = numberOfPages;
    		
    		_allVideosLabel.text = [NSString stringWithFormat:@"Все %@", data->allVideosTitle];
    		
    		[self adjustVideoViews];
    	}
    	else {
    _clearView:
    		[_titleButton setImage:nil forState:UIControlStateNormal];
    		[_titleButton setTitle:nil forState:UIControlStateNormal];
    		[_titleButton setTitleColor:nil forState:UIControlStateNormal];
    		
    		_pageControl.onImage = nil;
    		_pageControl.currentPage = 0;
    		_pageControl.numberOfPages = 0;
    		
    		_allVideosLabel.text = nil;
    
    		for(CategoryRowCell *cell in _videoViews) {
    			[cell removeFromSuperview];
    		}
    		self.videoViews = nil;
    		_scrollView.contentSize = CGSizeZero;
    		_scrollView.contentOffset = CGPointZero;
    		_allVideosView.frame = CGRectMake(0, 0, CGRectGetWidth(_allVideosView.frame), CGRectGetHeight(_allVideosView.frame));
    		_allVideosView.hidden = YES;
    	}
    }

    Типичная ячейка

    ArtFeel, 03 Июня 2013

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

    +16

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    for (;!pool.isEmpty() || started;) {
                for (;!pool.isEmpty();) {
                    GramophoneEvent event = pool.poll();
                    event.apply(handler);
                }

    while для слабаков!

    ArtFeel, 02 Апреля 2013

    Комментарии (31)
  6. Куча / Говнокод #12403

    +136

    1. 1
    http://f.cl.ly/items/1B362r0E3T0z3E3v3A1f/Screen%20Shot%202013-01-10%20at%2011.01.45.png

    Это надо видеть.

    ArtFeel, 10 Января 2013

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

    +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
    //  define types
    const int FB2 = 0;
    const int TXT = 1;
    
    // private
    private int Type;
    …
    
    //  class methods
    public CVBook(string path, string type) {
        switch(type)
        {
            case "fb2":
                {
                    Type = 0;
                }
                break;
            case "txt":
                {
                    Type = 1;
                }
                break;
            default:
                {
                    throw new Exception("Unknown Book Format");
                }
        }
        …
        switch (Type) {
            case FB2: { … }
            case TXT: { … }
            default:
                {
                    throw new Exception("Unknown Book Format");
                }
            }
        }
    }

    Парсер книг, все в одном методе.

    ArtFeel, 30 Ноября 2012

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

    +106

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    private void FlowMouseEnter(object sender, MouseEventArgs e)
    {
        var dt = DateTime.Now;
        _currentTime = dt.Hour * 3600 + dt.Minute * 60 + dt.Second;
    }

    запоминаем время наведения на кнопку

    ArtFeel, 30 Ноября 2012

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

    +976

    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
    public void OpredelenieKletki(TipiReljefaMiraVelikogo tipKletkiEtt)
    {
    tipKletki = tipKletkiEtt;
     
    #region огромное назначение координат ректанглам вырезания из разнобоя
     
    if (kameraEtojKletki.sasUvelicenie)
    {
        switch (tipKletki)
        {
            case TipiReljefaMiraVelikogo.zelenaRovnaAA:
                malOcered = 1; kadrSasVirezanija = new Rectangle(0, kameraEtojKletki.sasKudaSmotrit * 79, 162, 79);
                smewenieSasKadra = new Vector2(18f, 98f); animacijaLi = false; nomRaznoboja = 19; break;
            case TipiReljefaMiraVelikogo.zelenaRovnaBB:
                malOcered = 1; kadrSasVirezanija = new Rectangle(0, 316 + kameraEtojKletki.sasKudaSmotrit * 79, 162, 79);
                smewenieSasKadra = new Vector2(18f, 98f); animacijaLi = false; nomRaznoboja = 19; break;
            case TipiReljefaMiraVelikogo.zelenaRovnaCC:
                malOcered = 1; kadrSasVirezanija = new Rectangle(0, 632 + kameraEtojKletki.sasKudaSmotrit * 79, 162, 79);
                smewenieSasKadra = new Vector2(18f, 98f); animacijaLi = false; nomRaznoboja = 19; break;
            case TipiReljefaMiraVelikogo.zelenaRovnaDD:
                malOcered = 1; kadrSasVirezanija = new Rectangle(0, 948 + kameraEtojKletki.sasKudaSmotrit * 79, 162, 79);
                smewenieSasKadra = new Vector2(18f, 98f); animacijaLi = false; nomRaznoboja = 19; break;
     
            case TipiReljefaMiraVelikogo.zelenaRovnaVertPalkaAA:
                malOcered = 1; kadrSasVirezanija = new Rectangle(0, 1264 + kameraEtojKletki.sasKudaSmotrit * 79, 162, 79);
                smewenieSasKadra = new Vector2(18f, 98f); animacijaLi = false; nomRaznoboja = 19; break;
            case TipiReljefaMiraVelikogo.zelenaRovnaVertPalkaAb:
                malOcered = 1; kadrSasVirezanija = new Rectangle(0, 1580 + kameraEtojKletki.sasKudaSmotrit * 79, 162, 79);
                smewenieSasKadra = new Vector2(18f, 98f); animacijaLi = false; nomRaznoboja = 19; break;
     
            case TipiReljefaMiraVelikogo.zelenaRovnaVertPalkaBB:
                malOcered = 1; kadrSasVirezanija = new Rectangle(162, 1264 + kameraEtojKletki.sasKudaSmotrit * 79, 162, 79);
                smewenieSasKadra = new Vector2(18f, 98f); animacijaLi = false; nomRaznoboja = 19; break;
            case TipiReljefaMiraVelikogo.zelenaRovnaVertPalkaBc:
                malOcered = 1; kadrSasVirezanija = new Rectangle(162, 1580 + kameraEtojKletki.sasKudaSmotrit * 79, 162, 79);
                smewenieSasKadra = new Vector2(18f, 98f); animacijaLi = false; nomRaznoboja = 19; break;
    
         ... ... ...

    Класс который достает из спрайтшита нужную текстуру и передает её на отрисовку.

    ArtFeel, 21 Июля 2011

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