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

    +133

    1. 1
    2. 2
    Не поленись, пройди по анкетам и поставь всем минусы.
    минуисуя участников, ты помогаешш обществу.

    Stertor, 08 Июля 2013

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

    +161

    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
    </if>
    															</if>
    														</ul>
    													</if>
    												</td>
    												</if>
    											</tr>
    										</if>
    									</foreach>
    								</table>
    							</div>
    						</div>
    						<br />
    					</div>
    				</if>
    			</foreach>
    		</if>
    	</div>

    facepalm

    CheshirskyCode, 08 Июля 2013

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

    −110

    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
    // last parameter is the setter code if value allowed to be set
    #define SET_USING_CONFIG(cellSwitch,configKey,...)\
                cell.cellSwitch = [(EExhibitorsListConfigItem*)[self.configInfo configItemAtIndex:0] configKey];\
                if (cell.cellSwitch) {\
                    __VA_ARGS__;\
                }
    
     SET_USING_CONFIG(isLikesCountOn, showLikes,
        cell.likesCount = exhibitor.Rating;
        cell.likedByMe  = exhibitor.IsRated; );
    
    SET_USING_CONFIG(isInFavoritesOn, showFavoritesIndicator,
                         
        __weak EExhibitorCell *weakCell = cell;
    
        cell.didChangeFavouritesStateBlock = ^(BOOL newFavState) {
            [EExhibitorsListViewController updateFavoriteState:newFavState
                              ofExhibitor:exhibitor
                                   inCell:weakCell];
        };
    );

    Define master!

    Headless, 08 Июля 2013

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

    +136

    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
    function NameBro() {
        var userAgent = navigator.userAgent.toLowerCase();
        // Определим Internet Explorer
        if (userAgent.indexOf("msie") != -1 && userAgent.indexOf("opera") == -1 && userAgent.indexOf("webtv") == -1) {
            return "msie";
     	}
     	// Opera
     	if (userAgent.indexOf("opera") != -1) {
     		return "opera";
        }
     	// Gecko = Mozilla + Firefox + Netscape
        if (userAgent.indexOf("gecko") != -1) {
     		return "gecko";
        }
        // Safari, используется в MAC OS
        if (userAgent.indexOf("safari") != -1) {
     		return "safari";
        }
        // Konqueror, используется в UNIX-системах
        if (userAgent.indexOf("konqueror") != -1) {
     		return "konqueror";
        }
        return "unknown";
    }
    
    var bro = NameBro();
    
    $(function() {
    if(bro == "msie") {
    	$("body").html("Пшел нах с маего супир сайта бамжара ибаная. И где ты только комп взял украл или на памойки нашел? Харашо нынчи бамжы жывут сук пздц((");
    	window.location.hash = "Сматри бомж тибя дажы в адресной страке затралли азазазаз.";
    }
    })

    PragramistOtBoga, 08 Июля 2013

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

    +154

    1. 1
    list($V_id, $V_image, $V_title, $V_text, $V_url, $V_link_to, $V_status) = array('','','','','','','');

    множественное присваивание?! не, не слыщал

    dead_star, 08 Июля 2013

    Комментарии (59)
  6. Си / Говнокод #13322

    +139

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    #define InlineIsEqualGUID(rguid1, rguid2)  \
            (((unsigned long *) rguid1)[0] == ((unsigned long *) rguid2)[0] &&   \
            ((unsigned long *) rguid1)[1] == ((unsigned long *) rguid2)[1] &&    \
            ((unsigned long *) rguid1)[2] == ((unsigned long *) rguid2)[2] &&    \
            ((unsigned long *) rguid1)[3] == ((unsigned long *) rguid2)[3])

    Windows SDK, guiddef.h

    ret = InlineIsEqualGUID(&g_guid, guid_array + i); /* ??? */

    serg_ik, 07 Июля 2013

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

    +139

    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
    // ==UserScript==
    // @name		GK parent comment
    // @namespace	GK
    // @description	Adds links to parent commentary to GK comments, and sets parent commentary text as link tooltip.
    // @include	http://govnokod.ru/*
    // @include	http://www.govnokod.ru/*
    // @version	1.0.0
    // @updateURL	http://userscripts.org/scripts/source/172756.meta.js
    // @downloadURL http://userscripts.org/scripts/source/172756.user.js
    // ==/UserScript==
    
    (function(){
    //hack for Chrome, as it doesn't support unsafeWindow.
    if (typeof unsafeWindow == 'undefined')
    	{
    	unsafeWindow = (function() 
    		{
    		var el = document.createElement('p');
    		el.setAttribute('onclick', 'return window;');
    		return el.onclick();
    		}())
    	};
    $ = unsafeWindow.jQuery;
    
    //dirty, DIRTY hack to wait for certain element to appear. -_- 
    //But I have no idea how to do it right.
    function waitForSelector(selector, context, mustexist, callback) {
    	var l = $(selector, context).length;
    	if ((l>0) != mustexist)
    		{
    		setTimeout(function(){waitForSelector(selector, context, mustexist, callback)}, 50);
    		return false;
    		};
    	callback();
    	}
    
    //short function for adding custom CSS rules. Why use Greasemonkey specific GM_setStyle() just for that?
    function addCSS(rule) {
    	var styleElement = document.createElement("style");
    	styleElement.type = "text/css";
    	if (typeof styleElement.styleSheet !== 'undefined')
    		styleElement.styleSheet.cssText = rule;
    	else
    		styleElement.appendChild(document.createTextNode(rule));
    	document.getElementsByTagName("head")[0].appendChild(styleElement);
    	}
    
    addCSS([
    	'.comment-parent-link {margin-left:10px;font-size:10pt}',
    	].join('/n'));
    
    var PARENT = '<a class="comment-link comment-parent-link" href="">↑</a>';
    
    var oldLoadComments = unsafeWindow.comments['load'];
    
    function newLoadComments(aElemTrigger) {
    	var $parent = $(aElemTrigger).closest('.entry-comments');
    	oldLoadComments.call(this,aElemTrigger);
    	waitForSelector('.hcomment', $parent, true, function(){
    		setParentLinks($parent);
    		});
    	}
    
    unsafeWindow.comments['load'] = newLoadComments;
    	
    function setParentLinks($context) {
    	$context.find('.hcomment').each(function(i,e){
    		var $this = $(this);
    		var $parent = $this.parents('.hcomment:eq(0)');
    		if ($parent.length) {
    			var $parentlink = $(PARENT);
    			$parentlink.attr('href', $parent.find('a.comment-link:eq(0)').attr('href'));
    			$parentlink.attr('title', $parent.find('.comment-text:eq(0)').text());
    			$this.find('a.comment-link:eq(0)').after($parentlink);
    			}
    		});
    	}
    
    setParentLinks($('body'));
    })();

    http://userscripts.org/scripts/show/172756
    По просьбам трудящихся, скрипт для поиска родительского комментария. Добавляет ссылку на родителя, и ставит его текст как тултип.
    Учитывая подключение либы с самого сайта и метод поиска динамически подгруженных комментариев, вполне себе говнокод. А потому: тов. Страйкер, вынесите уже отдельно функцию comments.loadSuccessful()! А то адский гемморой любую постобработку комментариев делать.

    Vindicar, 07 Июля 2013

    Комментарии (105)
  8. Куча / Говнокод #13320

    +125

    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
    <Target Inputs="@(DeployLabel)" Name="GenericDeploy" Outputs="%(Identity).Dummy">
        <PropertyGroup>
          <TargetFilter>%(DeployLabel.Dir)</TargetFilter>
          <TargetFilterReplaced>$(TargetFilter.Replace('\', ''))</TargetFilterReplaced>
        </PropertyGroup>
        <WriteLinesToFile
            File="$(ProjectDir)tsfiles.txt"
            Condition="$([System.Text.RegularExpressions.Regex]::IsMatch(%(Filter),
                       '$(TargetFilterReplaced)'))"
            Lines="@(TypeScriptCompile -&gt;'&quot;%(fullpath)&quot;', ' ')"
            Overwrite="false" />
        <PropertyGroup>
          <TSFilesFiltered>$([System.IO.File]::ReadAllText($(ProjectDir)tsfiles.txt))</TSFilesFiltered>
          <TSFilesOneLine>$([System.Text.RegularExpressions.Regex]::Replace(
          $(TSFilesFiltered), "[\n\r]+", " "))</TSFilesOneLine>
        </PropertyGroup>
        <Exec Command="tsc --target ES3 -c -d --out $(Deployroot)\foo.js $(TSFilesOneLine)" />
        <Delete Files="$(ProjectDir)tsfiles.txt"/>
      </Target>

    Кто не был, тот будет, кто был, тот не забудет.
    MSBuild: задача отфильтровать массив из строк. Я за два дня ничего лучшего не придумал.

    wvxvw, 07 Июля 2013

    Комментарии (3)
  9. Pascal / Говнокод #13319

    +140

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    procedure TForm1.CloseChecker1Click(Sender: TObject);
    begin
    Halt;
    end;
    
    procedure TForm1.CoolTrayIcon1DblClick(Sender: TObject);
    begin
    Form1.Show;
    CoolTrayIcon1.IconVisible:=false;
    end;
    
    end.

    Продолжение. Начало на http://govnokod.ru/13317, http://govnokod.ru/13318

    Stertor, 06 Июля 2013

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

    +139

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    procedure TMyTr.Execute;
    var
    s,resp,ip,port:string;
    cw,i:integer;
    begin
      http:=TIdHTTP.Create(nil);
      cw:=getnumberproxy;
      while cw<form1.Memo1.Lines.Count do
      begin
        s:=form1.Memo1.Lines[cw];
        i := Pos(':',s);
        IP := Copy(s,1,i-1);
        PORT := Copy(s,i+1,Length(s));
    
        try
          http.ProxyParams.ProxyServer:=ip;
          http.ProxyParams.ProxyPort:=StrToInt(port);
          http.ReadTimeout:=Form1.SpinEdit2.Value*1000;
          resp:=http.Get('http://ya.ru/');
          if pos('ya.ru',resp)<>0 then
          form1.Memo2.Lines.Add(ip+':'+port);
          except
            end;
          cw:=getnumberproxy;
          checked:=checked+1;
          end;
      http.Free;
    
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var i:integer;
    begin
      ind:=-1;
      label6.caption:=inttostr(Memo1.Lines.count);
      for i:=1 to spinedit1.Value do
      begin
        thr[i]:=TMyTr.Create;
        thr[i].Pause(1);
        thr[i].Resume;
      end;
    end;
    
    procedure TForm1.Timer1Timer(Sender: TObject);
    begin
    form1.label4.caption:=IntToStr(Form1.Memo2.Lines.Count);
    Form1.Label6.Caption:=IntToStr(form1.Memo1.Lines.Count);
    Form1.Label3.Caption:=IntToStr(checked);
    
    end;
    
    
    
    procedure TForm1.Button2Click(Sender: TObject);
    begin
    Form1.Memo1.Clear;
    end;
    
    procedure TForm1.Button4Click(Sender: TObject);
    begin
    Form1.Memo2.Clear;
    end;
    
    procedure TForm1.Button5Click(Sender: TObject);
    begin
    if SaveDialog1.Execute=true then
    Form1.Memo2.Lines.SaveToFile(Form1.SaveDialog1.FileName);
    end;
    
    procedure TForm1.Button3Click(Sender: TObject);
    begin
    if Form1.OpenDialog1.Execute=True
    then
    Form1.Memo1.lines.LoadFromFile(Form1.OpenDialog1.FileName);
    end;
    
    
    procedure TForm1.Button6Click(Sender: TObject);
    begin
    Form1.CoolTrayIcon1.IconVisible:=True;
    Form1.Hide;
    end;
    
    procedure TForm1.Show1Click(Sender: TObject);
    begin
    Form1.Show;
    Form1.CoolTrayIcon1.IconVisible:=false;
    end;
    
    procedure TForm1.SaveGood1Click(Sender: TObject);
    begin
    if SaveDialog1.Execute=true then
    Form1.Memo2.Lines.SaveToFile(Form1.SaveDialog1.FileName);
    
    end;
    
    procedure TForm1.ClearGood1Click(Sender: TObject);
    begin
    Form1.Memo2.Clear;
    end;

    Продолжение. Начало на http://govnokod.ru/13317

    Stertor, 06 Июля 2013

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