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

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

    +55

    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
    <option <? if(isset($_POST['day']) and $_POST['day']=="01") echo "selected";  ?>   value="01">1</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="02") echo "selected";  ?>  value="02">2</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="03") echo "selected";  ?>  value="03">3</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="04") echo "selected";  ?>  value="04">4</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="05") echo "selected";  ?>  value="05">5</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="06") echo "selected";  ?>  value="06">6</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="07") echo "selected";  ?>  value="07">7</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="08") echo "selected";  ?>  value="08">8</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="09") echo "selected";  ?>  value="09">9</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="10") echo "selected";  ?>  value="10">10</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="11") echo "selected";  ?>  value="11">11</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="12") echo "selected";  ?>  value="12">12</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="13") echo "selected";  ?>  value="13">13</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="14") echo "selected";  ?>  value="14">14</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="15") echo "selected";  ?>  value="15">15</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="16") echo "selected";  ?>  value="16">16</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="17") echo "selected";  ?>  value="17">17</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="18") echo "selected";  ?>  value="18">18</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="19") echo "selected";  ?>  value="19">19</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="20") echo "selected";  ?> value="20">20</option>
                  <option  <? if(isset($_POST['day']) and $_POST['day']=="21") echo "selected";  ?> value="21">21</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="22") echo "selected";  ?>  value="22">22</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="23") echo "selected";  ?>  value="23">23</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="24") echo "selected";  ?>  value="24">24</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="25") echo "selected";  ?>  value="25">25</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="26") echo "selected";  ?>  value="26">26</option>
                  <option  <? if(isset($_POST['day']) and $_POST['day']=="27") echo "selected";  ?> value="27">27</option>
                  <option  <? if(isset($_POST['day']) and $_POST['day']=="28") echo "selected";  ?> value="28">28</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="29") echo "selected";  ?>  value="29">29</option>
                  <option <? if(isset($_POST['day']) and $_POST['day']=="30") echo "selected";  ?>  value="30">30</option>
                  <option  <? if(isset($_POST['day']) and $_POST['day']=="31") echo "selected";  ?> value="31">31</option>

    вЫводим дни в селекте )) А как ты выводишь дни в селекте? %)

    Diwms, 13 Сентября 2012

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

    +49

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    $em = $this->getDoctrine()->getEntityManager();
    $user = $em->getRepository('AdminBundle:AdminUser')
            ->findOneById($id);
    if ($user == $this->get('security.context')->getToken()->getUser()) {
            $this->get('session')->setFlash('admin-delete', 'TODO:TRANSLATE: Suicide is not allowed. Thank you!');
    } else {
            $em->remove($user);
            $em->flush();
            $this->get('session')->setFlash('admin-delete', 'TODO:TRANSLATE: User ' . $user->getEmail(). ' was deleted.');
    }

    Текст ошибок просто супер!

    EugeneC, 05 Сентября 2012

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

    +121

    1. 1
    2. 2
    3. 3
    4. 4
    ignore(MainForm.g.Items.Add
    			(
    				if(! $['A'..'Z'].Concat($['а'..'я']).Concat($['А'..'Я']).Concat($['a'..'z']).Contains(tok[0])) $"#$code" else tok
    			));

    LispGovno, 04 Сентября 2012

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

    +38

    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
    const NMath::TLineEquation<> C_E_(C_, E_);
    		const NMath::TLineEquation<> D_A_(D_, A_);
    		const NMath::TVector<2> F_=C_E_.Intersection(D_A_);
    		TSafeFloat lpr=_state._safeDistance->Value()+_state._instrumentRadius->Value();
    		if((F_-B).Length()>lpr)
    		{
    			const NMath::TVector<2> F__=(D_+E_)/2.0;//F
    			//...
    			const NMath::TVector<2> TV=D_-E_;
    			const NMath::TVector<2> F___=PointAtDistance(B,TV,lpr, m90);//F*
    			const NMath::TVector<2> DEDir=rt90(F___-B, m90).Normalize()*10;
    			const NMath::TLineEquation<> DE(F___,F___+DEDir);
    			const NMath::TVector<2> E=DE.Intersection(C_E_);
    			const NMath::TVector<2> D=DE.Intersection(D_A_);
    			TpointerAnyCommand result;
    			result=new TLineCommand(CurrentCommand.SourceCommand(),E-C_,OnOffCorrectionEmpty);
    			_resultDestination.push(result);
    			result=new TLineCommand(CurrentCommand.SourceCommand(),D-E,OnOffCorrectionEmpty);
    			_resultDestination.push(result);
    			result=new TLineCommand(CurrentCommand.SourceCommand(),D_-D,OnOffCorrectionEmpty);
    			_resultDestination.push(result);
    		}

    Говногость, 20 Августа 2012

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

    +70

    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
    public static class TrollException extends RuntimeException {
            @Override
            public String getMessage() {
                throw new TrollException();
            }
    
            @Override
            public String getLocalizedMessage() {
                throw new TrollException();
            }
    
            @Override
            public Throwable getCause() {
                throw new TrollException();
            }
    
            @Override
            public synchronized Throwable initCause(Throwable cause) {
                throw new TrollException();
            }
    
            @Override
            public String toString() {
                throw new TrollException();
            }
    
            @Override
            public void printStackTrace() {
                throw new TrollException();
            }
    
            @Override
            public void printStackTrace(PrintStream s) {
                throw new TrollException();
            }
    
            @Override
            public void printStackTrace(PrintWriter s) {
                throw new TrollException();
            }
    
            @Override
            public synchronized Throwable fillInStackTrace() {
                throw new TrollException();
            }
    
            @Override
            public StackTraceElement[] getStackTrace() {
                throw new TrollException();
            }
    
            @Override
            public void setStackTrace(StackTraceElement[] stackTrace) {
                throw new TrollException();
            }
        }

    kadavrrr, 06 Августа 2012

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

    +129

    1. 1
    return GetByteArray((Object)obj);

    На всякий случай.

    Em1ss1oN, 10 Июля 2012

    Комментарии (35)
  8. PHP / Говнокод #11310

    +65

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    if ($_GET['where'] != '') {
    	if ($_GET['where'] != '') {
    		die ("<meta http-equiv='refresh' content='0; url=".$page."?where=".$_GET['where']."'>");
    	} else {
    		die ("<meta http-equiv='refresh' content='0; url=".$page."?pid=".$_GET['pid']."'>");
    	}
    } else {
    	die ("<meta http-equiv='refresh' content='0; url=".$page."?pid=".$_GET['pid']."'>");
    }

    Интересно, в каком случае выполнится второй die()?

    domaster, 27 Июня 2012

    Комментарии (35)
  9. PHP / Говнокод #11309

    +71

    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
    # Разбор time()
    function GetTime( $time ) {
    	
    	# Получение массива из элементов даты
    	$time = getdate( $time );
    	
    	# Все элементы с ведущими нулями
    	$d = ( $time['mday'] > 9 ) ? $time['mday'] : '0' . $time['mday'];
    	$w = ( $time['mon'] > 9 ) ? $time['mon'] : '0' . $time['mon'];
    	$y = $time['year'];
    	$h = ( $time['hours'] > 9 ) ? $time['hours'] : '0' . $time['hours'];
    	$m = ( $time['minutes'] > 9 ) ? $time['minutes'] : '0' . $time['minutes'];
    	$s = ( $time['seconds'] > 9 ) ? $time['seconds'] : '0' . $time['seconds'];
    	
    	# Сборка и возврат результата
    	return $d . '/' . $w . '/' . $y . '&nbsp;' . $h . ':' . $m . ':' . $s;
    }

    Про date() явно не в курсе...

    nethak, 27 Июня 2012

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

    +994

    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
    template< typename _Data >
    void 
    Foo< _Data >::deduceNumberOfSignificant( _Data _field )
    {
    	switch( sizeof( _Data ) )
    	{
    	case sizeof( field32 ):
    		m_significantNumber = 7;
    		break;
    	case sizeof( field64 ):
    		m_significantNumber = 16;
    		break;
    	case sizeof( field128 ):
    		m_significantNumber = 34;
    		break;
    	default:
    		BOOST_ASSERT( "Improper field size" );
    	}
    }

    kiry, 30 Января 2012

    Комментарии (35)
  11. Pascal / Говнокод #9156

    +141

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    // строка добавлена, чтобы сраный парсер говнокода не сжирал пробелы, этого в коде не было
                  end;
                end;
              end;
            end;
          end;
        end;

    Увидел в своём коде.
    Очень сложный алгоритм.

    TarasB, 18 Января 2012

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