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

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

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    Если ВидОперации = Перечисления.МОЛ_ВидыОперацийПоступленияСырья.Перемещение  Тогда
    		ДоговорКонтрагента = "";
    		ТипЦен = "";
    		Если Сырье.Количество()>0 Тогда
    			Для каждого СтрокаСырье Из Сырье Цикл
    				СтрокаСырье.Цена = 0;
    				СтрокаСырье.Сумма = 0;
    				СтрокаСырье.СуммаНДС = 0;
    			КонецЦикла;	
    		КонецЕсли;	
    			
    	КонецЕсли;

    Добавлена проверка, чтобы цикл вдруг не выполнился при пустой таб части!
    Кстати выполняется при открытии формы и постоянно вызывает модифицированность

    Молокозавод 1.3.121

    doom2good, 06 Июня 2019

    Комментарии (26)
  3. JavaScript / Говнокод #25653

    +1

    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
    56. 56
    <script>
            window["flags"] = {
            "purcTOFlag": "true" == "true" ? true : false,
            "ENBL_CANCEL_POLICY": "true" == "true" ? true : false,
            "ENBL_BACKUP_CHECK_OLD_DEVICES": "false" == "true" ? true : false,
            "ENBL_DIRECT_ACCESS_LINKS": "true" == "true" ? true : false,
            "ENBL_NEW_ABG_URL": "true" == "true" ? true : false,
            "cr_9839666": "true" == "true" ? true : false,
            "cubaCRFlag": "true" == "true" ? true : false,
            "cubaMultiCityCRFlag": "true" == "true" ? true : false,
            "youthCRFlag": "true" == "true" ? true : false,
            "ENABLE_AFOP_MODE": "true" == "true" ? true : false,
            "SHARE_ITINERARY_ON_FACEBOOK": "false" == "true" ? true : false,
            "cr_11668201": "true" == "true" ? true : false,
            "hotelCRFlag": "true" == "true" ? true : false,
            "cr_adoshareitinerary": "false" == "true" ? true : false,
            "ROUNDOFF_AMOUNT_FOR_US_EDITION": "true" == "true" ? true : false,
            "hideSeatPromotionalBanner": "true" == "true" ? true : false,
            "enablePremiumRougeCR": "true" == "true" ? true : false,
            "availFareSplit": "true" == "true" ? true : false,
            "improvedMixedCabin": "true" == "true" ? true : false,
            "adoPassengerPrepopulate": "true" == "true" ? true : false,
            "adoIataInformation": "true" == "true" ? true : false,
            "premiumRougeSeatSelection": "true" == "true" ? true : false,
            "displayIntlTerminal": "true" == "true" ? true : false,
            "continueDisabledLightboxIsEnabled": "true" == "true" ? true : false,
            "createAeroplanFromConf": "true" == "true" ? true : false,
            "contOnAvailPage": "true" == "true" ? true : false,
            "alpiSpecialAssistanceCRFlag": "true" == "true" ? true : false,
            "removePaxTitle": "false" == "true" ? true : false,
            "perDiemInsurance": "true" == "true" ? true : false,
            "isVisaCheckoutEnabled": "true" == "true" ? true : false,
            "isCashRewardEnabled": "true" == "true" ? true : false,
            "masterPassCRFlag": "true" == "true" ? true : false,
            "masterPassAllowedEdition": "CA\-en:CA\-fr:CA\-zh",
            "youthphase2CRFlag": "true" == "true" ? true : false,
            "isCitylistPerfEnabled": "true" == "true" ? true : false,
            "isSingleTravelOptionEnabled": "false" == "true" ? true : false,
            "retainPaymentInformation": "true" == "true" ? true : false,
            "hotelChildAgeCR": "true" == "true" ? true : false,
            "displayGeoFirst": "true" == "true" ? true : false,
            "displayDiscAvail": "true" == "true" ? true : false,
            "premiumRougeUpsell": "true" == "true" ? true : false,
            "enableReplaceOpinionLabs": "true" == "true" ? true : false,
            "displayOalRef": "true" == "true" ? true : false,
            "newTravelOptionsLayoutFlag": "true" == "true" ? true : false,
            "hotelWidgetAPI": "true" == "true" ? true : false,
            "enableCombinedPhoneNo": "true" == "true" ? true : false,
            "hideTripSummaryForMobile": "true" == "true" ? true : false,
            "enableSecureAttribute": "true" == "true" ? true : false,
            "enhancedPreviewSeatMap": "true" == "true" ? true : false,
            "enhancedSeatMap": "true" == "true" ? true : false,
            "firstClassCabinCR": "true" == "true" ? true : false,
             .
             .
    }

    Taken from aircanada.com. Enjoy!

    devfromhell, 31 Мая 2019

    Комментарии (88)
  4. Lua / Говнокод #25633

    +1

    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
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    utf8 = {}
    function utf8.charbytes(s, i)
       -- argument defaults
       i = i or 1
       local c = string.byte(s, i)
       
       -- determine bytes needed for character, based on RFC 3629
       if c > 0 and c <= 127 then
          -- UTF8-1
          return 1
       elseif c >= 194 and c <= 223 then
          -- UTF8-2
          local c2 = string.byte(s, i + 1)
          return 2
       elseif c >= 224 and c <= 239 then
          -- UTF8-3
          local c2 = s:byte(i + 1)
          local c3 = s:byte(i + 2)
          return 3
       elseif c >= 240 and c <= 244 then
          -- UTF8-4
          local c2 = s:byte(i + 1)
          local c3 = s:byte(i + 2)
          local c4 = s:byte(i + 3)
          return 4
       end
    end
    
    function utf8.len(s)
       local pos = 1
       local bytes = string.len(s)
       local len = 0
       
       while pos <= bytes and len ~= chars do
          local c = string.byte(s,pos)
          len = len + 1
          
          pos = pos + utf8.charbytes(s, pos)
       end
       
       if chars ~= nil then
          return pos - 1
       end
       
       return len
    end
    
    print(utf8.len("Аутизм")) --6
    
    local mt = {__len = function(self) 
          local k=0
          for _,v in pairs(self) do 
            k = k+1;
            if k > 1 then  print(1) return #self end
          end
          if k==1 and type(self[1])=="string" then
            print(utf8.len(self[k]))
          end
        end};
    setmetatable(_G,{
        __index = function(self, key) return setmetatable({key},mt) end} 
      )
    t=(#Аутизм) --12

    Чот пытался - но словил хуйца.

    3oJIoTou_xyu, 22 Мая 2019

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

    +1

    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
    <?php
                          function php2js ($var) {
    			if (is_array($var)) {
    				$res = "[";
    				$array = array();
    				foreach ($var as $a_var) {
    					$array[] = php2js($a_var);
    				}
    				//return "[" . join(",", $array) . "]";
    				return "" . join(",", $array) . "";
    				
    			}
    			elseif (is_bool($var)) {
    				return $var ? "true" : "false";
    			}
    			elseif (is_int($var) || is_integer($var) || is_double($var) || is_float($var)) {
    				return $var;
    			}
    			elseif (is_string($var)) {
    			
    						
    				//return "\"" . addslashes(stripslashes($var)) . "\"";
    				  return "" . addslashes(stripslashes($var)) . "";	
    			}
    		
    			return FALSE;
    		}

    real_escape_string, 19 Мая 2019

    Комментарии (2)
  6. Си / Говнокод #25612

    +1

    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
    namespace belugina
    {
    void Simple_Merging_Sort (char *name){ 
    	 int a1, a2, k, i, j, kol, tmp;  
    	FILE *f, *f1, *f2;  
    	kol = 0;  
    	if ( (f = fopen(name,"r")) == NULL )    
    		printf("\nИсходный файл не может быть прочитан...");  
    	else {    while ( !feof(f) ) {      
    		fscanf(f,"%d",&a1);      
    		kol++;    
    		}   
    	 fclose(f);  
    	} 
    k = 1;  
    while ( k < kol ){ 
    	f = fopen(name,"r");    
    	f1 = fopen("smsort_1","w");    
    	f2 = fopen("smsort_2","w");   
    	if ( !feof(f) ) fscanf(f,"%d",&a1);    
    	while ( !feof(f) ){     
    		 for ( i = 0; i < k && !feof(f) ; i++ ){        
    			fprintf(f1,"%d ",a1); fscanf(f,"%d",&a1); }      
    		for ( j = 0; j < k && !feof(f) ; j++ ){        
    			fprintf(f2,"%d ",a1);  fscanf(f,"%d",&a1);}   
    	 }   
    	 fclose(f2);    fclose(f1);    fclose(f); 
    f = fopen(name,"w");   f1 = fopen("smsort_1","r");    
    	f2 = fopen("smsort_2","r");    
    	if ( !feof(f1) ) fscanf(f1,"%d",&a1);   
    	if ( !feof(f2) ) fscanf(f2,"%d",&a2);    
    	while ( !feof(f1) && !feof(f2) ){     
    	 	i = 0;      j = 0;     
    	 	while ( i < k && j < k && !feof(f1) && !feof(f2) ) {        
    			if ( a1 < a2 ) {          
    			fprintf(f,"%d ",a1); fscanf(f1,"%d",&a1);i++;}        
    			else {          
    			fprintf(f,"%d ",a2);fscanf(f2,"%d",&a2); j++;}      
    	   	} 
    while ( i < k && !feof(f1) ) {        
    		     fprintf(f,"%d ",a1);  fscanf(f1,"%d",&a1); i++;}      
    		while ( j < k && !feof(f2) ) {        
    		     fprintf(f,"%d ",a2);   fscanf(f2,"%d",&a2);  j++;}   
     	 }    
    	while ( !feof(f1) ) {      
    		fprintf(f,"%d ",a1);      fscanf(f1,"%d",&a1);    }    
    	while ( !feof(f2) ) {      
    		fprintf(f,"%d ",a2);      fscanf(f2,"%d",&a2);    }   
    	fclose(f2);    fclose(f1);    fclose(f);    k *= 2;  
    	}  
    	remove("smsort_1");  remove("smsort_2");
    } 
    }

    Вектор это не динамический массив.

    dethless, 19 Мая 2019

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

    +1

    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
    void Merging_Sort (int n, int *x){
    	int i, j, k, t, s, Fin1, Fin2;
    	int* tmp = new int[n];
    	k = 1;
    	while (k < n){
    		 t = 0;    s = 0;
    		while (t+k < n){
    			Fin1 = t+k;
    			Fin2 = (t+2*k < n ? t+2*k : n);
    			i = t;       j = Fin1;
                for ( ; i < Fin1 && j < Fin2 ; s++){
    				if (x[i] < x[j]) {
    					tmp[s] = x[i];          i++;
    				}        else {
    				 	tmp[s] = x[j];          j++;
    			 	}
    		 	}
    			for ( ; i < Fin1; i++, s++)       tmp[s] = x[i];
    			for ( ; j < Fin2; j++, s++)       tmp[s] = x[j];
    			t = Fin2;
    	 	}   k *= 2;
    	 	for (s = 0; s < t; s++)      x[s] = tmp[s];
    	}
    	delete(tmp);
    }

    Это новый вид искусство?

    dethless, 19 Мая 2019

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    namespace belugina
    {
    void Hoar_Sort (int k, int *x){
    	Quick_Sort (0, k-1, x);}
    }

    Как вы думаете это новая форма рекурсии?

    dethless, 19 Мая 2019

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

    +1

    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
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    <?php
    /**
     * $URL: svn://svn.subversion.ru/usr/local/svn/mzz/trunk/system/forms/validators/formHostnameRule.php $
     *
     * MZZ Content Management System (c) 2005-2007
     * Website : http://www.mzz.ru
     *
     * This program is free software and released under
     * the GNU/GPL License (See /docs/GPL.txt).
     *
     * @link http://www.mzz.ru
     * @version $Id: formHostnameRule.php 3864 2009-10-21 04:50:04Z zerkms $
     */
    /**
     * formHostnameRule: правило, проверяющее имя хоста
     *
     * @package system
     * @subpackage forms
     * @version 0.1.1
     */
    class formHostnameRule extends formAbstractRule
    {
        private $validTlds = array(
        'ac', 'ad', 'ae', 'aero', 'af', 'ag', 'ai', 'al', 'am', 'an', 'ao',
        'aq', 'ar', 'arpa', 'as', 'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb',
        'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'biz', 'bj', 'bm', 'bn', 'bo',
        'br', 'bs', 'bt', 'bv', 'bw', 'by', 'bz', 'ca', 'cat', 'cc', 'cd',
        'cf', 'cg', 'ch', 'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'com', 'coop',
        'cr', 'cu', 'cv', 'cx', 'cy', 'cz', 'de', 'dj', 'dk', 'dm', 'do',
        'dz', 'ec', 'edu', 'ee', 'eg', 'er', 'es', 'et', 'eu', 'fi', 'fj',
        'fk', 'fm', 'fo', 'fr', 'ga', 'gb', 'gd', 'ge', 'gf', 'gg', 'gh',
        'gi', 'gl', 'gm', 'gn', 'gov', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu',
        'gw', 'gy', 'hk', 'hm', 'hn', 'hr', 'ht', 'hu', 'id', 'ie', 'il',
        'im', 'in', 'info', 'int', 'io', 'iq', 'ir', 'is', 'it', 'je', 'jm',
        'jo', 'jobs', 'jp', 'ke', 'kg', 'kh', 'ki', 'km', 'kn', 'kr', 'kw',
        'ky', 'kz', 'la', 'lb', 'lc', 'li', 'lk', 'lr', 'ls', 'lt', 'lu',
        'lv', 'ly', 'ma', 'mc', 'md', 'me', 'mg', 'mh', 'mil', 'mk', 'ml', 'mm',
        'mn', 'mo', 'mobi', 'mp', 'mq', 'mr', 'ms', 'mt', 'mu', 'museum', 'mv',
        'mw', 'mx', 'my', 'mz', 'na', 'name', 'nc', 'ne', 'net', 'nf', 'ng',
        'ni', 'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om', 'org', 'pa', 'pe',
        'pf', 'pg', 'ph', 'pk', 'pl', 'pm', 'pn', 'pr', 'pro', 'ps', 'pt',
        'pw', 'py', 'qa', 're', 'ro', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd',
        'se', 'sg', 'sh', 'si', 'sj', 'sk', 'sl', 'sm', 'sn', 'so', 'sr',
        'st', 'su', 'sv', 'sy', 'sz', 'tc', 'td', 'tf', 'tg', 'th', 'tj',
        'tk', 'tl', 'tm', 'tn', 'to', 'tp', 'tr', 'travel', 'tt', 'tv', 'tw',
        'tz', 'ua', 'ug', 'uk', 'um', 'us', 'uy', 'uz', 'va', 'vc', 've',
        'vg', 'vi', 'vn', 'vu', 'wf', 'ws', 'ye', 'yt', 'yu', 'za', 'zm',
        'zw'
        );
        protected function _validate($value)
        {
            if (preg_match('#^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$#', $value)) {
                return true;
            }
            $domainParts = explode('.', $value);
            if (sizeof($domainParts) < 2) {
                return false;
            }
            if (strlen($value) > 254 || strlen($value) < 4) {
                return false;
            }
            $tld = array_pop($domainParts);
            if (!in_array(strtolower($tld), $this->validTlds)) {
                return false;
            }
            $validChars = 'a-z0-9\-';
            foreach ($domainParts as $part) {
                if (strpos($part, '-') === 0 || (strlen($part) > 3 && strpos($part, '--', 2) === 2) || substr($part, -1) === '-') {
                    return false;
                }
                if (!preg_match('#^[' . $validChars . ']{1,63}$#i', $part)) {
                    return false;
                }
            }
            return true;
        }
    }
    ?>

    Домены валидировали-валидировали, да недовалидировали.

    https://github.com/wiistriker/govnokod_legacy/blob/master/mzz/system/forms/validators/formHostnameRule.php

    gost, 17 Мая 2019

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

    +1

    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
    ### WindowsSpyBlocker - Hosts spy rules
    ### License: MIT
    ### Updated: 2019-03-02T02:05:00Z01:00
    ### More info: https://github.com/crazy-max/WindowsSpyBlocker
    
    0.0.0.0 a.ads1.msn.com
    0.0.0.0 a.ads2.msads.net
    0.0.0.0 a.ads2.msn.com
    0.0.0.0 a.rad.msn.com
    0.0.0.0 ac3.msn.com
    0.0.0.0 activity.windows.com
    0.0.0.0 adnexus.net
    
    ...
    
    0.0.0.0 watson.live.com
    0.0.0.0 watson.microsoft.com
    0.0.0.0 watson.ppe.telemetry.microsoft.com
    0.0.0.0 watson.telemetry.microsoft.com
    0.0.0.0 web.vortex.data.microsoft.com
    0.0.0.0 wes.df.telemetry.microsoft.com
    0.0.0.0 win10.ipv6.microsoft.com
    0.0.0.0 win1710.ipv6.microsoft.com
    0.0.0.0 win8.ipv6.microsoft.com
    0.0.0.0 www.msedge.net

    https://github.com/crazy-max/WindowsSpyBlocker/blob/master/data/hosts/spy.txt

    Как вообще дошло до того, что появилась необходимость защищать личную инфу от системы на которой она находиться?

    govnokod3r, 14 Мая 2019

    Комментарии (42)
  11. Си / Говнокод #25593

    +1

    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
    #define paehal int i = 0; char arr[30000]; memset(arr, 0, sizeof(arr));
    #define go i++;
    #define  nozad i--;
    #define plusegg arr[i]++;
    #define minusegg arr[i]--; 
    #define vivodeg putchar(arr[i]);	
    #define tipavhile while(arr[i]){	
    #define nevhile }
    int main() {
    setlocale(0, "");
    paehal
    plusegg plusegg plusegg plusegg plusegg tipavhile plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg  go nozad minusegg nevhile go vivodeg go plusegg plusegg plusegg tipavhile go plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg plusegg go minusegg nevhile go vivodeg 
    return 0;
    }

    брайнфак на минималках
    выводит a!

    pozhiloy, 07 Мая 2019

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