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

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

    +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
    21. 21
    22. 22
    23. 23
    24. 24
    // Getting first account data and binding it to control
                    List<string> cardList = new List<string>();
                    List<string> permissionList = new List<string>();
                    string x1 = "";
                    string x2 = "";
                    string x3 = "";
                    string x4 = "";
                    string x6 = "";
                    string x7 = "";
                    string x8 = "";
                    try
                    {
                        x8 = getCardNumberByAccountNumber(CustAcc1.Text);
                    }
                    catch { }
                    GetAllCustomerAccountValue(de_ca1, ref x1, ref x2, ref x3, ref x4, ref cardList, ref permissionList, ref x6, ref x7, ref x8); //, ref x2, ref x3, ref x4, ref cardList, ref x5, ref x6, ref x7, ref x8);
                    FormCustomerAccount1.accountNum = x1;
                    FormCustomerAccount1.fullName = x2;
                    FormCustomerAccount1.streetBuild = x3;
                    FormCustomerAccount1.postalCode = x4;
                    FormCustomerAccount1.creditNote = x6;
                    FormCustomerAccount1.accountBalance = x7;
                    FormCustomerAccount1.cards = cardList;
                    FormCustomerAccount1.permissions = permissionList;

    (

    ellk, 08 Декабря 2011

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

    +120

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    // LockDepth IS enum type!
    if(LockDepth == DepthType.Infinity)
    	_depthElement.InnerText = this.__lockDepth.ToString();
    else
    	_depthElement.InnerText = (string) System.Enum.Parse(LockDepth.GetType(), LockDepth.ToString(), true);

    I got exception on line 5. The LockDepth is enum :)

    bugotrep, 06 Декабря 2011

    Комментарии (1)
  4. PHP / Говнокод #8713

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    protected $_never_allowed_regex = array(
    					"javascript\s*:"			=> '[removed]',
    					"expression\s*(\(|&\#40;)"	=> '[removed]', // CSS and IE
    					"vbscript\s*:"				=> '[removed]', // IE, surprise!
    					"Redirect\s+302"			=> '[removed]'
    	);

    Это не разу не ковнокод, но строкой с // IE, surprise! не поделится, не смог)

    ЗЫ. это CodeIgniter 2.0.3 класс Security, строка 52

    Zerstoren, 02 Декабря 2011

    Комментарии (1)
  5. Си / Говнокод #8696

    +138

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    вот так выглядит загрузка DLL у людей, которые не знают про tchar
    
    const char string [] = "right_dll.dll";
    LPCWSTR put = (LPCWSTR) string;
    HINSTANCE my_dll = LoadLibraryEx (put, 0, DONT_RESOLVE_DLL_REFERENCES);

    Kortez, 01 Декабря 2011

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

    +147

    1. 1
    2. 2
    Обратите внимание:
    http://govnokod.ru/user/4847

    TarasGovno, 29 Ноября 2011

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

    +163

    1. 1
    2. 2
    3. 3
    Обратите внимание:
    http://govnokod.ru/user/4788
    http://govnokod.ru/user/4789

    TarasGovno, 28 Ноября 2011

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

    +146

    1. 1
    2. 2
    3. 3
    <a href="javascript:void(0);" onclick="suspend(8)">
    	<input type="checkbox" value="Suspend Listing" name="" id="id8">
    </a>

    ревьювил код нового джуниора, который пришёл к нам из достаточно крупной компании. Строилось через JS поэтому и запостил в JS

    mgauk, 23 Ноября 2011

    Комментарии (1)
  9. Java / Говнокод #8610

    +81

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    Date date = (Date)value.getParam("DocReceiptDate");
        if (date.getHours() == 24) {
          date.setHours(0);
        }
        String documentReceiptDate = (new SimpleDateFormat("dd.MM.yyyy.kk.mm")).format(date);

    Элегантная попытка форматирования даты.
    Задача было вместо 24 часов писать 00, например не "24.11.2011.24.23", а "24.11.2011.00.23".
    Как все уже догадались, следовало просто использовать формат "dd.MM.yyyy.HH.mm".

    LexeY4eg, 23 Ноября 2011

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

    +162

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    $tmp_arr=array();
    $id1_str='';
    $root_str='';
    foreach($id1 as $id){
    	$id1_str.=$id['id'].' , ';
    	if(!isset($tmp_arr[$id['root']])){
    		$root_str.=$id['root'].' , ';
    		$tmp_arr[$id['root']]=true;
    	}
    }

    это типа такой способ собрать distinct root ids в строку!
    не забыть потом откусить хвост ' , '
    нормальные герои не ищут легких путей

    shitcoder, 17 Ноября 2011

    Комментарии (1)
  11. Java / Говнокод #8525

    +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
    // This is de facto a Map<Integer, Long> because SUM() returns longs, but
    // QueryDSL's type inference makes a fluke here and thinks sum() is an Integer.
    // So the return type is Map<Integer, Integer>. Aren't generics fun?
    final Map<Integer, ? extends Number> map =
    		dsl.from(q).where(q.department.eq(params.getDepartment()), q.quantity.ne(0),
    		q.action.in(UserAction.ORDER_ENGRAVE, UserAction.ORDER_STOCK_WASTAGE,
    				UserAction.ORDER_INVOICE, UserAction.ORDER_STOCK_ADJUSTMENT),
    		QueryDsl.subFrom(q2).where(q2.order.eq(q.order), q2.timestamp.goe(interval.getA()),
    				q2.timestamp.lt(interval.getB()),
    				q2.action.in(UserAction.ORDER_ENGRAVE, UserAction.ORDER_STOCK_WASTAGE,
    						UserAction.ORDER_INVOICE, UserAction.ORDER_STOCK_ADJUSTMENT)).exists())
    	.groupBy(q.order.id).having(q.quantity.sum().gt(0)).map(q.order.id, q.quantity.sum());

    someone, 15 Ноября 2011

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