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

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

    +6

    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
    public static List<string[]> split(string s)
        {
            bool ins = false;
            int no = 3;
            var L = new List<string>();
            var Res = new List<string[]>();
            var B = new StringBuilder();
            foreach (var c in s)
            {
                switch (c)
                {
                    case '§':
                        if (ins)
                        {
                            ins = false;
                            L.Add(B.ToString());
                            if (no == 0)
                            {
                                Res.Add(L.ToArray<string>());
                                L.Clear();
                                no = 3;
                            }
                        }
                        else
                        {
                            ins = true;
                            B.Clear();
                        }
                        break;
                    case '|':
                        if (!ins) { no--; }
                        else B.Append(c);
                        break;
                    default:
                        if (ins) B.Append(c);
                        break;
                }
            }
            return Res;
        }

    Судя по наименованиям - типичная лаба школьника.
    Однако, автор - Сошников - евангелист мелкософта. Тот самый, который F# пропагандирует (катается с одной и той же лекцией уже несколько лет по разным конференциям; и, кстати, принимают его всегда восторженно).
    Пруф: http://stackoverflow.com/a/36888673/5045688

    koodeer, 27 Апреля 2016

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

    +4

    1. 1
    A notice tag marks out-of-service equipment, such as a fire hydrant. Included is a guide member that has one or more guide channels and which is inserted into a connector body. The CNT array is patterned by using a patterned metallic seed layer on the substrate to form the CNT array by chemical vapor deposition. The pivot arm has a biasing mechanism with a force that results in less impact force between the pivot arm roller and drive roller when the trailing edge of each mail piece passes through the take-away nip, resulting in less vibration of the weighing platform as mail pieces exit the weighing platform. The process gas is exhausted from the chamber.

    Автоматическая генерация изобретений для общественного достояния
    https://geektimes.ru/post/274156/

    Вореции на страже от патентных троллей?

    kerman, 12 Апреля 2016

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

    +12

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    //Если кто-то пытается изменить стандартный отчет и не является Кириллом
    if (in_array($reportId, Default_Model_DbTable_SupplierReport::getInstance()->getStandardIds()) == true
    	&& $this->me->id != Default_Model_User::getKirill()->id
    ) {
    	return false;
    }

    jbot, 12 Апреля 2016

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

    +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
    public class FileStorage {
            public FileStorage() {
                try {
                    if (String.IsNullOrEmpty(Common.GlobalVariables.FileStorage)) {
                        throw new Exception(Common.GuiHelper.ShowErrorMessage("FileStorage", String.Empty));
                    }
    
                    if (!Directory.Exists(Common.GlobalVariables.FileStorage)) {
                        DirectoryInfo di = Directory.CreateDirectory(Common.GlobalVariables.FileStorage);
                        if (!di.Exists) {
                            throw new Exception(Common.GuiHelper.ShowErrorMessage("FileStorageDir", String.Empty));
                        }
                    }
                } catch (Exception er) {
                    throw new Exception(er.Message);
                }
            }
    
            public String CreateFileDirectory() {
                try {
                    int iIdx = 0;
                    Boolean bIsCreated = false;
                    while (!bIsCreated && iIdx < 10) {
                        String sDir = Guid.NewGuid().ToString("N").ToLower();
                        sDir = sDir.Substring(0, 2);
                        if (!Directory.Exists(Common.GlobalVariables.FileStorage + sDir + @"\")) {
                            DirectoryInfo di = Directory.CreateDirectory(Common.GlobalVariables.FileStorage + sDir + @"\");
                            if (di.Exists) {
                                return Common.GlobalVariables.FileStorage + sDir + @"\";
                            }
                        }
    
                        iIdx++;
                    }
    
                    return null;
                } catch (Exception er) {
                    throw new Exception(er.Message);
                }
            }
        }

    может я чего не понимаю, но зачем?

    Lokich, 08 Апреля 2016

    Комментарии (5)
  6. JavaScript / Говнокод #19739

    −2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    if(this.options.raining){
          this.dropletsCounter+=this.options.dropletsRate*timeScale*this.areaMultiplier;
          times(this.dropletsCounter,(i)=>{
            this.dropletsCounter--; // зачем это тут?
            this.drawDroplet(
              random(this.width/this.scale),
              random(this.height/this.scale),
              random(...this.options.dropletsSize,(n)=>{
                return n*n;
              })
            )
    });

    завис на этой строке... https://github.com/codrops/RainEffect/blob/master/src/raindrops.js

    makc3d, 01 Апреля 2016

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

    +2

    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
    79. 79
    80. 80
    public interface ICachedObject<TCachedValue>
        {
            TCachedValue Value { get; set; } 
        } 
    
    public interface ICacheProvider<TCachedObject, TCachedValue>
            where TCachedObject : ICachedObject<TCachedValue>
        {
            TCachedObject Get(string key);
    
            void Set(string key, TCachedObject value);
    
            void Remove(string key);
    
            IEnumerable<TCachedObject> GetAll();
        }
    
    public class CachedEntityObject : ICachedObject<IEntity>
        {
            public EntityState State { get; set; }
    
            public IEntity Value { get; set; }
        }
    
        public abstract class CacheProvider<TCache, TCachedObject, TCachedValue> :
            ICacheProvider<TCachedObject, TCachedValue> 
            where TCache : IDictionary<string, TCachedObject>
            where TCachedObject : ICachedObject<TCachedValue>
        {
            protected TCache Cache;
    
            protected abstract void InitializationCache();
    
            public abstract TCachedObject Get(string key);
    
            public abstract void Set(string key, TCachedObject value);
    
            public abstract void Remove(string key);
    
            public abstract IEnumerable<TCachedObject> GetAll();
        }
    
     public class CacheEntity : CacheProvider<Dictionary<string, CachedEntityObject>, CachedEntityObject, IEntity>
        {
            public CacheEntity()
            {
                InitCache();
            }
    
            protected sealed override void InitCache()
            {
                Cache = new Dictionary<string, CachedEntityObject>();
            }
    
            public override CachedEntityObject Get(string key)
            {
                if (Cache[key] == null)
                    throw new NullReferenceException($"{nameof(key)} not found from cache list");
    
                return Cache[key];
            }
    
            public override void Set(string key, CachedEntityObject value)
            {
                Remove(key);
    
                Cache[key] = value;
            }
    
            public override void Remove(string key)
            {
                if (Cache.ContainsKey(key))
                    Cache.Remove(key);
            }
    
            public override IEnumerable<CachedEntityObject> GetAll()
            {
                return Cache.Values;
            }
        }

    Кэш сущностей

    Serega9I, 31 Марта 2016

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

    0

    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
    $f = fopen("./.htaccess", "r");
    			while (!feof($f)) {
    			    $tmp = fgets($f);
    			    $tmp = str_replace(REDIRECT_USER."/", $_POST["redir_user"]."/", $tmp);
    			    $tmp = str_replace(REDIRECT_SHOP."/", $_POST["redir_shop"]."/", $tmp);
    			    $tmp = str_replace(REDIRECT_ADMIN."/", $_POST["redir_admin"]."/", $tmp);
    			    $tmp = str_replace(REDIRECT_NEWS."/", $_POST["redir_news"]."/", $tmp);
    			    $tmp = str_replace(REDIRECT_CART."/", $_POST["redir_cart"]."/", $tmp);
    			    $tmp = str_replace(REDIRECT_PAYMENT."/", $_POST["redir_payment"]."/", $tmp);
    			    $tmp = str_replace(REDIRECT_INFO."/", $_POST["redir_info"]."/", $tmp);
    			    $line[] = $tmp;
    			}
    			fclose($f);

    Настройка редиректов из админки

    drop_database, 29 Марта 2016

    Комментарии (5)
  9. Куча / Говнокод #19694

    +5

    1. 1
    https://meduza.io/shapito/2016/03/24/iskusstvennyy-intellekt-ot-microsoft-za-sutki-polyubil-gitlera-i-voznenavidel-feministok

    RIP in peace, nazi AI ;_;

    CHayT, 25 Марта 2016

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

    0

    1. 1
    if(0+$count_options!=0)

    sevenflash, 07 Марта 2016

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

    0

    1. 1
    int k = 1000 - 1000 / 7 *7;

    Процент? Что такое процент?

    nicko, 07 Марта 2016

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