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

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

    +147

    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
    var credtype = new Array();
    credtype['A~'] = 'Страховка - финлизинг';
    credtype['A0'] = 'АвтоКредит за 30 мин';
    credtype['A1'] = 'Авто в кредит - основной';
    credtype['A2'] = 'Кредит на аванс';
    credtype['A3'] = 'Кредитные каникулы(авто)';
    credtype['A4'] = 'Залог авто (ПУФК)';
    credtype['A5'] = 'Стандартный автокредит <br/>(без страховок)';
    credtype['A6'] = 'Упрощённый автокредит <br/>(без страховок)';
    credtype['A7'] = 'Кредит без страховки (новые)';
    credtype['A8'] = 'Кредит без страховки (Б/У)';
    credtype['A9'] = 'Стандартный Б/У авто <br/>(с резервированием)';
    credtype['AA'] = 'Авто <br/>(прочие под залог автотранспорта)';
    credtype['AB'] = 'приобр. Авто Б/У';
    credtype['AC'] = 'покупка а/м Пежо (Илта) - схема 1';
    credtype['AD'] = 'Авто Б/У с площадок банка <br/>(некомис)';
    credtype['AE'] = 'Авто <br/>(Б/У с ежемесячной комиссией)';
    credtype['F2'] = 'Эконом-кредит отсрочка <br/>(Фокстрот)';
    credtype['F3'] = 'Потребительская корзина <br/>(Фокстрот)';
    credtype['F4'] = 'Фокстрот <br/>(меньше цена до 1500грн)';
    credtype['F5'] = 'Фокстрот <br/>(меньше цена от 1501 до 3000грн)';
    credtype['F6'] = 'Фокстрот <br/>(меньше цена от 3001 до 4500грн)';
    credtype['F7'] = 'Фокстрот <br/>(меньше цена от 4501 до 6000грн)';
    // …
    // Еще несколько десятков похожих строчек.
    // …
    credtype['FP'] = 'Ипотека с резервированием<br/>(упрощенный)';
    credtype['FQ'] = 'Кредитование охранников';
    credtype['FR'] = 'Акция 0% <br/>(ДОМОТЕХНИКА)';
    credtype['FS'] = '10*10*10 <br/>(ДОМОТЕХНИКА)';
    credtype['FT'] = 'ПРОСТОЙ <br/>(ДОМОТЕХНИКА)';
    credtype['FU'] = 'ДОМИАШНИЙ <br/>(ДОМОТЕХНИКА)';
    credtype['FV'] = 'МОБИЛЬНЫЙ со справкой <br/>(ДОМОТЕХНИКА)';
    credtype['FW'] = 'МОБИЛЬНЫЙ без справки <br/>(ДОМОТЕХНИКА)';
    credtype['FW'] = 'МОБИЛЬНЫЙ без справки <br/>(ДОМОТЕХНИКА)';
    credtype['FX'] = 'ГИБКИЙ /10-19.99/ <br/>(ДОМОТЕХНИКА)';
    credtype['FY'] = 'ГИБКИЙ /20-39.99/ <br/>(ДОМОТЕХНИКА)';
    credtype['FZ'] = 'ГИБКИЙ /40/ <br/>(ДОМОТЕХНИКА)';
    credtype['G0'] = 'ГИБКИЙ /40/ <br/>(ДОМОТЕХНИКА)';
    credtype['G1'] = 'жильё в кредит - основной';
    credtype['SZ'] = 'Событийное на заработки';
    credtype['TP'] = 'Только паспорт <br/>(Приват Кредит)';
    credtype[''] = '';
    
    function getCreditName(creditType) {
        var ct = credtype[creditType];
        if(ct != null)
            return ct;
        return '';
    }

    Код на сайте украинского ПриватБанка.

    prostosuper, 06 Сентября 2011

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

    +147

    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
    function ckos() {
            $so = $_SERVER['HTTP_USER_AGENT'];
            $windowsxp = preg_match("/windows nt 5.1/i", $so);
            $windowsxp2 = preg_match("/windows xp/i", $so);
            $linux = preg_match("/linux/i", $so);
            $windowsme = preg_match("/win 9x 4.90/i", $so);
            $windowsme2 = preg_match("/windows me/i", $so);
            $windows2k = preg_match("/windows nt 5.0/i", $so);
            $windows2kb = preg_match("/windows 2000/i", $so);
            $windowsnt = preg_match("/windows nt 3.1/i", $so);
            $windowsnt2 = preg_match("/windows nt 3.5.0/i", $so);
            $windowsnt3 = preg_match("/windows nt 3.5.1/i", $so);
            $windowsnt4 = preg_match("/windows nt 4.0/i", $so);
            $windows98 = preg_match("/windows 98/i", $so);
            $windows95 = preg_match("/windows 95/i", $so);
            if ($windowsxp == 1 or $windowsxp2 == 1) {
            $sys = "Windows XP";
            } else if ($linux == 1) {
            $sys = "Linux";
            } else if ($windowsme == 1 or $windowsme2 == 1) {
            $sys = "Windows ME";
            } else if ($windows2k == 1 or $windows2kb == 1) {
            $sys = "Windows 2000";
            } else if ($windowsnt == 1 or $windowsnt2 == 1 or $windowsnt3 == 1 or $windowsnt4 == 1) {
            $sys = "Windows NT";
            } else if ($windows98 == 1 and $windowsme != 1) {
            $sys = "Windows 98";
            } else if ($windows95 == 1) {
            $sys = "Windows 95";
            } else {
            $sys = "Not identified";
            }
            return($sys);
    }

    вариация на тему броузеросниффера

    Lure Of Chaos, 05 Сентября 2011

    Комментарии (0)
  4. Си / Говнокод #7766

    +147

    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
    789 static LPWSTR concatenate_string_list( LPCWSTR *list, int len )
     790 {
     791     LPCWSTR *t;
     792     LPWSTR str;
     793 
     794     for( t = list; *t ; t++  )
     795         len += strlenW( *t );
     796     len++;
     797 
     798     str = heap_alloc( len * sizeof(WCHAR) );
     799     if (!str) return NULL;
     800     *str = 0;
     801 
     802     for( t = list; *t ; t++ )
     803         strcatW( str, *t );
     804 
     805     return str;
     806 }

    говно от разработчиков wine "http://source.winehq.org/git/wine.git/blob/f4c2317adc44626cefab8d97ba4cc955f29a42a1 :/dlls/winhttp/request.c"
    ребята не знают о существовании StrCatChain или StringCchCatEx
    и никогда не читали Джоэл Сполски про маляра Шлемеля
    "http://www.gnuman.ru/joel/Nazad_k_osnovam/"

    80ab88005a044331, 04 Сентября 2011

    Комментарии (25)
  5. Куча / Говнокод #7761

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    th,.left {
    	text-align: right;
    }
    
    label, .right {
    	text-align: left;
    }

    свеженакладенное:
    какая семантика? так надо было....

    Lure Of Chaos, 03 Сентября 2011

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

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    <?php
    /*.......*/
    
    $x =& J_USER;
    
    /*.......*/
    ?>

    Ошибка порадовала.

    "Parse error: syntax error, unexpected ';', expecting T_PAAMAYIM_NEKUDOTAYIM"

    "а, да ебать, говно вопрос.

    jokz, 03 Сентября 2011

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

    +147

    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
    <?php
    /*
    	Виджет для формы логина
    */
    class UserLogin extends CWidget
    {
    	public function run()
    	{
                $model = new Login;
                if(!Yii::app()->user->isGuest)
                {
                    $this->render('loginOut', array('model'=>$model));
                } else {
                    $this->render('loginForm', array('model'=>$model));
                }
    	}
    }
    
    /**
     * модель логина
     */
    class Login extends CFormModel
    {
    	public $login;
    	public $pass;
    	public $rememberMe;
    
    	private $_identity;
    
    	public function rules()
    	{
                return array(
                    // username and password are required
                    array('login, pass', 'required', 'message'=>'поле {attribute} не может быть пустым'),
                    // rememberMe needs to be a boolean
                    array('rememberMe', 'boolean'),
                    // password needs to be authenticated
                    array('pass', 'authenticate'),
                );
    	}
    
    	/**
    	 * Declares attribute labels.
    	 */
    	public function attributeLabels()
    	{
                return array(
                    'login'=>'Логин',
                    'pass'=>'Пароль',
                    'rememberMe'=>'Запомнить',
                );
    	}
    
    	/**
    	 * Authenticates the password.
    	 * This is the 'authenticate' validator as declared in rules().
    	 */
    	public function authenticate($pass,$params)
    	{
                $this->_identity=new UserIdentity($this->login,$this->pass);
                if(!$this->_identity->authenticate())
                    $this->addError($pass, empty($params['message'])?'неправильный лоин или пароль':$params['message']);
    	}
    
    	/**
    	 * Logs in the user using the given username and password in the model.
    	 * @return boolean whether login is successful
    	 */
    	public function login()
    	{
                if($this->_identity===null)
                {
                    $this->_identity=new UserIdentity($this->login,$this->pass);
                    $this->_identity->authenticate();
                }
                if($this->_identity->errorCode===UserIdentity::ERROR_NONE)
                {
                    $duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days
                    Yii::app()->user->login($this->_identity,$duration);
                    return true;
                } else {
                    return false;
                }
    	}
    }

    xyzdsnxyz, 03 Сентября 2011

    Комментарии (22)
  8. C++ / Говнокод #7738

    +147

    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
    template<typename _Tp>
        pair<_Tp*, ptrdiff_t>
        get_temporary_buffer(ptrdiff_t __len)
        {
          const ptrdiff_t __max =
      __gnu_cxx::__numeric_traits<ptrdiff_t>::__max / sizeof(_Tp);
          if (__len > __max)
      __len = __max;
          
          while (__len > 0) 
      {
        _Tp* __tmp = static_cast<_Tp*>(::operator new(__len * sizeof(_Tp), 
                  std::nothrow));
        if (__tmp != 0)
          return std::pair<_Tp*, ptrdiff_t>(__tmp, __len);
        __len /= 2;                                    // !?!?!?!?!?!?!?!?
      }
          return std::pair<_Tp*, ptrdiff_t>(static_cast<_Tp*>(0), 0);
        }
    
      template<typename _Tp>
        inline void
        return_temporary_buffer(_Tp* __p)
        { ::operator delete(__p, std::nothrow); }

    CPPGovno, 02 Сентября 2011

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

    +147

    1. 1
    int (*arr)[3];

    CPPGovno, 02 Сентября 2011

    Комментарии (0)
  10. C++ / Говнокод #7733

    +147

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    struct VS_INPUT_STRUCT //вхідні дані
    {
        float4 position: POSITION;
        float3 normal:   NORMAL;
    };
    
    struct VS_OUTPUT_STRUCT //вихідні дані
    {
         float4 position: POSITION;
         float3 light:    TEXCOORD0;
         float3 normal:   TEXCOORD1;
    };

    CPPGovno, 01 Сентября 2011

    Комментарии (29)
  11. Куча / Говнокод #7717

    +147

    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
    /* Dimensions */
    /* Widths */
    .w10{width:10px;}
    .w20{width:20px;}
    .w25{width:25px;}
    .w50{width:50px;}
    .w75{width:75px;}
    .w100{width:100px;}
    .w125{width:125px;}
    .w150{width:150px;}
    .w175{width:175px;}
    .w200{width:200px;}
    .w210{width:210px;}
    .w225{width:225px;}
    .w250{width:250px;}
    .w260{width:260px;}
    .w270{width:270px;}
    .w275{width:275px;}
    .w300{width:300px;}
    .w325{width:325px;}
    .w350{width:350px;}
    .w375{width:375px;}
    .w400{width:400px;}
    .w450{width:450px;}
    .w500{width:500px;}
    .w525{width:525px;}
    .w550{width:550px;}
    .w600{width:600px;}
    .w625{width:625px;}
    .w650{width:650px;}
    .w800{width:800px;}
    /* Heights */
    .h15{height:15px;}
    .h20{height:20px;}
    .h25{height:25px;}
    .h50{height:50px;}
    .h75{height:75px;}
    .h100{height:100px;}
    .h125{height:125px;}
    .h150{height:150px;}
    .h175{height:175px;}
    .h200{height:200px;}
    .h225{height:225px;}
    .h250{height:250px;}
    .h275{height:275px;}
    .h300{height:300px;}
    .h325{height:325px;}
    .h350{height:350px;}
    .h375{height:375px;}
    .h400{height:400px;}
    
    /* Padding */
    .noPad{padding:0;}
    .pad2{padding:2px;}
    .pad3{padding:3px;}
    .pad5{padding:5px;}
    .pad10{padding:10px;}
    .padTB5{padding:5px 0;}
    .padTB10{padding:10px 0;}
    .padTB15{padding:15px 0;}
    .padRL5{padding:0 5px;}
    .padRL10{padding:0 10px;}
    .padRL15{padding:0 15px;}
    .padRL20{padding-left:20px; padding-right:20px;}
    
    
    /* Margin */
    .noMar{margin:0;}
    .mar2{margin:2px;}
    .mar3{margin:3px;}
    .mar5{margin:5px;}
    .mar10{margin:10px;}
    .marTB5{margin:5px 0;}
    .marTB10{margin:10px 0;}
    .marTB15{margin:15px 0;}
    .marRL5{margin:0 5px;}
    .marRL10{margin:0 10px;}
    .marRL15{margin:0 15px;}
    .marRL20{margin-right:20px; margin-left:20px;}
    
    /* Visibility */
    .off{display:none;}
    .on{display:block;}

    myspace styleshit

    Lure Of Chaos, 31 Августа 2011

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