1. Лучший говнокод

    В номинации:
    За время:
  2. C# / Говнокод #18356

    +145

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    protected virtual void OnDisconnected()
    {
    		DispatcherHelper.CheckBeginInvokeOnUI(() =>
    		{
    			...
    			Cameras.ToList().Clear();
    			Meltings.ToList().Clear();
    			Spans.ToList().Clear();
    			...
    		});
    }

    Очищаем коллекции с данными, привязанные на списковые контролы UI. Доступ к свойствам Cameras, Meltings, Spans только через IEnumerable<>. Как же их очистить?

    elmanav, 18 Июня 2015

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

    +144

    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
    public String tommorowCalendarCountry(String date, String country){
    		String tommorowCountry = null;
    		if(date.equals(getTommorow())){
    			tommorowCountry =  country;
    		}
    		return tommorowCountry;
    	}
    	
    	public String tommorowCalendarIndicator(String date, String indicator){
    		String tommorowIndicator = null;
    		if(date.equals(getTommorow())){
    			tommorowIndicator =  indicator;
    		}
    		return tommorowIndicator;
    	}
    	
    	public String tommorowCalendarImportance(String date, String importance){
    		String tommorowImportance = null;
    		if(date.equals(getTommorow())){
    			tommorowImportance =  importance;
    		}
    		return tommorowImportance;
    	}
    	
    	public String tommorowCalendarForecast(String date, String forecast){
    		String tommorowForecast = null;
    		if(date.equals(getTommorow())){
    			tommorowForecast =  forecast;
    		}
    		return tommorowForecast;
    	}
    	
    	public String tommorowCalendarPrevious(String date, String previous){
    		String tommorowPrevious = null;
    		if(date.equals(getTommorow())){
    			tommorowPrevious =  previous;
    		}
    		return tommorowPrevious;
    	}
    	
    	public String tommorowCalendarActual(String date, String actual){
    		String tommorowActual = null;
    		if(date.equals(getTommorow())){
    			tommorowActual =  actual;
    		}
    		return tommorowActual;
    	}
    	
    	public String tommorowCalendarDescription(String date, String description){
    		String tommorowDescription = null;
    		if(date.equals(getTommorow())){
    			tommorowDescription =  description;
    		}
    		return tommorowDescription;
    	}
    	
    	public String tommorowCalendarPeriod(String date, String period){
    		String tommorowPeriod = null;
    		if(date.equals(getTommorow())){
    			tommorowPeriod =  period;
    		}
    		return tommorowPeriod;
    	}
    	
    	public String tommorowCalendarLocation(String date, String location){
    		String tommorowLocation = null;
    		if(date.equals(getTommorow())){
    			tommorowLocation =  location;
    		}
    		return tommorowLocation;
    	}

    пришло с аутсорса. Такого в проекте очень много)

    slavik, 15 Июня 2015

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

    +143

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    int i = 132,
        *ii = &i,
        **iii = &ii,
        ***iiii = &iii,
        ****iiiii = &iiii,
        *****iiiiii = &iiiii,
        ******iiiiiii = &iiiiii;
    
        printf("%d", ******iiiiiii);

    Забавно

    warzes, 11 Июня 2015

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

    −390

    1. 1
    2. 2
    3. 3
    4. 4
    openUTButton.frame = CGRectMake(SCREEN_WIDTH - (IS_IPAD ? 225. : 120.) - (IS_IPAD ? 40. : 20),
                                            IS_IPAD ? 40. : 20.,
                                            IS_IPAD ? 225 : 120.,
                                            IS_IPAD ? 60. : 35.);

    И так для каждого элемента интерфейса и каждый раз при смене ориентации - просто тернарный фетишизм.

    Psionic, 26 Мая 2015

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

    −129

    1. 1
    2. 2
    except Exception:
        raise

    3_14dar, 25 Мая 2015

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

    +142

    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
    <?php
      $file1 = 'D:\file.txt';
      $fo1 = fopen($file1,"r");
      $array = array(1=>'б',2=>'в',3=>'г',4=>'д',5=>'ж',6=>'з',7=>'й',8=>'к',9=>'л',10=>'м',11=>'н',12=>'п',
      13=>'р',14=>'с',15=>'т',16=>'ф',17=>'х',18=>'ц',19=>'ч',20=>'ш',21=>'щ');
      $shetchik = 0;
      $t=0;
      
      while (!feof($fo1))
      {
          $line2 = fgets($fo1); 
    
                $line = strtolower($line2);   
          for ($j=0;$j<strlen($line);$j++)
          {
              
              $char = $line[$j];
              
          if(in_array($line[$j],$array))
          {
              $index = array_keys($array,$line[$j]);
              $int = $index[0];
          
          if ($int-$t>=1) 
          {
              $shetchik++;
              $t = $int;
          }   
          else
            {
            $t=0;
            $shetchic=0;
            }
            if ($shetchik==4) echo "$line2<br>";    
          }
          }
      }  
    ?>

    шедевр

    php_makaka, 22 Мая 2015

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

    +145

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if (count($stores) == 1) {
        foreach ($stores as $store) {
            $storeId = $store->id;
        }
    }

    jbot, 18 Мая 2015

    Комментарии (6)
  9. JavaScript / Говнокод #18105

    +144

    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
    class Select
      constructor: ->
        Select = this
    
    
    ###
    
    var Select;
    
    Select = (function() {
      function Select() {
        Select = this;
      }
    
      return Select;
    
    })();

    код на coffeescript. до сих пор годаю - зачем?

    frozfox, 01 Мая 2015

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

    +144

    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
    cs_zagl.Edit;
          cs_zagl.fieldbyname('count_z').asinteger:=cs_tab.RecordCount;
          cs_zagl.Post;
    
    cs_mk.Edit;
    cs_mk.FieldByName('med_kart_id').Asinteger:=select_row_Form.ClientDataSet1.FieldByName('id_kart').asinteger;
    cs_mk.FieldByName('id_kart_public').Asinteger:=select_row_Form.ClientDataSet1.FieldByName('id_kart_public').asinteger;
    cs_mk.FieldByName('id_pac').Asinteger:=select_row_Form.ClientDataSet1.FieldByName('id_pac').asinteger;
    cs_mk.FieldByName('type_kart').asinteger:=select_row_Form.ClientDataSet1.FieldByName('type_kart').asinteger;
    cs_mk.post;
    
    
          IF (cs_mk.FieldByName('med_kart_id').Value=0) or (cs_mk.FieldByName('type_kart').asinteger<>27) then begin
          cmd := VarArrayCreate([0,20],varVariant);
          cmd[1] := 6832;
          cmd[2] := 17;
          cmd[5] := 1;
          cmd[6] := 0;
          ProvOptions := [grMetadata, grReset];
          cmd[7] := dsp_mk.GetRecords(-1, RecsOut, Byte(ProvOptions));
    
    
      try
    
        rez := MainFormInterface.EXT_call_server('spr_read', cmd);
        cs_tab.Edit;
        cs_tab.FieldByName('med_kart_id').Asinteger:=rez[3];
        cs_tab.Post;
    
    
    
        if rez[1] < 0 then begin
          debug_sql('Ошибка: ' + varastype(rez[1], varstring), 2);
          MessageDlg('Ошибка: '+ #10 + #13 +
                     varastype(rez[1],varstring),mtError,[mbok],0);
          Exit;
        end;
    
    
       except
        on e:exception do
        begin
          MessageDlg(ERROR_MESS_5 + 'Исключение:' + E.ClassName + 'Mess:' + E.Message, mterror, [mbok], 0);
          debug_sql('Ошибка записи документа!', 2);
          debug_all('Err при записи документа тип=' + varastype(cmd[1], varstring)+
                   ' id=' + inttostr(id_doc) + 'Исключение:' + E.ClassName + 'Mess:' + E.Message,2);
    
        end;
      end;
    
    
    
    
    
          end;
          end else begin
    
          
    
    
          end;
          end
          else exit;
    
    
       end else
         begin
        id_pac:=rez[3];
        id_med_kart:=rez[2];
        Application.MessageBox(pchar('Ошибка: '+#10+#13+
               'Даный пациент не найден!!!'),pchar(application_title_short),MB_OK+MB_ICONERROR);
        exit;
        end;
    
    end;

    Это называется стиль

    tucvbif, 29 Апреля 2015

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

    +142

    1. 1
    2. 2
    3. 3
    TCompareType = (ctGT, ctGE, ctLT, ctLE, ctEQ, ctNE, ctIsIn, ctNIsIn,
        ctLike, ctNLike, ctNull, ctNNull, ctBetween, ctNotBetween, ctExists,
        ctNotExists);

    Преклоняюсь перед истинным ниндзя. Ходил не обращал на ...код, но видимо я осознал глубокий смысл этого пути).

    ViktorR, 28 Апреля 2015

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