1. JavaScript / Говнокод #8514

    +163

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    function searchTotal(){
        var nationCode = "uk";
        var totalSearchForm = ScriptCommon.getById("totalSearchForm");
    
        if(trimIt(totalSearchForm.topquery.value).length == 0){
            if (nationCode == "cn") {
                alert("请输入关键词");
            } else {
                alert("Please enter a keyword.");
            }
            return;
        }
    
        var selectedPlatformValue = ScriptCommon.getById("selectedPlatform").value;
        var platform1 = totalSearchForm.platform1;
        var platform2 = totalSearchForm.platform2;
        var platform3 = totalSearchForm.platform3;
        var platform4 = totalSearchForm.platform4;
        var platform5 = totalSearchForm.platform5;
        var platform12 = totalSearchForm.platform12;
        var platform13 = totalSearchForm.platform13;
    
        platform1.value = "false";
        platform2.value = "false";
        platform3.value = "false";
        platform4.value = "false";
        platform5.value = "false";
        platform12.value = "false";
        platform13.value = "false";
    
        if(selectedPlatformValue == ""){
            selectedPlatformValue = 'All';
        }
    
        if(selectedPlatformValue == 'All'){
            platform1.value = "true";
            platform2.value = "true";
            platform3.value = "true";
            platform4.value = "true";
            platform5.value = "true";
            platform12.value = "true";
            platform13.value = "true";
        }else if(selectedPlatformValue == 'Windows Mobile'){
            platform1.value = "false";
            platform2.value = "true";
            platform3.value = "false";
            platform4.value = "false";
            platform5.value = "false";
            platform12.value = "false";
            platform13.value = "false";
        }else if(selectedPlatformValue == 'Java'){
            platform1.value = "false";
            platform2.value = "false";
            platform3.value = "true";
            platform4.value = "false";
            platform5.value = "false";
            platform12.value = "false";
            platform13.value = "false";
        }else if(selectedPlatformValue == 'Samsung LiMo'){
            platform1.value = "false";
            platform2.value = "false";
            platform3.value = "false";
            platform4.value = "true";
            platform5.value = "false";
            platform12.value = "false";
            platform13.value = "false";
        }else if(selectedPlatformValue == 'Widgets'){
            platform1.value = "false";
            platform2.value = "false";
            platform3.value = "false";
            platform4.value = "false";
            platform5.value = "false";
            platform12.value = "true";
            platform13.value = "false";
        }else if(selectedPlatformValue == 'Themes'){
            platform1.value = "false";
            platform2.value = "false";
            platform3.value = "false";
            platform4.value = "false";
            platform5.value = "false";
            platform12.value = "false";
            platform13.value = "true";
        }else if(selectedPlatformValue == 'Android'){
            platform1.value = "true";
            platform2.value = "false";
            platform3.value = "false";
            platform4.value = "false";
            platform5.value = "false";
            platform12.value = "false";
            platform13.value = "false";
        }
    
    /*
        }else if(selectedPlatformValue == 'Samsung LiMo'){
            platform1.value = "false";
            platform2.value = "false";
            platform3.value = "false";
            platform4.value = "true";
            platform5.value = "false";
        }else if(selectedPlatformValue == 'Widgets'){

    Вот эта гадость висит на http://innovator.samsungmobile.com/down/cnts/toolSDK.list.do?platformId=1 - сразу видно писал какой-то недоделанный китайский студент, особенно прикалывает alert("请输入关键词");

    AndrKn, 14 Ноября 2011

    Комментарии (8)
  2. Java / Говнокод #8513

    +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
    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
    public class AuthorizedUserObservervable implements Runnable {
    
        private long sleepTime = 1000;
        private HashMap<AuthorizedUserObserver, HashMap<AuthorizedUser, Integer>> observers = new HashMap<AuthorizedUserObserver, HashMap<AuthorizedUser, Integer>>();
        
        
        private void setSleepTime(long sleepTime) {
            this.sleepTime = sleepTime;
        }
        
        
        public void add(AuthorizedUserObserver auo) {
            HashMap<AuthorizedUser, Integer> userCache = new HashMap<AuthorizedUser, Integer>();
            for (AuthorizedUser user : auo.getUsers()) {
                userCache.put(user, null);
            }
            observers.put(auo, userCache);
        }
    
        public void beginObservation() {
            new Thread(this).start();
        }
    
        @Override
        public void run() {
            while (true) {
                try {
                    for (Map.Entry<AuthorizedUserObserver, HashMap<AuthorizedUser, Integer>> observer : observers.entrySet()) {
                        for (Map.Entry<AuthorizedUser, Integer> user : observer.getValue().entrySet()) {
                            int newPostsCount = user.getKey().getNewPostsCount();
                            if (user.getValue() == null || newPostsCount != user.getValue()) {
                                HashMap<AuthorizedUser, Integer> userCache = new HashMap<AuthorizedUser, Integer>();
                                userCache.put(user.getKey(), newPostsCount);
                                observers.put(observer.getKey(), userCache);
                                observer.getKey().notify(user.getKey(), newPostsCount);
                            }
                        }
                    }
    
    
                    Thread.sleep(sleepTime);
                } catch (InterruptedException ex) {
                    Logger.getLogger(UserObservervable.class.getName()).log(Level.SEVERE, null, ex);
                } catch (AuthenticationException e) {
                    Thread.currentThread().stop(e);
                }
            }
        }
    }

    Чего стоит гибкость.

    manyrus, 13 Ноября 2011

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

    +125

    1. 1
    ++[>+++++[>++++++<-]<-]++[>+++++<-]>>+++<<+[[,----------]>>.<.<+]

    ed на brainfuck'е

    rat4, 13 Ноября 2011

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

    +131

    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
    string[] strArray1 = new string[6];
              string[] strArray2 = strArray1;
              int index1 = 0;
              DateTime now = DateTime.Now;
              string str1 = now.Month.ToString();
              strArray2[index1] = str1;
              string[] strArray3 = strArray1;
              int index2 = 1;
              now = DateTime.Now;
              string str2 = now.Day.ToString();
              strArray3[index2] = str2;
              string[] strArray4 = strArray1;
              int index3 = 2;
              now = DateTime.Now;
              string str3 = now.Year.ToString();
              strArray4[index3] = str3;
              string[] strArray5 = strArray1;
              int index4 = 3;
              now = DateTime.Now;
              string str4 = now.Hour.ToString();
              strArray5[index4] = str4;
              string[] strArray6 = strArray1;
              int index5 = 4;
              now = DateTime.Now;
              string str5 = now.Minute.ToString();
              strArray6[index5] = str5;
              string[] strArray7 = strArray1;
              int index6 = 5;
              now = DateTime.Now;
              string str6 = now.Second.ToString();
              strArray7[index6] = str6;
              Program.zipName = string.Concat(strArray1);

    jabacrack, 13 Ноября 2011

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

    +133

    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
    public static string FristChar(this string input)
        {
            if (!string.IsNullOrEmpty(input))
            {
                if (input.Length >= 1)
                {
                    return input.Substring(0, 1);
                }
                else
                {
                    return input;
                }
            }
            else
            {
                return null;
            }
        }

    http://www.extensionmethod.net/Details.aspx?ID=170

    Author: Mehrdad Ghasemi

    Killster, 13 Ноября 2011

    Комментарии (31)
  6. C++ / Говнокод #8509

    +1000

    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
    int *element_iskomoi_posledovatelnosti;
     int tempNum = 1;
    element_iskomoi_posledovatelnosti = new int [maxim];
       
        int k=index_pervogo_elementa_posledovatelnosti;
        element_iskomoi_posledovatelnosti[0]=arr[k];
        printf(" element_iskomoi_posledovatelnosti[%i]=%i\n ",1, element_iskomoi_posledovatelnosti[0]);
     
        for (int j=index_pervogo_elementa_posledovatelnosti; j< n ; j++ )
        if (arr[k]<arr[j]) 
        {
           element_iskomoi_posledovatelnosti[tempNum]=arr[j];
           printf(" element_iskomoi_posledovatelnosti[%i]=%i\n ",tempNum+1, element_iskomoi_posledovatelnosti[tempNum++]);
           k=j;
         }
    }

    Crazy_penguin, 13 Ноября 2011

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

    +150

    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
    <?php
    class sql extends sleshs{
    	//Выборка из баззы
    	//Напоминалочка
    	//$select =Што ищим \\//$from= Где ищим\\//$where=Где именно\\//$param = Допалнительные параметры
    	function select($select,$from,$where=NULL,$param=NULL){
    		$myrow = mysql_query("SELECT ".$select." FROM ".$from." ".$where." ".$param."");
    		if(!(mysql_error())){
    			if(mysql_num_rows($myrow)){
    				return $myrow;
    				}else{return FALSE;}}else{return FALSE;}
    		}
    		
    		
    	//Запись в базу
    	function update($from,$array,$where,$param=NULL){
    		//Формируем запрос и слэшируем
    		for($i=0,$col=count($array)-1;$i<=$col;$i++){
    			$zap .=",`".key($array[$i])."`='".$this->slesh($array[$i][key($array[$i])],$array[$i]['slesh'])."'";
    			}
    		//Удоляем лишнию запятую
    		$zap{0}=' ';
    		//Отпровляем запрос
    		if(mysql_query("UPDATE `".$from."` SET ".$zap." ".$where." ".$param."")){return true;}else{return false;}
    		}
    		
    		
    	//Добавление записи в бд	
    	function insert($from,$array){
    		//Формируем запрос
    		for($i=0,$col=count($array)-1;$i<=$col;$i++){
    			$into .=",`".key($array[$i])."`";
    			$value .=",'".$this->slesh($array[$i][key($array[$i])],$array[$i]['slesh'])."'";
    			
    		}
    		$into{0}=' ';
    		$value{0}=' ';
    		if(mysql_query("INSERT INTO `".$from."` (".$into.") VALUE (".$value.")")){echo'good';}else{echo mysql_query();}
    		}
    	
    	//Удаление
    	function delete($from,$where){return mysql_query("DELETE FROM `".$from."` ".$where."");}
    	}
    ?>

    oop mysql

    lans8097, 13 Ноября 2011

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

    +152

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    $time=12843;
     
    echo $hours = floor($time/3600);
    echo '<br />';
    echo floor($minutes = ($time/3600 - $hours)*60);
    echo '<br />';
    echo $seconds = ceil(($minutes - floor($minutes))*60);

    Пых даты ...

    Sulik78, 13 Ноября 2011

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

    +163

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if ($row['num']) $rating = round(($row['rating'] /  $row['num']), 0); else $rating = 0;
     $rating = $rating;
    
     $rated = <<<HTML
    {$rating}
    HTML;
    
     return $rated;

    Увидел это чудо программистской мысли, когда приступал к выполнению заказа.

    blide, 13 Ноября 2011

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

    +146

    1. 1
    http://macton.smugmug.com/gallery/8936708_T6zQX#593426709_ZX4pZ

    AnimeGovno-_-, 13 Ноября 2011

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