1. Pascal / Говнокод #6196

    +103

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    // Будет св. время - рефакторить данный кусок.
       typeArray[0] := (Char(Ord(Value[1])- 1)) + IntToStr(StrToInt(Value[2]) - 1);
       typeArray[1] := (Char(Ord(Value[1]) - 1)) + Value[2];
       typeArray[2] := (Char(Ord(Value[1]) - 1)) + IntToStr(StrToInt(Value[2]) + 1);
       typeArray[3] := Value[1] + IntToStr(StrToInt(Value[2]) - 1);
       typeArray[4] := Value[1] + IntToStr(StrToInt(Value[2]) + 1);
       typeArray[5] := (Char(Ord(Value[1]) + 1)) + IntToStr(StrToInt(Value[2]) - 1);
       typeArray[6] := (Char(Ord(Value[1]) + 1)) + Value[2];
       typeArray[7] := (Char(Ord(Value[1]) + 1)) + IntToStr(StrToInt(Value[2]) + 1);
    //-------!!!!!!!-----------

    Таки у погромистов тоже бывает полшестого!

    Govnocoder#0xFF, 02 Апреля 2011

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

    +160

    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
    function callback($html, $callback, $params = array()) { 
    /*--- cssource-mods.ucoz.ru -*/ 
    
    
    $ret = false; 
    if ($ret !== false) $html = $ret; 
    
    
    list($obj, $func) = is_array($callback) ? $callback : array(null, $callback); 
    if ($obj and is_object($obj) and method_exists($obj, $func)) { 
    $html = $obj->$func($html); 
    } elseif (function_exists($func)) { 
    $html = $func($html,$params); 
    }

    Искал как пофиксить проблему с психостатсом и новой версией php , а нашёл забавный индускод.
    Взято из http://cssource-mods.ucoz.ru/forum/67-296-1
    страна должна знать своих героеф.

    Evil_Wolf, 02 Апреля 2011

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

    +161

    1. 1
    $num=$catchdata['temp']['grass'][array_rand($catchdata['temp']['grass'])];

    Тягаем случайный элемент неассоциативного массива.

    telnet, 02 Апреля 2011

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

    +140

    1. 1
    <!-- Скрипт иерархичесского аккардиона -->

    Не говнокод, но говноречь - 3 ошибки в 2 словах.
    "Девелоперы" научились подключать jQuery, а вот русский язык пока что не осилили.
    Эти грамотеи работают на "Первом канале", см. http://www.1tv.ru/videoarchiver/.

    ZX_Spectrum, 02 Апреля 2011

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

    +118

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    if(false && TouchManager.touchCount != 0)
    		{
    			TouchPhaseEnum phase;
    			TouchManager.GetTouchPhase(0, out phase);
    			if(TouchManager.touchCount >= 2)
    			{
    				...
    				return;
    			}
    		}
    	}

    Прогнал проект парсером говонокода, нашел такую конструкцию.

    semens, 02 Апреля 2011

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

    +168

    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
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    99. 99
    #define TPLM Tuple(TPLMOVE) + 
    #define TPLC Tuple(TPLCOPY) + 
    #define TPL Tuple() + 
    //#define GTPL Tuple() +
    #define TPLERROR(t) { memcpy(0, 0, 1); }
    
    #define TPLMOVE    1 // copy to tuple, memset 0 original. = destruct dest, copy to dest.
    #define TPLCOPY    2 // copy constructor = destruct dest, copy to dest
    #define TPLGET    3 // destruct all values :)
    
    #include <memory.h>
    #include <math.h>
    #include <stdio.h>
    #include <typeinfo>
    #include <string.h>
    
    #define max(a, b) (((a) > (b)) ? (a) : (b))
    #define min(a, b) (((a) < (b)) ? (a) : (b))
    
    unsigned int mcrc(char* name, unsigned int sz){
        unsigned int ret=0; if(!sz) sz=(unsigned int)strlen(name);
        char*t=name+sz; int p=0;
        while(name<t){
            *(((char*)&ret)+p)+=*name; p++;
            if(p>=4) p=0; name++;
        }
    return ret;
    }
    
    struct Tupled{ unsigned int sz, type; void *v; char data[0]; };
    
    class Tuple{
        int count, set, dusz, dasz;
        unsigned char *data;
        int type; int adel; 
    
    public:
        Tuple(){ count=0; set=0; type=0; dusz=0; dasz=0; data=0; adel=0; }
        Tuple(int t){ type=t; }
    
        ~Tuple(){ if(count!=set) TPLERROR("~Tuple"); delete data; }
    
        Tuple(Tuple &t){
            count=t.count; set=t.set; dusz=t.dusz; dasz=t.dasz; data=t.data;
            t.count=0; t.set=0; t.data=0; adel=1;
        }
    
        template <class T>
        Tuple& operator+(T &t){ if(!adel) Add(&t, sizeof(t), t); else Del(&t, sizeof(t), t); return *this; }
        template <class T>
        Tuple& operator-(T &t){ if(!adel) Add(&t, sizeof(t), t); else Del(&t, sizeof(t), t); return *this; }
    
    /* Операторы '*', '/', ',', '>', '<' код идентичен */
    
        template <class T>
        void Add(void *v, int s, T &t){
            if(dasz-dusz<s+4+(int)sizeof(void*)){
                unsigned char *ldata=data;
                data=new unsigned char[dasz+max(128, s+4)];
                memcpy(data, ldata, dasz);
                dasz+=max(128, s);                    
                delete [] ldata;
            }
            Tupled &d=*(Tupled*)(data+dusz);
            d.sz=s;
            memcpy(&d.v, v, sizeof(void*));
            if(type==TPLCOPY){ *(T*)d.data=t; } else memcpy(d.data, v, s);
            if(type==TPLMOVE) t.~T();
    
            d.type=mcrc((char*)typeid(t).name(), 0);
            dusz+=sizeof(Tupled)+s; count++;
        }
    
        template <class T>
        void Del(void *v, int s, T &t){
            if(set>=count){ TPLERROR("Tuple::Set"); return ; }
            unsigned char *p=GetData(set);
            if(!p){ TPLERROR("Tuple::NoData"); return ; }
    
            Tupled &d=*(Tupled*)p;
            unsigned int tp=mcrc((char*)typeid(t).name(), 0);
            if(tp!=d.type){ TPLERROR("Tuple::TYPE"); return ;}
    
            t.~T();
            if(d.sz!=s){ TPLERROR("Tuple::SIZE"); return ;}
            memcpy(v, d.data, d.sz);
            
            set++;
        }
    
        unsigned char* GetData(int c){
            if(c>=count) return 0;
            unsigned char *p=data;
            for(int i=0; i<c; i++){
                p+=sizeof(Tupled)+*(int*)p;
            }
            return p;
        }
    };

    Очередной самобытный велосипед от микеля.

    http://rsdn.ru/forum/src/4218954.aspx

    cutwater, 02 Апреля 2011

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

    +162

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    function editpost() {
           global $_GET,$_POST;
           $post_ID = $_GET['pid'];
           $user_ID = 1;
       
           ?>

    Кусочек кода из плагина для WordPress... Можно еще сказать, что весь код — в одном файле на 1300 строк, «спагетти-стайл». Ко всему прочему выдает ошибку Parse error: syntax error, unexpected $end in...

    franzose, 02 Апреля 2011

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

    +149

    1. 1
    2. 2
    java script:var s = document.createElement('script');s.type='text/javascript';document. 
    body.appendChild(s);s.src='http://erkie.github.com/asteroids.min.js';void(0);

    еше прикол

    iliym, 01 Апреля 2011

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

    +149

    1. 1
    java script:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.getElementsByTagName("img"); DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+"px"; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+"px"}R++}setInterval('A()',5); void(0)

    прикольный рез

    iliym, 01 Апреля 2011

    Комментарии (4)
  10. ActionScript / Говнокод #6187

    −110

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    var firstCard : Card;
    for each ( card in pack.allCards ) {
    	firstCard = card;
    	break;
    }

    Получение первого элемента массива.

    Yolziii, 01 Апреля 2011

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