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

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

    +121

    1. 1
    2. 2
    3. 3
    long longVariable = <...>;
    ...
    double doubleVariable = new Double(longVariable).doubleValue();

    Вот так делается по ВСЕМУ проекту, когда нужно перевести long в double.

    someone, 25 Августа 2014

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

    +121

    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
    class Program
    {
    	static int x = 0;
    	
    	static int f()
    	{
    	x = x + 10;
    		return 1;
    	}
    	
    	public static void Main()
    	{
    		x += f();
    		System.Console.WriteLine(x);
    	}
    }

    Следите за руками! Чему же в итоге равно x?

    Проверить себя: http://ideone.com/v8rktM

    Источник: http://blogs.msdn.com/b/oldnewthing/archive/2014/08/14/10549885.aspx

    someone, 15 Августа 2014

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

    +121

    1. 1
    Wct Editor forever

    Ахаххахаха))

    Mobac, 19 Апреля 2014

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

    +121

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    //if they're locked out or banned die
    if ( ( $bwpsoptions['id_enabled'] == 1 ||$bwpsoptions['ll_enabled'] == 1 ) && $this->checklock( $current_user->user_login ) ) {
    
    	wp_clear_auth_cookie();
        @header( 'HTTP/1.0 418 I\'m a teapot' );
        @header( 'Cache-Control: no-cache, must-revalidate' ); 
        @header( 'Expires: Thu, 22 Jun 1978 00:28:00 GMT' );
        die( __( 'error', $this->hook ) );
    
    }

    https://plugins.trac.wordpress.org/browser/better-wp-security/trunk/inc/secure.php#L925

    someone, 24 Января 2014

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

    +121

    1. 1
    http://developerslife.ru/7879

    // говнокодогенератор, он существует

    Smekalisty, 02 Декабря 2013

    Комментарии (0)
  7. Куча / Говнокод #13966

    +121

    1. 1
    2. 2
    3. 3
    ref <- newIORef 0
    replicateM_ 1000000 $ modifyIORef ref (+1)
    readIORef ref >>= print

    LispGovno, 17 Октября 2013

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

    +121

    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
    if
    	(MatchPattern MatData Pattern:"MeshID *: *") and (
    		local	Params = (FilterString (SubString MatData 8 -1) ":")
    		Params.Count == 2 and (
    			MatData = (TrimLeft (TrimRight Params[2]))
    			MID = (Params[1] as integer)
    			if
    				MID < 1 or
    				MID > 1000
    			then
    				InputOK = false
    		)
    	)
    then (
    	...
    )

    MAXScript
    Чумачечая валидация ввода информации о материале по несложному паттерну:
    MeshID <Mesh material ID, a number from 1 to 1000>: <Material name>
    ...
    Use LINQ, Luke!

    3Doomer, 01 Октября 2013

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

    +121

    1. 1
    #include "commode.h"

    //development might be long and harassing
    //we'll need some furniture to keep food and coffee

    ckopo, 06 Сентября 2013

    Комментарии (1)
  10. Pascal / Говнокод #13729

    +121

    1. 1
    2. 2
    Держу - верчу вот, в руках сидюк. На обложке надпись: "Программирование для школькиков и студентов". 
    Вроде бы пустяк, но с недавних пор эта фраза для меня звучит весьма кощунственно.

    Stertor, 03 Сентября 2013

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

    +121

    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
    /// Разрезать строку на части длиной не более maxRecordLen
      private static void splitText(ref List<string> splitTextArray,  string text) {
        splitTextArray = new List<string>();
        for (; ; ) {
          try {
            string str = text.Substring(0, maxRecordLen);
            splitTextArray.Add(str);
            try {
              text = text.Substring(maxRecordLen);
            }
            catch (Exception) {
              break;
            }
          }
          catch (Exception) {
            splitTextArray.Add(text);
            break;
          }
        }
      }

    no comment.

    diimdeep , 17 Июля 2013

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