1. Куча / Говнокод #8771

    +160

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

    TarasGovno, 08 Декабря 2011

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

    −118

    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
    int CurrentPos;
    
    NSInteger cnt = [ListOfFtpFiles count];
    
    CurrentPos = [[[NSUserDefaults standardUserDefaults] objectForKey:@"DownLoadIndex" ] intValue];
    if (CurrentPos==nil)  CurrentPos=0;
    
    if (CurrentPos == 0) 
    {
        //...
        for (int i = 0; i < (int)cnt; i=i+1)
    	//...
    }

    kodovich, 08 Декабря 2011

    Комментарии (13)
  3. ActionScript / Говнокод #8768

    −114

    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
    for(i=0;i<5;i++){
    		if(_root.positions[i] == number){
    // поменяем мувиклипы местами
    			p2=_root.positions[i+1];
    			with(_root){
    			switch(p2){
    				case 2: tx=b._x; ty=b._y; b._x=c._x; b._y=c._y; c._x=tx; c._y=ty; break;
    				case 1: tx=a._x; ty=a._y; a._x=c._x; a._y=c._y; c._x=tx; c._y=ty; break;
    				case 4: tx=d._x; ty=d._y; d._x=c._x; d._y=c._y; c._x=tx; c._y=ty; break;
    				case 5: tx=e._x; ty=e._y; e._x=c._x; e._y=c._y; c._x=tx; c._y=ty; break;
    				case 6: tx=f._x; ty=f._y; f._x=c._x; f._y=c._y; c._x=tx; c._y=ty; break;
    				default: break;
    			}
    			}

    Когда-то давно написал это, чтобы менять местами два прямоугольника, лежащие рядом, по нажатию на кнопку на одном из них. До сих пор горжусь тем, какой же я крутой кодер.

    unfalse, 08 Декабря 2011

    Комментарии (13)
  4. Python / Говнокод #8767

    −89

    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
    def get_caller_module_dict(levels):
        try:
            raise RuntimeError
        except RuntimeError:
            e,b,t = sys.exc_info()
            f = t.tb_frame
            while levels > 0:
                f = f.f_back                   
                levels -= 1
            ldict = f.f_globals.copy()
            if f.f_globals != f.f_locals:
                ldict.update(f.f_locals)
    
            return ldict

    cxielamiko, 08 Декабря 2011

    Комментарии (10)
  5. Java / Говнокод #8766

    +76

    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
    public class Xorer {
        private static long SHIFR= 71180519;
        private Xorer() {
        }
    
        /**
         * ��������� �������� value XOR shifr
         * @param value ������� �������� �������� � ��������� �������
         * @return ��������� ��� �������� �������� � ��������� �������
         */
        public static synchronized String executeString(String value){
            String res=null;
            long code=0;
            try{
                  code=Long.parseLong(value);
            } catch(Exception e){
                e.printStackTrace();
            }
            res=execute(code);
            return res;
        }
    
        /**
         * ��������� �������� value XOR shifr
         * @param code ������� �������� �������� � ������� long
         * @return ��������� ��� �������� �������� � ��������� �������
        */
        public static synchronized String execute(long code){
            String res=null;
            if(code>0){
                long newvalue= code ^ SHIFR;
                res=""+newvalue;
            }
            return res;
        }
    }

    Вот вам ещё еда.

    nikelin, 08 Декабря 2011

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

    +132

    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
    local obj_on_cursor = objSetup:get("obj_on_cursor").value
      
                  if ( obj_on_cursor == "none" and 
    			 obj_on_cursor ~= "tool_pincers" and 
    			 obj_on_cursor ~= "tool_knife" ) then
    			 
    			objSetup:get("rope_clicked").value = 1
    			quest_callSFAction(objGame, "onRopeAttrition")
    			sf_worktable_rope_research_complete()
    			
    		elseif ( obj_on_cursor ~= "none" and 
    				 obj_on_cursor == "tool_pincers" and 
    				 obj_on_cursor ~= "tool_knife" ) then
    				 
    				objSetup:get("rope_clicked").value = 1
    				quest_callSFAction(objGame, "onRopeAttritionPincers")
    				sf_worktable_rope_research_complete()
    		
    		elseif ( obj_on_cursor ~= "none"  and 
    			    obj_on_cursor ~= "tool_pincers" and 
    			    obj_on_cursor ~= "tool_knife" ) then
    			quest_callSFAction(objGame, "onWrongTool")
    		end

    Прислали баг по миниигре. Человек, который делал минигру в отпуске, пришлось мне разбираться. Полез в код, а там такое... ХЗ, может и нормально, но у меня чуть глаза не выпали. Такой фигни там много, ~ 1.5К строк, хотя обычно минигра пишется максимум на 500 строк.

    MAGnit, 08 Декабря 2011

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

    +162

    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
    function url_rewriter(){
    	$rules=file_get_contents("system/static/rewrite_rules.conf");
    	$rules=explode("\n",$rules);
    	for ($i=0;$i<count($rules);$i++){
    		$z=explode(" ",$rules[$i]);
    		$r[$z[0]]=$z[1];
    	}
    	foreach ($r as $n => $v)
    	{
    		if ("si".$_GET['url']==$n or "si".$_GET['url']==$n."/") { $_GET['page']=$v; $ok=1;}
    		if ("ab".$_GET['url']==$n or "ab".$_GET['url']==$n."/") { $_GET['page']=$v; $ok=1;}
    		if ("inter".$_GET['url']==$n or "inter".$_GET['url']==$n."/") {$_GET['page']=$v;  $ok=1;}
    		if ("he".$_GET['url']==$n or "he".$_GET['url']==$n."/") {$_GET['page']=$v;  $ok=1;}
      }
      if ("inter".$_GET['url']=="internet-service/cabinet/basket/mobileterminal"||
          "inter".$_GET['url']=="internet-service/cabinet/basket/mobileterminal/"){
        $_GET['page']=14;
        $ok=1;
        $_GET['mobileterminal']="on";
        unset($_GET['url']);
      } 
    	return $ok;
    }

    Реализация ЧПУ...

    nethak, 08 Декабря 2011

    Комментарии (4)
  8. 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)
  9. Java / Говнокод #8762

    +80

    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
    /** ���� ��������� ���� @P@R@I@V@E@T@ @1@8 - ���� ��� ���� ������ */
            public static String removeSabakaCoding(String inStr)
            {
                    try {
                            char[] chars = inStr.toCharArray();
                            StringBuffer sb = new StringBuffer();
                            boolean mustBe = true;
                            boolean sobakaCoding = true;
                            for (int i = 0; i < inStr.length(); i++)
                            {
                                    if (mustBe)
                                    {
                                            if (chars[i] == '@')
                                            { // ���� ��� sobakaCoding � ����..
                                            } else
                                            {
                                                sobakaCoding = false;
                                                break;
                                            }
                                    } else
                                            sb.append(chars[i]);
                                    mustBe=!mustBe;
                            }
                            if (sobakaCoding)
                                    return sb.toString();
                    } catch (Exception e)
                    {
                            e.printStackTrace();
                    }
                    return inStr;
            }

    Чмоке всем в этам чяте!!!111

    nikelin, 08 Декабря 2011

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

    +173

    1. 1
    echo $table = new  Table(new Db_pars(new Db_mysql(new Db_query('SELECT_ALL'))));

    Razban_Guestov, 08 Декабря 2011

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