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

    В номинации:
    За время:
  2. 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)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. 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)
  8. 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)
  9. Python / Говнокод #10015

    −98

    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
    # TODO: fix this hell
    def pretty_print(w, p):
        w = truncate(w)
        p = truncate(p)
        my_matrix = zip(p, w)
        print  "\n".join(["\t\t".join(["\t".join(map(str, r)) for r in t]) for t in my_matrix])        
    
    # TODO: and this
    def truncate(m):
        for i in range(len(m)):
            for j in range(len(m[0])):
                if(len(str(m[i][j])) > 5):
                    m[i][j] = "%.3f" % m[i][j]
        return m

    catcall, 22 Апреля 2012

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

    +105

    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
    public static bool IpCheck(String ip)
            {
                String [] octs = ip.Split(new char[] { '.' });
    
                try
                {
    
                    for (int n = 0; n < 4; n++)
                    {
                        byte b = Convert.ToByte(octs[n]);
                    }
    
                    return true;
                }
                catch (Exception)
                {
                    return false;
                }
            }

    Индуский валидатор IP - адреса

    dens, 21 Апреля 2012

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

    +150

    1. 1
    2. 2
    $pbl = sscanf($object->getModifiedAt(), '%d-%d-%d %d:%d:%d');
    $this->is_new = ( time() - mktime($pbl[3],$pbl[4],$pbl[5],$pbl[1],$pbl[2],$pbl[0]) ) < 86400;

    u4n, 20 Апреля 2012

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