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

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

    +94

    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
    String s="a, b, c, d,,,";
    		
    		String[] spl=s.split ( "," );
    		o.println(spl.length);
    		for (String s1: spl)
    			o.print(s1+";");
    //4
    //a; b; c; d;
    		StringTokenizer st=new StringTokenizer(s);
    		o.println("\n"+st.countTokens ());
    		while (st.hasMoreElements ()){
    			o.print(
    				st.nextToken ()+";"
    			);
    		}
    //4
    //a,;b,;c,;d,,,;
    		st=new StringTokenizer(s,",");
    		o.println("\n"+st.countTokens ());
    		while (st.hasMoreElements ()){
    			o.print(
    				st.nextToken ()+";"
    			);
    		}
    //4
    //a; b; c; d;

    http://ideone.com/zh0paB
    Очередной сюжет из серии JavaGovno.

    3.14159265, 05 Ноября 2012

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

    +20

    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
    void __fastcall TfРѕrm1::SpeedButton1Click(TobjРµct *Sender)
    {
    SpeedButton1->Enabled=false;
     SpeedButton1->Caption=Edit1->Text;
     if(Edit1->Text=="X")
     Edit1->Text="0";
     else
     Edit1->Text="X";
     if(SpeedButton1->Caption=="X" && SpeedButton2->Caption=="X" && SpeedButton3->Caption=="X" ||
     SpeedButton4->Caption=="X" && SpeedButton5->Caption=="X" && SpeedButton6->Caption=="X" ||
     SpeedButton7->Caption=="X" && SpeedButton8->Caption=="X" && SpeedButton9->Caption=="X" ||
     SpeedButton1->Caption=="X" && SpeedButton4->Caption=="X" && SpeedButton7->Caption=="X" ||
      SpeedButton2->Caption=="X" && SpeedButton5->Caption=="X" && SpeedButton8->Caption=="X" ||
       SpeedButton3->Caption=="X" && SpeedButton6->Caption=="X" && SpeedButton9->Caption=="X" ||
        SpeedButton1->Caption=="X" && SpeedButton5->Caption=="X" && SpeedButton9->Caption=="X" ||
         SpeedButton3->Caption=="X" && SpeedButton5->Caption=="X" && SpeedButton7->Caption=="X")
    
      ShowMessage("Ea?a caeii?aia, e?anoeee auea?aee");
    
      else
       if(SpeedButton1->Caption=="0" && SpeedButton2->Caption=="0" && SpeedButton3->Caption=="0" ||
     SpeedButton4->Caption=="0" && SpeedButton5->Caption=="0" && SpeedButton6->Caption=="0" ||
     SpeedButton7->Caption=="0" && SpeedButton8->Caption=="0" && SpeedButton9->Caption=="0" ||
     SpeedButton1->Caption=="0" && SpeedButton4->Caption=="0" && SpeedButton7->Caption=="0" ||
      SpeedButton2->Caption=="0" && SpeedButton5->Caption=="0" && SpeedButton8->Caption=="0" ||
       SpeedButton3->Caption=="0" && SpeedButton6->Caption=="0" && SpeedButton9->Caption=="0" ||
        SpeedButton1->Caption=="0" && SpeedButton5->Caption=="0" && SpeedButton9->Caption=="0" ||
         SpeedButton3->Caption=="0" && SpeedButton5->Caption=="0" && SpeedButton7->Caption=="0")
      ShowMessage("Ea?a caeii?aia, iieeee auea?aee");
    
    }

    jQuery, 29 Октября 2012

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

    +136

    1. 1
    2. 2
    3. 3
    4. 4
    revision = String.Format("{0}{1:d2}{2:d2}",
    				DateTime.Now.Year.ToString().Substring(2),
    				DateTime.Today.Month,
    				DateTime.Today.Day);

    видно автор хотел сделать
    revision = DateTime.Today.ToString("yyMMdd");

    http://www.codeproject.com/Articles/272551/Custom-Assembly-Versioning-with-VS-2010-and-MSBUIL

    graph_di5, 28 Октября 2012

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

    +129

    1. 1
    arr <- return $ map (2*) lst

    Я тут читал раздел на одном форуме по решению задач для школьников и наткнулся на такое говно.
    - let?
    - Не, не слышал.
    Подозреваю, что автор не понял, что let нужно писать без in в монадах, чтобы скомпилировалось.

    HaskellGovno, 17 Октября 2012

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

    +50

    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
    $submit = $_REQUEST['submit'];
    if(isset($submit))
    {
    
    	$first_name = $_REQUEST['first_name'];
    	$last_name = $_REQUEST['last_name'];	
    	$address = $_REQUEST['address'];
    	$city = $_REQUEST['city'];
    	$country = $_REQUEST['country'];
    	$state = $_REQUEST['state'];
    	$zipcode = $_REQUEST['zipcode'];
    	$phone = $_REQUEST['phone'];
    	$email = $_REQUEST['email'];
    		
    	$_SESSION['first_name'] = $first_name;
    	$_SESSION['last_name'] = $last_name;
    	$_SESSION['address'] = $address;
    	$_SESSION['city'] = $city;
    	$_SESSION['country'] = $country;
    	$_SESSION['state'] = $state;
    	$_SESSION['zipcode'] = $zipcode;
    	$_SESSION['phone'] = $phone;
    	$_SESSION['email'] = $email;
    	
    	
    	?>
    	  <meta http-equiv="refresh" content="0;url=https://www.site.com/development1/billing_info.php"/>
    	<?
    	  exit();

    оригинальная обработка сабмита формы и редиректа

    bytes, 16 Октября 2012

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

    +139

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    switch (!_data.Provider)
    {
            case true: _currentState = states.DT2F; break;
            case false: _currentState = states.DT2P; break;
    }

    Проверка двух условий

    Prafesor, 10 Октября 2012

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

    +50

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    /**
         * Что я курил, когда это писал? Почему нельзя было date('H:i:s', $time) ??? +___=
         * @param $seconds
         * @return string
         */
        private static function prettySecondsPrint($seconds){
            return str_pad((int)($seconds / 3600), 2, '0', STR_PAD_LEFT)
                .':'.str_pad((int)(($seconds % 3600) / 60), 2, '0', STR_PAD_LEFT)
                .':'.str_pad($seconds % 60, 2, '0', STR_PAD_LEFT);
        }

    А это, к сожалению, мое творение) Комменарий приписал когда позже просматривал код и обнаружил это)

    et, 28 Сентября 2012

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

    +133

    1. 1
    string[] res = value.Split("$".ToCharArray(), StringSplitOptions.None);

    shtaff, 19 Сентября 2012

    Комментарии (9)
  10. Куча / Говнокод #11795

    +128

    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
    #!/bin/bash
    hl=`cat $1`
    wrdl=`cat ~/worlds.txt`
    addr=$PWD'/extra_hosts.txt'
    rm -f $addr && echo "Deleted host list file "$addr
    touch $addr && echo "Created file "$addr
    for address in $hl
    do
    rm $PWD/`basename $address`.txt && echo "Deleted file "$PWD/`basename $address`.txt
    done
    for address in $hl
    do
    #echo $address
    export address
    tmp=$PWD/`basename $address`.txt
    trc=$PWD/`basename $address`.tr.txt
    mytmp=/tmp/`basename $address`.txt
    curl -Ss --retry 2 --trace $trc --tr-encoding --tcp-nodelay $address > $mytmp &
    sleep 10s
    cat $mytmp \
     | grep -e '<a href=\"[^"]*\"' | grep -E -o '[^"]+'\
     | grep htm | perl -pe 's/$ENV{address}//'| \
     perl -pe 's/^\//$ENV{address}\//' | perl -pe 's/text\/html//'|\
      sed -e 's/<[^>]*>//g' -e '/\/http:/d;/^http/p;d;' | sort | uniq >> $addr &
    for wrd in `cat ~/worlds.txt`
    do
    export wrd
    cat -b $mytmp\
    | sed -e 's/<[^>]*>//g' |grep -i $wrd \
     | perl -pe 's/^/$ENV{address}:$ENV{wrd}:/' | tee -a $tmp &
    done
    done
    mkdir -p extra_hosts && echo "Made dir extra_hosts"
    cd extra_hosts
    $0 $addr

    AliceGoth, 18 Сентября 2012

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

    +11

    1. 1
    clEnqueueReleaseGLObjects(queue, objects.size(), objects.data(), 9, NULL, NULL);

    В целом ничего страшного, но почему на клавиатуре девятка так рядом с нулём?

    bazhenovc, 15 Сентября 2012

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