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

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

    +158

    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
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    var q_string = "Название фирмы (профиль), например, Тюнинг";
        var q_string_p = "Наименование услуги/товара, например, Шины";
        var q_string_c = "Адрес, например, Ширямова 13";
        var query_q = "";
        function search_q(){
          var q = $("#searchwords");
          if(query_q == ""){
            q.val(q_string);
          }else q.val(query_q);
          document.getElementById("search_button_q").className="active";
          $("#search_form").attr("action","/"); 
          document.getElementById("search_button_prod").className="nonactive";
          document.getElementById("search_button_cont").className="nonactive";
        }
        function search_p(){
          var q = $("#searchwords");
          if(query_q == ""){
            q.val(q_string_p);
          }else q.val(query_q);
          document.getElementById("search_button_q").className="nonactive";
          document.getElementById("search_button_prod").className="active";
          $("#search_form").attr("action","/price/"); 
          document.getElementById("search_button_cont").className="nonactive";
        }
        function search_c(){
          var q = $("#searchwords");
          if(query_q == ""){
            q.val(q_string_c);
          }else q.val(query_q);
          document.getElementById("search_button_q").className="nonactive";
          document.getElementById("search_button_prod").className="nonactive";
          document.getElementById("search_button_cont").className="active";
          $("#search_form").attr("action","/client/"); 
        }
        function search_click(){
          check_q();
          document.getElementById("search_form").submit();
        }
        function search_focus(){
          var q = $("#searchwords");
          q.val("");
        }
        function search_blur(){
          var q = $("#searchwords");
          var active = $("#search_middle_top .active").attr("id");
          if((q.val()=='')&&(active=="search_button_q")) q.val(q_string);
          if((q.val()=='')&&(active=="search_button_prod")) q.val(q_string_p);
          if((q.val()=='')&&(active=="search_button_cont")) q.val(q_string_c);
        }
        function check_q(){
          var q = $("#searchwords").val();
          if((q == q_string)||(q == q_string_p)||(q == q_string_c)){
            $("#searchwords").val((q.split("например,")[1]));
          }
        }

    Просто феерический пиздец. Никогда не понимал людей подключающих жокверю и блять использующие тока селекторы, причём ещё и в перемешку с getElement*

    DrFreez, 29 Октября 2011

    Комментарии (8)
  3. Си / Говнокод #8346

    +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
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    int LoadFunctions() {
        HINSTANCE kernel;
        decrypt(krn);
        if((kernel = LoadLibraryA(decb)) == NULL) {
            return 1;
        } else {
            decrypt(crf);
            if((CreateFile = (CreateFileP) GetProcAddress(kernel, decb)) == NULL) return 1;
            decrypt(sfpe);
            if((SetFilePointerEx = (SetFilePointerExP) GetProcAddress(kernel, decb)) == NULL) return 1;
            decrypt(wf);
            if((WriteFile = (WriteFileP) GetProcAddress(kernel, decb)) == NULL) return 1;
            decrypt(ch);
            if((CloseHandle = (CloseHandleP) GetProcAddress(kernel, decb)) == NULL) return 1;
            decrypt(ffb);
            if((FlushFileBuffers = (FlushFileBuffersP) GetProcAddress(kernel, decb)) == NULL) return 1;
        }
        HANDLE user;
        decrypt(us);
        if((user = LoadLibraryA(decb)) == NULL) {
            return 1;
        } else {
            decrypt(mba);
            if((MessageBoxA = (MessageBoxAP) GetProcAddress(user, decb)) == NULL) {
                return 1; // ну зачем?
            }
        }
    
        return 0;
    }

    Бида-бида, MessageBox не загрузилась - повод завершить выполнение. Хотя все важнейшие функции уже на месте.

    danilissimus, 28 Октября 2011

    Комментарии (8)
  4. ActionScript / Говнокод #8268

    −111

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    public function cloneString(str:String):String {
    			if(str == null) return null;
    			_byteArray.position = 0;
    			_byteArray.writeUTF(str);
    			_byteArray.position = 0;
    			var res:String =  _byteArray.readUTF();
    			// fuck yeah!
    			return res;
    		}

    суровые сибирские программисты клонируют строки like a pro

    makc3d, 21 Октября 2011

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

    +78

    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
    /*
             * Для операций UPDATE идентификаторы объектов должны быть уникальными.
             */
            HashMap<Long,Boolean> filterUniqueChangeObjects = new HashMap<Long, Boolean>();
            for (RepositoryObject repositoryObject : resultRepositiry) {
    			if(repositoryObject.getOperationType()  == OperationType.UPDATE) {
    				if(filterUniqueChangeObjects.containsKey(repositoryObject.getObjectId())) {
    					log.warn("Объект с идентификатором уже присутствует в обработке UPDATE " + repositoryObject.getObjectId());
    				} else {
    					resultUniqueRepositiry.add(repositoryObject);
    					filterUniqueChangeObjects.put(repositoryObject.getObjectId(), true);
    				}
    			}
    		}

    al_open, 21 Октября 2011

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

    +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
    public class Context {
        public int countSuccess;
        public int countFailed;
        // ....
        public void markSuccess() {
            countSuccess++;
            countFailed--;
        }
    
        public void markSuccessAll() {
            countSuccess += countFailed;
            countFailed = 0;
        }   
        // ....
    }

    Вот такая вот супер-абстракция. Пример клиентского кода:

    public void processRequest(Context ctx) {
    // ...
    ctx.countFailed = elems.size();
    for (String elem : elems) {
    boolean success = doSomething(elem);
    if (success) {
    ctx.markSuccess();
    }
    }
    }

    roman-kashitsyn, 12 Октября 2011

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

    +160

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    $day = date("d"); 
    $month = date("m"); 
    $year = date("Y");
    $hour = date("H")+2;
    if($hour=='24'){$hour='0';}
    if($hour=='25'){$hour='1';}
    $minute = date("i");
    
    $data = ''.$day.'.'.$month.'.'.$year.', '.$hour.':'.$minute.'';

    Красота!

    OJA, 08 Октября 2011

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

    +176

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    <?php
    
    $login = 'XXXXX';
    $pass  = 'XXXXXXXX';
    
    if (@$_COOKIE['login'] != $login) {
        setcookie('login',$login,time()+60*60*24,'/');
    }
    if (@$_COOKIE['password'] != $pass) {
        setcookie('password',$pass,time()+60*60*24,'/');
    }

    Вот такая интересная проверка на авторизацию.

    airrussia, 06 Октября 2011

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

    +126

    1. 1
    2. 2
    3. 3
    4. 4
    if ((properties.ListItem["LocationTaxID"].ToString() != string.Empty) || (properties.ListItem["LocationTaxID"] != null))
    {
    
    }

    Норвеги писаки-проверяки.

    jenik15, 05 Октября 2011

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

    +145

    1. 1
    2. 2
    Ошибка компиляции комментария:
    csrf verification error

    Первый раз на говнокоде выкладывают говнокод Страйкера.

    CPPGovno, 01 Октября 2011

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

    +169

    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
    /*
    =====================================================
     Данный код защищен авторскими правами
    =====================================================
     Файл: index.php
     -----------------------------------------------------
     Версия: 1
    -----------------------------------------------------
     Назначение: минимальные необходимые настройки
    =====================================================
    */
    
    if(!defined('SIGELENGINE')){die();}
    
    #[cache configuration flag]
    
    final class _config
    {
             private         $config         = array();
    
             function __construct()
             {
                     $this->set();
             }
    
             private function set()
             {
                     $this->config['db']['use_buffer']                       = 0;
                     $this->config['db']['show_errors']                      = 1;
                     $this->config['db']['host']                                     = "...";
                     $this->config['db']['port']                                     = "...";
                     $this->config['db']['name']                                     = "...";
                     $this->config['db']['user']                                     = "...";
                     $this->config['db']['pass']                                     = "...";
    
                     $this->config['mail']['mailbox']                        = array("...", "...", "...");
    
                     $this->config['defaults']['mod']                        = "controller";
                     $this->config['defaults']['skin']                       = "index";
                     $this->config['defaults']['debug']                      = 0;
    
                     #[dynamic configuration]
             }
    
             function get()
             {
                     return $this->config;
             }
    }

    com1, 27 Сентября 2011

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