1. Си / Говнокод #18563

    +1000

    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
    int cutNCountLt3(char *in, char *out, long min) {
        int lt3 = 0;
        char *i = in, *j = in, *k = out;
    
        while (*j && *i) {
            j = i;
            while (*j != ' ' && *j)
                *k++ = *j++;
    
            *k++ = *j;
    
            int len = j - i;
            lt3 += len < 3;
    
            if (len < min)
                *(k -= len + 1) = '\0';
    
            i = j + 1;
        }
    
        return lt3;
    }

    К #9911
    А конкретнее http://govnokod.ru/9911#comment295215

    После нескольких ревизий в комментах, подумал, что наложить здесь будет лучше... Прошу любить, но не жаловать

    Elvenfighter, 03 Августа 2015

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

    +923

    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
    public class AnyNotNull<T> {
    
        public T get(T... args) {
            for(T t : args) {
                if (t != null)
                    return t;
            }
            return null;
        }
    
        public T getOrThrow(T... args) {
            T t = get(args);
            if(t == null)
                throw new NullPointerException("AnyNotNull. everything is null");
            return t;
        }
    
    }

    класс утилита

    _a_o_O, 02 Августа 2015

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

    +5

    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
    if($row198['verein_id']==$row511['verein_1'])
    {
    				$row198['neu_tore']=$row198['last_tore']+$row511['tore_1'];
    				$row198['neu_gegentore']=$row198['last_gegentore']+$row511['tore_2'];
    				$row198['neu_tordiff']=$row198['neu_tore']-$row198['neu_gegentore'];
    				$row198['neu_siege']=$row198['last_siege']+($row511['tore_1']>$row511['tore_2']);
    				$row198['neu_niederlagen']=$row198['last_niederlagen']+($row511['tore_1']<$row511['tore_2']);
    				$row198['neu_unentschieden']=$row198['last_unentschieden']+($row511['tore_1']==$row511['tore_2']);
    				$row198['neu_spiele']=$row198['last_spiele']+1;
    				$row198['last_punkte']=$row198['last_siege']*3+$row198['last_unentschieden']*1;
    				$row198['neu_punkte']=$row198['neu_siege']*3+$row198['neu_unentschieden']*1;
    }
    else if($row198['verein_id']==$row511['verein_2'])
    {
    				$row198['neu_tore']=$row198['last_tore']+$row511['tore_2'];
    				$row198['neu_gegentore']=$row198['last_gegentore']+$row511['tore_1'];
    				$row198['neu_tordiff']=$row198['neu_tore']-$row198['neu_gegentore'];
    				$row198['neu_siege']=$row198['last_siege']+($row511['tore_1']<$row511['tore_2']);
    				$row198['neu_niederlagen']=$row198['last_niederlagen']+($row511['tore_1']>$row511['tore_2']);
    				$row198['neu_unentschieden']=$row198['last_unentschieden']+($row511['tore_1']==$row511['tore_2']);
    				$row198['neu_spiele']=$row198['last_spiele']+1;
    				$row198['last_punkte']=$row198['last_siege']*3+$row198['last_unentschieden']*1;
    				$row198['neu_punkte']=$row198['neu_siege']*3+$row198['neu_unentschieden']*1;
    }

    через 5 минут заметил разницу.

    kropotor, 31 Июля 2015

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

    +3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if ($w>$n) {
    	print round(100/($w/$n))
    } else if ($n>$w) {
    	print round(100/($n/$w))
    }

    процентное соотношение между $w и $n

    specialforgovnocod, 31 Июля 2015

    Комментарии (11)
  5. bash / Говнокод #18555

    −438

    1. 1
    2. 2
    root@server:/var/www/project# supervisorctl restop gunicorn
    *** Unknown syntax: restop gunicorn

    krokodil_910, 31 Июля 2015

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

    +5

    1. 1
    _members[member.Member.MemberExpression.Member] = member.Member;

    В исходниках Linq2db

    vik-borisov, 31 Июля 2015

    Комментарии (1)
  7. SQL / Говнокод #18553

    −247

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    declare @col int
    set @col = 0
    
    while (select count(distinct id) from #tovar) > @col
    begin
    set @col = (select count(distinct id) from #tovar)
    	insert into #tovar (ParentID, ID, ISFOLDER, Tov) select parentID, ID, ISFOLDER, DESCR from SC23(nolock) where ISMARK = 0 and PARENTID in (select id from #tovar) 
    end

    dsfix, 30 Июля 2015

    Комментарии (1)
  8. Python / Говнокод #18552

    −74

    1. 1
    2. 2
    3. 3
    4. 4
    def foreigned(to_db='default', in_db="operator_main_dbs"):
        u""" декоратор для foreign tables """
        
        assert to_db == 'default' and in_db == "operator_main_dbs"

    Вариативность

    parabellum, 30 Июля 2015

    Комментарии (37)
  9. ActionScript / Говнокод #18551

    +421

    1. 1
    2. 2
    3. 3
    public static function isObjectDisabled(object:Object):Boolean {
            return !object.enabled;
        }

    strax, 30 Июля 2015

    Комментарии (14)
  10. Assembler / Говнокод #18550

    +69

    1. 1
    2. 2
    http://habrahabr.ru/post/263703/
    https://github.com/veryEvilMan/fl-ru-damp/issues/3#issuecomment-125602470

    Так, признавайтесь, кто приложил потные ручонки.

    bakagaijin, 30 Июля 2015

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