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

    В номинации:
    За время:
  2. Куча / Говнокод #20111

    +2

    1. 1
    2. 2
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="format-detection" content="telephone=no"/><title>MINI-MBA Professional</title></head><body style="-webkit-text-size-adjust: none; margin: 0; padding: 0; background-color: #f5f5f5"><img src="http://outlineagency.go2cloud.org/aff_i?offer_id=14&aff_id=1004&aff_sub=release_1&source=mailing" width="1" height="1" />
    <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#f5f5f5"><tr><td valign="top" style="border-collapse: collapse"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td style="border-collapse: collapse"><table width="600" border="0" align="center" cellpadding="0" cellspacing="0"><tr>

    всего-то две строчки поправить
    https://gyazo.com/1a9d5a74da2212b7f758adbf908d2c1c

    ngc-598, 01 Июня 2016

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

    +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
    81. 81
    using System;
    using System.Collections.Generic;
    using System.Linq;
    
    namespace Lens.Stdlib
    {
    	/// <summary>
    	/// Standard library randomizer methods.
    	/// </summary>
    	public static class Randomizer
    	{
    		#region Fields
    
    		/// <summary>
    		/// Random seed.
    		/// </summary>
    		public static readonly Random m_Random = new Random();
    
    		#endregion
    
    		#region Methods
    
    		/// <summary>
    		/// Gets a random floating point value between 0.0 and 1.0.
    		/// </summary>
    		/// <returns></returns>
    		public static double Random()
    		{
    			return m_Random.NextDouble();
    		}
    
    		/// <summary>
    		/// Gets a random integer value between 0 and MAX.
    		/// </summary>
    		public static int Random(int max)
    		{
    			return m_Random.Next(max);
    		}
    
    		/// <summary>
    		/// Gets a random integer value between MIN and MAX.
    		/// </summary>
    		public static int Random(int min, int max)
    		{
    			return m_Random.Next(min, max);
    		}
    
    		/// <summary>
    		/// Gets a random element from the list.
    		/// </summary>
    		public static T Random<T>(IList<T> src)
    		{
    			var max = src.Count - 1;
    			return src[Random(max)];
    		}
    
    		/// <summary>
    		/// Gets a random element from the list using a weighter function.
    		/// </summary>
    		public static T Random<T>(IList<T> src, Func<T, double> weighter)
    		{
    			var rnd = m_Random.NextDouble();
    			var weight = src.Sum(weighter);
    			if (weight < 0.000001)
    				throw new ArgumentException("src");
    
    			var delta = 1.0/weight;
    			var prob = 0.0;
    			foreach (var curr in src)
    			{
    				prob += weighter(curr) * delta;
    				if (rnd <= prob)
    					return curr;
    			}
    
    			throw new ArgumentException("src");
    		}
    
    		#endregion
    	}
    }

    Ну что сказать, 3,4-Метилендиоксиамфетамин

    dm_fomenok, 26 Мая 2016

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

    −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
    _colorFlashlightAnimation = compositor.CreateExpressionAnimation(
                      "1.0 - min("
                    + "    1.0,"
                    + "    ("
                    + "        ("
                    + "            ( frame.Offset.x + (frame.Size.x * 0.5) + grid.Offset.x - (windowWidth * 0.5) )"
                    + "          * ( frame.Offset.x + (frame.Size.x * 0.5) + grid.Offset.x - (windowWidth * 0.5) )"
                    + "        ) + ("
                    + "            ( frame.Offset.y + (frame.Size.y * 0.5) + grid.Offset.y - (windowHeight * 0.5) )"
                    + "          * ( frame.Offset.y + (frame.Size.y * 0.5) + grid.Offset.y - (windowHeight * 0.5) )"
                    + "        )"
                    + "    ) / ( radius * radius )"
    + ")");

    Удивитесь, но это Microsoft
    https://github.com/Microsoft/WindowsUIDevLabs/blob/master/Demos/SlideShow/SlideShow/TransitionLibrary.cs

    cherepets, 12 Мая 2016

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

    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
    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
    function floatToStringPrec(f, precisionDigits)
    {
        var PRECISION = Math.pow(10, precisionDigits);
        
        var integerPart = Math.floor(f);
        var fractionalPart = f % 1;
        if (fractionalPart == 0)
        {
            return integerPart.toString();
        }
        
        var zeroesInFracPart = -Math.log10(fractionalPart);
        if (Math.floor(zeroesInFracPart) == zeroesInFracPart)
        {
            zeroesInFracPart--;
        }
        else
        {
            zeroesInFracPart = Math.floor(zeroesInFracPart);
        }
        
        fractionalPart = Math.round(fractionalPart * PRECISION);
    
        while (fractionalPart % 10 == 0)
        {
             fractionalPart /= 10;
        }
        
        var zeroes = '';
        
        if (zeroesInFracPart > 0)
        {
            zeroes = Array(zeroesInFracPart + 1).join('0');
        }
        
        return integerPart.toString() + '.' + zeroes + fractionalPart.toString();
    }

    Преобразовать плавающего питуха в строку; сохранить не более precisionDigits цифр после запятой (остальные - округлить).

    gost, 05 Мая 2016

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

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    static void DelayNZOKParse(string filename)
    {
        ThreadPool.QueueUserWorkItem(new WaitCallback(startNZOKParseFile), filename);
    }
    static void startNZOKParseFile(object state)
    {
        Thread.Sleep(1000);
        startNZOKParseFile(state as string);
    }

    вот это

    apostolovd, 14 Апреля 2016

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

    −89

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    КолЯ=	ЦЕЛ(колБутДлчЯщ/20) ;
    колЯщ=колЯЩ+ КолЯ;
    если колЯ< колБутДлчЯщ/20 Тогда
    	колЯщ=  колЯщ+1;
    конецЕсли;

    Что будет, если пустить в конфигуратор беременную женщину? В коде окажется Коля.

    onden, 09 Марта 2016

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

    +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
    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
    if($_GET['menu_id']==5){header("Location:index.php?link=pages_blog&menu_id=101");}
    if($_GET['menu_id']==2){header("Location:index.php?link=pages_blog&menu_id=102");}
    if($_GET['menu_id']==9){header("Location:index.php?link=pages&id=113");}
    if($_GET['menu_id']==16){header("Location:index.php?link=pages&id=114");}
    if($_GET['menu_id']==11){header("Location:index.php?link=pages&id=115");}
    if($_GET['menu_id']==10){header("Location:index.php?link=pages&id=116");}
    if($_GET['id']==22){header("Location:index.php?link=pages&id=129");}
    if($_GET['id']==23){header("Location:index.php?link=pages&id=130");}
    if($_GET['id']==27){header("Location:index.php?link=pages&id=135");}
    if($_GET['id']==19){header("Location:index.php?link=pages&id=125");}
    if($_GET['id']==28){header("Location:index.php?link=pages&id=127");}
    if($_GET['id']==30){header("Location:index.php?link=pages&id=132");}
    if($_GET['id']==29){header("Location:index.php?link=pages&id=132");}
    if($_GET['id']==26){header("Location:index.php?link=pages&id=134");}
    if($_GET['id']==24){header("Location:index.php?link=pages&id=103");}
    
    
    if($_GET['id']==1){ header("Location:index.php");}
    
    if($_GET['id']==32){ header("Location:index.php?link=pages&id=116#1");}
    if($_GET['id']==33){ header("Location:index.php?link=pages&id=116#2");}
    if($_GET['id']==34){ header("Location:index.php?link=pages&id=116#3");}
    if($_GET['id']==35){ header("Location:index.php?link=pages&id=116#4");}
    if($_GET['id']==36){ header("Location:index.php?link=pages&id=116#5");}
    if($_GET['id']==37){ header("Location:index.php?link=pages&id=116#6");}
    if($_GET['id']==38){ header("Location:index.php?link=pages&id=116#7");}
    if($_GET['id']==39){ header("Location:index.php?link=pages&id=116#8");}
    
    if($_GET['menu_id']==12){header("Location:index.php?link=pages&id=117");}
    if($_GET['menu_id']==14){header("Location:index.php?link=pages&id=118");}
    if($_GET['menu_id']==13){header("Location:index.php?link=pages&id=119");}
    if($_GET['menu_id']==34){header("Location:index.php?link=pages&id=119");}
    if($_GET['menu_id']==15){header("Location:index.php?link=pages&id=120");}
    
    if($_GET['menu_id']==31){header("Location:index.php?link=pages&id=121");}
    
    if($_GET['menu_id']==3){header("Location:index.php?link=pages_blog&menu_id=103");}
    
    if($_GET['id']==17){ header("Location:index.php?link=pages&id=122");}
    if($_GET['menu_id']==17){ header("Location:index.php?link=pages&id=122");}
    if($_GET['menu_id']==35){header("Location:index.php?link=pages&id=123");}
    
    if($_GET['id']==18){ header("Location:index.php?link=pages&id=124");}
    if($_GET['menu_id']==18){ header("Location:index.php?link=pages&id=124");}
    if($_GET['id']==19){ header("Location:index.php?link=pages&id=125");}
    if($_GET['id']==20){ header("Location:index.php?link=pages&id=126");}
    if($_GET['id']==28){ header("Location:index.php?link=pages&id=127");}
    
    if($_GET['menu_id']==32){header("Location:index.php?link=pages_blog&menu_id=103");}
    if($_GET['menu_id']==7){header("Location:index.php?link=pages&menu_id=104");}
    if($_GET['menu_id']==36){header("Location:index.php?link=pages&menu_id=105");}
    if($_GET['menu_id']==6){header("Location:index.php?link=pages_blog&menu_id=106");}
    
    if($_GET['id']==61){ header("Location:index.php?link=pages&id=143");}
    if($_GET['id']==60){ header("Location:index.php?link=pages&id=112");}
    if($_GET['id']==57){ header("Location:index.php?link=pages&id=111");}
    if($_GET['id']==59){ header("Location:index.php?link=pages&id=110");}
    if($_GET['id']==56){ header("Location:index.php?link=pages&id=109");}
    if($_GET['id']==55){ header("Location:index.php?link=pages&id=108");}
    if($_GET['id']==54){ header("Location:index.php?link=pages&id=107");}
    if($_GET['id']==53){ header("Location:index.php?link=pages&id=106");}
    if($_GET['id']==52){ header("Location:index.php?link=pages&id=105");}
    if($_GET['id']==50){ header("Location:index.php?link=pages&id=103");}
    if($_GET['id']==44){ header("Location:index.php?link=pages&id=102");}

    $_GET марафет

    shklovsky, 12 Января 2016

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

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if(preg_match("/^([a-z0-9_\.-]+)@([a-z0-9_\.-]+)\.([a-z\.]{2,6})$/", urldecode($_POST['email']))){
        $email = urldecode($_POST['email']);
    }else{
        $email = '';
    }
    $email  = mysql_real_escape_string($email);
    $email  = strip_tags($email);

    Код на реальном проекте. Я когда увидел, расплакался от умиления.

    Troy, 21 Октября 2015

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

    +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
    int main() {
        interpretator_t i;
    
        i.eval(
        {let, "factorial_helper", {quote, {"this", "num"},
            {if_, {eq_, {"num"}, 0}, 1, {mul_, {"num"}, {{"this"}, {"this"}, {sub_, {"num"}, 1}}}}
        },
        {let, "factorial", {quote, {"num"}, {{"factorial_helper"}, {"factorial_helper"}, {"num"}}},
            {do_,
                {write_, "vvedite chislo: "},
                {assign_, "x", {to_number_, {read_}}},
                {write_, "factorial: "},
                {write_, {{"factorial"}, {"x"}}},
                {write_, "\n"}
            }
        }}
        );
    
        return 0;
    }

    Смотрите, какой лисп я написал. Он еще и ленивый.

    kurwa, 01 Октября 2015

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

    +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
    switch ($result[$j]) {
                        case 0: $res .= $result[$j];
                            break;
                        case 1: $res .= $result[$j];
                            break;
                        case 2: $res .= $result[$j];
                            break;
                        case 3: $res .= $result[$j];
                            break;
                        case 4: $res .= $result[$j];
                            break;
                        case 5: $res .= $result[$j];
                            break;
                        case 6: $res .= $result[$j];
                            break;
                        case 7: $res .= $result[$j];
                            break;
                        case 8: $res .= $result[$j];
                            break;
                        case 9: $res .= $result[$j];
                            break;
                        case 10: $res .= "a";
                            break;
                        case 11: $res .= "b";
                            break;
                        case 12: $res .= "c";
                            break;
                        case 13: $res .= "d";
                            break;
                        case 14: $res .= "e";
                            break;
                        case 15: $res .= "f";
                            break;
                        case 16: $res .= "g";
                            break;
                    }

    p0p, 27 Августа 2015

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