1. Objective C / Говнокод #10359

    −104

    1. 1
    2. 2
    3. 3
    4. 4
    + (NSArray *)findAll {
    	return [self findWithPredicate: [NSPredicate predicateWithFormat:@"1 = 1"]
    							 limit: 0];
    }

    Таки да, все объекты.

    farcaller, 24 Мая 2012

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

    +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
    PropertyAdminFormModel data = new PropertyAdminFormModel
                    { 
                        DateFinish = rep.DateFinish,
                        Name = rep.Name,
                        ReportingCircleId = rep.ReportingCircleId
                    };
    
                    if (data != null)
                    {
                        Id = reportId;
                        Name = data.Name;
                        DateFinish = data.DateFinish;
                        ReportingCircleId = data.ReportingCircleId;
                    }

    А вдруг!? =)

    DukeGonzo, 24 Мая 2012

    Комментарии (31)
  3. PHP / Говнокод #10357

    +58

    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
    <?php if ( $poll ) : ?>
    	<h2>Опрос: <?php echo $poll->getTitle(); ?></h2>
    	
    	<?php $count = $poll->votes->count(); ?>
    	
    	<div>Всего ответивших: <?php echo $count; ?></div>
    	
    	<?php if ( $sf_user->isAuthenticated() ) : ?>
    		
    		<?php if ( !$poll->isVote( $sf_user->getGuardUser()->getId() ) ) : ?>
    			
    			<?php foreach ( $poll->answers as $answer ) : ?>
    				<div><?php echo link_to( $answer->getTitle(), 'poll_vote', array( 'poll' => $poll->getId(), 'answer' => $answer->getId() ) ); ?></div>
    			<?php endforeach; ?>
    			
    		<?php else : ?>
    			
    			<?php foreach ( $poll->answers as $answer ) : ?>
    				<div><?php echo $answer->getTitle(); ?> ($count / <?php echo $answer->getPercent( $count ); ?>%)</div>
    			<?php endforeach; ?>
    			
    		<?php endif; ?>
    		
    	<?php else : ?>
    		
    		<?php foreach ( $poll->answers as $answer ) : ?>
    			<div><?php echo $answer->getTitle(); ?></div>
    		<?php endforeach; ?>
    		
    		<div>Что бы выбрать вариант ответа, необходимо войти.</div>
    		
    	<?php endif; ?>
    	
    <?php endif; ?>

    Пал выбор, делать проверку, голосовал пользователь или нет в цикле и выводить соответствующую инфу или сделать проверку и использовать два разных цикла в разных ветках

    psycho-coder, 24 Мая 2012

    Комментарии (2)
  4. Java / Говнокод #10356

    +127

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    pFirst = new LinePoints;
    pFirst->ptPixel.x = ptOrig.x*szStart.cx/15 + ptStart.x;
    pFirst->ptPixel.y = (15-ptOrig.y)*szStart.cy/15 + ptStart.y;
    pFirst->next = NULL;
    if(pFirst != NULL)
    {
        ...

    Ну а правда, вдруг NULL?

    someone, 24 Мая 2012

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

    +90

    1. 1
    public string Материал_Clean { get; set; }

    :[

    nolka4, 24 Мая 2012

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

    +139

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    a = 0;
    if (a == 0) {
    } else {
    b = a;
    }

    GggTtt, 23 Мая 2012

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

    +152

    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
    $(document).ready(function(){
     var m;
     function fourSize()
     {
        var size=$(window).width();
    	if (size<'1210') { css='1000'; m=160;}
    	if ((size>='1210')&&(size<'1296')) {css='1240';m=160;}
    	if ((size>='1296')&&(size<'1370')) {css='1320';m=180;}
    	if(size>='1370') {css='1400';m=180;}
        $('#four-size').attr({	href: 'css/styles_'+css+'.css'});marginFoot();
     } 
     function marginFoot()
        {
            w=$(window).width();
            h=$(window).height();
            if (h<500)  $('.center').css('height',($(window).height()-m));
            if ((h>500 && w<1210)||(h>600 && w>1210)){
            $('.center').css('height',($(window).height()-m)); //alert($(document).height()-180);
            margin=$(window).height()-$('.center').height()-m;
            $('.foot').css('margin-top',margin);}
        }   
        fourSize();marginFoot();
        $(window).resize(function(){fourSize();})
        
    })

    У парня 1 год опыта верстки и js.

    katsgeorgeek, 23 Мая 2012

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

    +138

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    <script>window.google={kEI:"iBS9T5-8NY6CtQbXmN3PDQ",getEI:function(a){var b;while(a&&!(a.getAttribute&&(b=a.getAttribute("eid"))))a=a.parentNode;return b||google.kEI},https:function(){return window.location.protocol=="https:"},kEXPI:"24878,27400,30316,31215,35702,35703,38100,38135,38221,38285,38738,38786,38816,38941,39000",kCSI:{e:"24878,27400,30316,31215,35702,35703,38100,38135,38221,38285,38738,38786,38816,38941,39000",ei:"iBS9T5-8NY6CtQbXmN3PDQ"},authuser:0,
    ml:function(){},pageState:"#",kHL:"uk",time:function(){return(new Date).getTime()},log:function(a,b,c,e){var d=new Image,h=google,i=h.lc,f=h.li,j="";d.onerror=(d.onload=(d.onabort=function(){delete i[f]}));i[f]=d;if(!c&&b.search("&ei=")==-1)j="&ei="+google.getEI(e);var g=c||"/gen_204?atyp=i&ct="+a+"&cad="+b+j+"&zx="+google.time();
    var k=/^http:/i;if(k.test(g)&&google.https()){google.ml(new Error("GLMM"),false,{src:g});delete i[f];return}d.src=g;h.li=f+1},lc:[],li:0,j:{en:1,l:function(){google.fl=true},e:function(){google.fl=true},
    b:location.hash&&location.hash!="#",bv:21,cf:"osb",pm:"p",pl:[],mc:0,sc:0.5,u:"f05f80a8"},Toolbelt:{},y:{},x:function(a,b){google.y[a.id]=[a,b];return false}};(function(){var a=
    google.j;window.onpopstate=function(){a.psc=1};for(var b=0,c;c=["ad","bc","inpr","is","p","pa","ac","pc","pah","ph","sa","sifp","slp","spf","spn","xx","zc","zz"][b++];)(function(e){a[e]=function(){a.pl.push([e,arguments])}})(c)})();if(!window.chrome)window.chrome={};window.chrome.sv=2.00;window.chrome.userWantsQuery=function(a){google.x({id:"psyapi"},function(){google.nav.search({q:encodeURIComponent(a),
    sourceid:"chrome-psyapi1"})})};
    window.google.sn="webhp";window.google.timers={};window.google.startTick=function(a,b){window.google.timers[a]={t:{start:(new Date).getTime()},bfr:!(!b)}};window.google.tick=function(a,b,c){if(!window.google.timers[a])google.startTick(a);window.google.timers[a].t[b]=c||(new Date).getTime()};google.startTick("load",true);try{}catch(u){}
    </script>

    GggTtt, 23 Мая 2012

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

    +97

    1. 1
    $date_sys=date("20y-m-d");

    Код из Марокко. Действительно, зачем юзать Y-m-d, если Y = 20y.

    howl, 23 Мая 2012

    Комментарии (15)
  10. PHP / Говнокод #10350

    +80

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    // Для очень важных целей извлекаем текущую дату на MSSQL сервере
    $d=mssql_query("SELECT getdate()");
    $dattime=mssql_fetch_array($d);
    
    // А теперь внимание. Вставляем полученную в предыдущем запросе дату в новую запись
    $result="INSERT INTO lgotrivia_gotrivia_game (dateTime, dateTimeIphone, gamemode, playerid, scores, phoneid, app_id)
                                                                 VALUES ('".$dattime[0]."','".$datetime_iphone."', '".$gamemode."', '".$playerid."', '".$scores."', '".$phoneid."', '".$appid."')";
    
    $res=mssql_query($result);

    По каким-то причинам стало не модно в INSERT запросах использовать вызов GETDATE() или CURRENT_TIMESTAMP. Через PHP прослойку ведь куда круче. Видимо таким ребятам тоже платят за строчки кода.

    SunnyMagadan, 23 Мая 2012

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