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

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

    +976

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    public static bool MegaDispose(this IDisposable thіs)
    {
      if (thіs != null)
      {
        thіs.Dispose();
        return true;
      }
      return false;
    }

    CPPGovno, 05 Сентября 2011

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

    +976

    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
    public void OpredelenieKletki(TipiReljefaMiraVelikogo tipKletkiEtt)
    {
    tipKletki = tipKletkiEtt;
     
    #region огромное назначение координат ректанглам вырезания из разнобоя
     
    if (kameraEtojKletki.sasUvelicenie)
    {
        switch (tipKletki)
        {
            case TipiReljefaMiraVelikogo.zelenaRovnaAA:
                malOcered = 1; kadrSasVirezanija = new Rectangle(0, kameraEtojKletki.sasKudaSmotrit * 79, 162, 79);
                smewenieSasKadra = new Vector2(18f, 98f); animacijaLi = false; nomRaznoboja = 19; break;
            case TipiReljefaMiraVelikogo.zelenaRovnaBB:
                malOcered = 1; kadrSasVirezanija = new Rectangle(0, 316 + kameraEtojKletki.sasKudaSmotrit * 79, 162, 79);
                smewenieSasKadra = new Vector2(18f, 98f); animacijaLi = false; nomRaznoboja = 19; break;
            case TipiReljefaMiraVelikogo.zelenaRovnaCC:
                malOcered = 1; kadrSasVirezanija = new Rectangle(0, 632 + kameraEtojKletki.sasKudaSmotrit * 79, 162, 79);
                smewenieSasKadra = new Vector2(18f, 98f); animacijaLi = false; nomRaznoboja = 19; break;
            case TipiReljefaMiraVelikogo.zelenaRovnaDD:
                malOcered = 1; kadrSasVirezanija = new Rectangle(0, 948 + kameraEtojKletki.sasKudaSmotrit * 79, 162, 79);
                smewenieSasKadra = new Vector2(18f, 98f); animacijaLi = false; nomRaznoboja = 19; break;
     
            case TipiReljefaMiraVelikogo.zelenaRovnaVertPalkaAA:
                malOcered = 1; kadrSasVirezanija = new Rectangle(0, 1264 + kameraEtojKletki.sasKudaSmotrit * 79, 162, 79);
                smewenieSasKadra = new Vector2(18f, 98f); animacijaLi = false; nomRaznoboja = 19; break;
            case TipiReljefaMiraVelikogo.zelenaRovnaVertPalkaAb:
                malOcered = 1; kadrSasVirezanija = new Rectangle(0, 1580 + kameraEtojKletki.sasKudaSmotrit * 79, 162, 79);
                smewenieSasKadra = new Vector2(18f, 98f); animacijaLi = false; nomRaznoboja = 19; break;
     
            case TipiReljefaMiraVelikogo.zelenaRovnaVertPalkaBB:
                malOcered = 1; kadrSasVirezanija = new Rectangle(162, 1264 + kameraEtojKletki.sasKudaSmotrit * 79, 162, 79);
                smewenieSasKadra = new Vector2(18f, 98f); animacijaLi = false; nomRaznoboja = 19; break;
            case TipiReljefaMiraVelikogo.zelenaRovnaVertPalkaBc:
                malOcered = 1; kadrSasVirezanija = new Rectangle(162, 1580 + kameraEtojKletki.sasKudaSmotrit * 79, 162, 79);
                smewenieSasKadra = new Vector2(18f, 98f); animacijaLi = false; nomRaznoboja = 19; break;
    
         ... ... ...

    Класс который достает из спрайтшита нужную текстуру и передает её на отрисовку.

    ArtFeel, 21 Июля 2011

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

    +975

    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
    switch (Game1.mus)
                {
                    case false: sb.Draw(disabled, new Vector2(ScrW - 256, 90), Color.White); break;
                    case true: sb.Draw(enabled, new Vector2(ScrW - 256, 90), Color.White); break;
                }
                
                switch (Game1.bloooom)
                {
                    case false: sb.Draw(disabled, new Vector2(ScrW - 256, 180), Color.White); break;
                    case true: sb.Draw(enabled, new Vector2(ScrW - 256, 180), Color.White); break;
                }
                
                switch (Game1.part)
                {
                    case false: sb.Draw(disabled, new Vector2(ScrW - 256, 270), Color.White); break; //420
                    case true: sb.Draw(enabled, new Vector2(ScrW - 256, 270), Color.White); break;
                }
                
                switch (Game1.eff)
                {
                    case false: sb.Draw(disabled, new Vector2(ScrW - 256, 360), Color.White); break; //510
                    case true: sb.Draw(enabled, new Vector2(ScrW - 256, 360), Color.White); break;
                }
                switch (Game1.shad)
                {
                    case false: sb.Draw(disabled, new Vector2(ScrW - 256, 450), Color.White); break; 
                    case true: sb.Draw(enabled, new Vector2(ScrW - 256, 450), Color.White); break;
                }

    Оттуда же, откуда и #5199. Случайно обнаружил...

    RaZeR, 24 Июля 2011

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

    +974

    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
    /*Вариант - вручную*/
    #include <iostream>
    #include <map>
    #include <string>
    #include <utility>
    
    int main(int argc, char* argv[]) {
      std::map<std::string, std::pair<int, int> > files;
      files["0.txt"] = std::make_pair(0, 7);
      files["1.txt"] = std::make_pair(8, 41);
      files["2.txt"] = std::make_pair(42, 50);
      std::map<std::string, std::pair<int, int> >::const_iterator begin = files.begin();
      std::map<std::string, std::pair<int, int> >::const_iterator end = files.end();
      int num = 21;
      for (; begin != end; ++begin) {
        if (num >= (*begin).second.first && num <= (*begin).second.second) {
          std::cout << "Found in " + (*begin).first + "\n";
          break;
        }
      }
      return 0;
    }
    
    /*Вариант - STL+BOOST*/
    #include <algorithm>
    #include <functional>
    #include <iostream>
    #include <map>
    #include <string>
    #include <utility>
    
    #include <boost/bind.hpp>
    
    int main(int argc, char* argv[]) {
      typedef std::map<std::string, std::pair<int, int> > map_type;
      map_type files;
      files["0.txt"] = std::make_pair(0, 7);
      files["1.txt"] = std::make_pair(8, 41);
      files["2.txt"] = std::make_pair(42, 50);
      int num = 21;
      map_type::const_iterator elem;
      elem = std::find_if(
                          files.begin(),
                          files.end(),
                          boost::bind(
                                      std::logical_and<bool>(),
                                      boost::bind(
                                                  std::less_equal<int>(),
                                                  boost::bind(
                                                              &map_type::value_type::second_type::first,
                                                              boost::bind(
                                                                          &map_type::value_type::second,
                                                                          _1)
                                                              ),
                                                  num),
                                      boost::bind(
                                                  std::greater_equal<int>(),
                                                  boost::bind(
                                                              &map_type::value_type::second_type::second,
                                                              boost::bind(
                                                                          &map_type::value_type::second,
                                                                          _1)
                                                              ),
                                                  num)));
      if (elem != files.end())
        std::cout << "Found in " + (*elem).first + "\n";
      return 0;
    }

    Смысл в том, чтобы с данным значением(пример 21) пройтись по таблице и найти в каком элементе данное число(21) находится в диапазоне std::pair<int, int>...
    Сначала написал вручную, но т.к. нужно было сделать с помощью STL, получилось сие чудо.

    rudvil, 13 Мая 2010

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

    +973

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    /* */
            int fooBar() {
                /* do something */
    
    /* - */     return NULL;
    /* + */     return 0ULL;
            }

    > src/foobar.c:42:3: warning: return makes integer from pointer without a cast
    > return NULL;

    П О Ч И Н Е Н О

    #17766

    Elvenfighter, 26 Июля 2015

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

    +973

    1. 1
    2. 2
    3. 3
    Bool IsNumber (string str) {
    return (str.Replace ("0", "").Replace ("1", "").Replace ("2", "").Replace ("3", "").Replace ("4", "").Replace ("5", "").Replace ("6", "").Replace ("7", "").Replace ("8", "").Replace ("9", "").Length == 0);
    }

    http://bash.org.ru/quote/396194

    1_and_0, 22 Июля 2011

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

    +972

    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
    private static void Main(string[] args)
    {
    Label_0000:
        Console.ForegroundColor = ConsoleColor.Green;
        Console.Title = "Inside Attack By XCrackers, Flood And Crash System!!";
        Console.Write("*******************************************************************************\nINSIDE ATTACK , CHECK SYSTEM , FLOOD FIREWALL AND SERVER , CRASH THE SYSTEM\nINSIDE ATTACK , CHECK SYSTEM , FLOOD FIREWALL AND SERVER , CRASH THE SYSTEM\nINSIDE ATTACK , CHECK SYSTEM , FLOOD FIREWALL AND SERVER , CRASH THE SYSTEM\n\n\nBY XCR, AND SYSTEMCHECH GLOBALS\nBY XCR, AND SYSTEMCHECH GLOBALS\nBY XCR, AND SYSTEMCHECH GLOBALS\n\n\nFOR CONTACT:\n\nSKYPE: roeeko10\n\nMSN: [email protected]\n\nSimple, Just Add Me For New UPDATE....\n*******************************************************************************\n\n");
        Console.Write("\n1) Inside.Attack, Flooding\n2) Exit\n\n");
        Console.Write("Your Choise : ");
        switch (int.Parse(Console.ReadLine()))
        {
            case 1:
            {
                Console.Write("\nEnter IP Address : ");
                string ipString = Console.ReadLine();
                Console.Write("\nPort : ");
                int port = int.Parse(Console.ReadLine());
                Console.Write("\nProtocol Tcp/Udp : ");
                Console.ReadLine();
                Console.Write("\nHow Much Request ? : ");
                int num3 = int.Parse(Console.ReadLine());
                byte[] bytes = Encoding.ASCII.GetBytes("abcdefghlkmnopzrstws!!$@$545$%2d21df3s");
                try
                {
                    for (int i = 0; i < num3; i++)
                    {
                        sck = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                        IPEndPoint remoteEP = new IPEndPoint(IPAddress.Parse(ipString), port);
                        sck.SendTimeout = 1;
                        sck.Connect(remoteEP);
                        sck.SendTo(bytes, remoteEP);
                        Console.WriteLine("[*]Inside.Attack, Syn Request : {0} Data Bytes : 1956 BYTE Every 0.3 Sec ", i);
                    }
                }
                catch
                {
                    Console.WriteLine("Cannot Connected To The Host ......");
                    Console.ReadLine();
                }
                Console.WriteLine("[+]Inside Attack Sucsess.!! All The Syn Request And The Data Byte Was Sent !! <ANT KEY FOR CONTINUE>");
                Console.ReadKey();
                goto Label_0000;
            }
            case 2:
                return;
        }
        Console.Clear();
        Console.WriteLine("Incorrect Choose!! . Please Choose 1/2.\n\n");
        goto Label_0000;
    }

    Код 13-и летнего кулхацкера. "Это ДДОС посоны".

    cthulhu25, 20 Января 2012

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

    +972

    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
    str3 = "Insert Into orderList(OrderNo,Date,StoreName,TagCode,Size,Colour,TwoSidedEngraving,
    EngravingOptions,PetsName,PetsNameTwoSide,Phone1,Phone1TwoSide,Phone2,Phone2TwoSide,
    Phone3,Phone3TwoSide,OwnersFirstName,OwnersLastName,StreetAddress,Suburb,State,ZipCode,
    Country,MStreetAddress,MSuburb,MState,MZipCode,MCountry,OwnersFirstNameTwoSide,
    OwnersLastNameTwoSide,StreetAddressTwoSide,SuburbTwoSide,StateTwoSide,ZipCodeTwoSide,
    flag,Other9,idcust,Receiver,demo,databasename,isonline,faxfile) values(N'" + this.Request.Form["Orderno"] +
    "',Getdate(),N'" + Strings.Replace(this.Request.Form["storename"],"'", "''", 1, -1, CompareMethod.Binary) +
    "',N'" + str + "',N'" + this.Request.Form["tagSize"] + "',N'" + this.Request.Form["tagcolor"] + "',N'" +
    this.Request.Form["TwoSide"] + "',N'" + str2 + "',N'" +
    Strings.Replace(Strings.Replace(this.Convert(this.Request.Form["PetsName"]), "'", "''", 1, -1,
    CompareMethod.Binary), "\"", "\"", 1, -1, CompareMethod.Binary) + "',N'" +
    this.Request.Form["chbPetsName"] + "',N'" +
    Strings.Replace(Strings.Replace(Strings.UCase(this.Convert(this.Request.Form["Phone1"])), "'", "''",
    1, -1, CompareMethod.Binary), "\"", "\"", 1, -1, CompareMethod.Binary) + "',N'" +
    this.Request.Form["chbPhone1"] + "',N'" +
    Strings.Replace(Strings.Replace(Strings.UCase(this.Convert(this.Request.Form["Phone2"])),
    "'", "''", 1, -1, CompareMethod.Binary),
    "\"", "\"", 1, -1, CompareMethod.Binary) + "',N'" + this.Request.Form["chbPhone2"] + "',N'" +
    Strings.Replace(Strings.Replace(Strings.UCase(this.Convert(this.Request.Form["Phone3"])),
    "'", "''", 1, -1, CompareMethod.Binary),
    "\"", "\"", 1, -1, CompareMethod.Binary) + "',N'" + this.Request.Form["chbPhone3"] + "',N'" +
    Strings.Replace(Strings.Replace(Strings.UCase(this.Convert(this.Request.Form["FirstName"])),
    "'", "''", 1, -1, CompareMethod.Binary),
    "\"", "\"", 1, -1, CompareMethod.Binary) + "',N'" +
    Strings.Replace(Strings.Replace(Strings.UCase(this.Convert(this.Request.Form["LastName"])),
    "'", "''", 1, -1, CompareMethod.Binary),
    
    <ну и так далее...>
    
    this.Response.Write(function.ExecuteSql(str3));

    lucidfox, 05 Сентября 2011

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

    +971.8

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    oi.Status = o.Active && o.ByCondition!=Condition.None && o.Time==DateTime.MinValue 
       ? OrderStatusType.Condition :
        o.Active
         ? OrderStatusType.Active
         : o.Cancelled
          ? OrderStatusType.Cancelled
          : o.Matched ? OrderStatusType.Matched : OrderStatusType.Unknown;

    Суровый такой, очень суровый код. Спартанец-неформал.

    terR0Q, 13 Апреля 2010

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

    +971.6

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    string[] dateStringParts = dateString.Split(new [] {DateTimeFormatInfo.CurrentInfo.DateSeparator}, StringSplitOptions.RemoveEmptyEntries);
    
    if (dateStringParts.Count() != 3)
    {
        dateStringParts = DateTime.Now.ToString("dd MMMM yyyy").Split(' ');
    }
    
    string day = dateStringParts[0];
    string month =  dateStringParts[1];
    string year = dateStringParts[2];
    string shortYear = dateStringParts[2].Substring(dateStringParts[2].Length - 2, 2);

    Учитесь парсить дато! :)

    adoconnection, 24 Марта 2010

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