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

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

    +120

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    define ('DRINK_FROM_TIME',	22118400-1);	// 256*24*60*60
    	define ('DRINK_TO_TIME',	22204800); 	// 257*24*60*60
    	
    	$time=time();
    	$time=$time - mktime(0, 0, 0, 1, 0, date("Y", $time) );
    	
    	$desktop -> displayShedule ( ( $time > DRINK_FROM_TIME && $time < DRINK_TO_TIME )?  "C днём программиста!.." : "{SCHEDULE_FOR_TODAY}" );

    --- no comments...

    istem, 12 Сентября 2010

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

    +120

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    string makesig(string mid, string apiid, string method, string secret, string[] param)
            {
                string[] fullparams = new string[] { "api_id=" + apiid, "method=" + method, "v=3.0", "format=JSON" };
                string methodparams = String.Join("©", param);
                string fullparams_j = String.Join("©", fullparams);
                string fpr = String.Join("©", new string[] { fullparams_j, methodparams });
                string[] fpr_s = fpr.Split(new char[] { Convert.ToChar("©") });
                Array.Sort(fpr_s);
                fpr = String.Join("", fpr_s);
                string last = String.Concat(mid, fpr, secret);
                return getMd5Hash(last);
            }

    Так люди делают подпись для запроса к API ВКонтакте

    A1mighty, 19 Августа 2010

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

    +120

    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
    private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
                ComboBox
                    cb = sender as ComboBox;
                TextBox
                    tb = new TextBox();
    
                if (cb == comboBox1)
                {
                    tb = textBox7;
                }
                if (cb == comboBox2)
                {
                    tb = textBox6;
                }
                if (cb == comboBox12)
                {
                    tb = textBox2;
                }
                if (cb == comboBox3)
                {
                    tb = textBox8;
                }
                if (cb == comboBox4)
                {
                    tb = textBox9;
                }
                if (cb == comboBox5)
                {
                    tb = textBox10;
                }
                if (cb == comboBox6)
                {
                    tb = textBox11;
                }
                if (cb == comboBox7)
                {
                    tb = textBox12;
                }
                if (cb == comboBox8)
                {
                    tb = textBox13;
                }
                if (cb == comboBox11)
                {
                    tb = textBox14;
                }
    
                tb.Enabled = !(cb.SelectedIndex > 0);
                tb.Text = (cb.SelectedIndex > 0) ? "" : tb.Text;
            }

    David_M, 05 Августа 2010

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

    +120

    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
    begin
       if not directoryexists('input') then createdir('input');
       if not directoryexists('output') then createdir('output');
       if not directoryexists('temp') then createdir('temp');
       if not directoryexists('temp\temp') then createdir('temp\temp');
       if not directoryexists('temp\temp_') then createdir('temp\temp_');
       if not directoryexists('temp\temp__') then createdir('temp\temp__');
       if not directoryexists('temp\temp___') then createdir('temp\temp___');
       if not directoryexists('temp\temp____') then createdir('temp\temp____');
       if not directoryexists('temp\temp_____') then createdir('temp\temp_____');
       if not directoryexists('temp\temp______') then createdir('temp\temp______');
       if not directoryexists('temp\temp_______') then createdir('temp\temp_______');
       if not directoryexists('temp\temp________') then createdir('temp\temp________');
       if not directoryexists('temp\temp_________') then createdir('temp\temp_________');
       if not directoryexists('temp\temp__________') then createdir('temp\temp__________');
       if not directoryexists('temp\temp___________') then createdir('temp\temp___________');
       if not directoryexists('temp\temp____________') then createdir('temp\temp____________');
       if not directoryexists('temp\temp_____________') then createdir('temp\temp_____________');
       if not directoryexists('temp\temp______________') then createdir('temp\temp______________');
       if not directoryexists('temp\temp_______________') then createdir('temp\temp_______________');
       if not directoryexists('temp\temp________________') then createdir('temp\temp________________');
       print_('Вас приветствует программа для сортировки слвоарей True Sort');
       print_('Если у вас есть какие-то вопросы по её работе - нажмите Help');
       turbo:=false;
    end;

    Кинул знаковый в асю=\

    BlincAttack, 23 Июля 2010

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

    +120

    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
    protected void GridView1_PreRender(object sender, EventArgs e)
        {         
             System.Drawing.Color OddGridColor = new System.Drawing.Color();
             OddGridColor = System.Drawing.Color.FromArgb(0xD3, 0xDE, 0xEF);
             System.Drawing.Color EvenGridColor = new System.Drawing.Color();
             EvenGridColor = System.Drawing.Color.FromArgb(0xEC, 0xE9, 0xD8);
    
                for (int i = 0; i < GridView1.Rows.Count; i++)
                {
                      if (i % 2 == 1)
                      {
                          GridView1.Rows[i].BackColor = OddGridColor;
                      }
                      else
                      {
                          GridView1.Rows[i].BackColor = EvenGridColor;
                      }
                 }
        }

    the way of change GridView color through one ...
    Why do not use <AlternatingRowStyle> ?!!

    O_O, 23 Июня 2010

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

    +120

    1. 1
    string SomeString = Convert.ToString(Convert.ToInt16(((Slider)sender).Value));

    С сайта, посвященного Silverlight.

    Dmitriy, 18 Июня 2010

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

    +120

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    if (!isset($f_i[$i]))
    {
    
    echo $f_i[$i],"<br>";
    }
    }

    Vasiliy, 26 Мая 2010

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

    +120

    1. 1
    2. 2
    3. 3
    4. 4
    public static bool GetUpperBit(long number)
    {
       return number < 0;
    }

    Да это не ГК, но остроумный способ получить верхний бит числа.

    FMB, 25 Мая 2010

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

    +120

    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
    ///<summary>
    /// Перемещение страницы в/из корзины
    ///</summary>
    ///<param name="PageID">Идентификатор страницы</param>
    ///<param name="Direction">Определяет в корзину или из нее перемещать страницу</param>
    ///<param name="Page">Экземпляр страницы</param>
    ///<returns></returns>
    ///<exception cref="Exception"></exception>
    public static Exception PageToRecicle(int PageID, int Direction, Page Page)
    {
        SiteData data = new SiteData("MsSqlConnectionString");
        SiteXml xml = new SiteXml();
        Exception ee = new Exception();
    
        SitePage page = new SitePage(Page);
        if (page.StartPageID == PageID)
        {
            try
            {
                throw new Exception(xml.GetXmlResource("adminmenu.ascx", "RemoveStart"));
            }
            catch (Exception exc)
            {
                ee = exc;
            }
            return ee;
        }
        if (Direction == 0 || !SitePage.HasPageChilds(PageID, false))
        {
            data.ExecuteStoredProcedure("sPageToRecicle", ref ee, "@PageID", PageID, "@Direction", Direction,
                                        "@UserName", HttpContext.Current.User.Identity.Name);
        }
        else
        {
            try
            {
                throw new Exception(xml.GetXmlResource("adminmenu.ascx", "RemoveError"));
            }
            catch (Exception exc)
            {
                ee = exc;
            }
        }
        return ee;
    }

    Это фрагмент коммерческой CMS между прочим. Если бы автор родился в Спарте, его бы незамедлительно ё*нули об скалы.

    sombre-hombre, 25 Мая 2010

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

    +120

    1. 1
    2. 2
    foreach(char Enter in Environment.NewLine)
                  this.Add(Enter);

    Говногость, 10 Апреля 2010

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