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

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

    +144

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    public static class BoolExt
        {
            public static string ToYesNoString(this bool value)
            {
                return value ? "Да" : "Нет";
            }
        }

    alexCoder2007, 17 Июня 2015

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

    +144

    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
    $ git log --pretty=oneline
    
    c8220f95d1b11d2e8a2d57cf4349c40a180bd7f3 Commit 33
    6eeac872fa772c2ea1d57faf286f6520fc831777 Commit 32
    fba42d3f0a6678e670d477bcc0c56819cafd34f9 Commit 31
    4292c5dc9cb9c4360f7ad03b2d5ecabbeb451a55 Commit 30
    2ba640394371f0fd44296c41b99fd42f6abfaf95 Commit 29
    80aa4d6754e5f82f3b111075747fd74f63e1a26c Commit 28
    7f43aa08d9d94e6c09f6435635942010320a824e Commit 27
    574524bf2b0dcb8070ce46ced75cec626e7c84ad Commit 26
    eb620063a690c489e746e2f5633771da66df0903 Commit 25
    
    ...

    https://github.com/gikraychik/bets

    eg0r, 17 Июня 2015

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

    +144

    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
    // Класс валидации в PrestaShop
    class ValidateCore
    {
    ...
    	public static function isIp2Long($ip)
    	{
    		return preg_match('#^-?[0-9]+$#', (string)$ip);
    	}
    
    	public static function isAnything()
    	{
    		return true;
    	}
    ...

    invision70, 16 Июня 2015

    Комментарии (12)
  5. Java / Говнокод #18342

    +144

    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
    public String tommorowCalendarCountry(String date, String country){
    		String tommorowCountry = null;
    		if(date.equals(getTommorow())){
    			tommorowCountry =  country;
    		}
    		return tommorowCountry;
    	}
    	
    	public String tommorowCalendarIndicator(String date, String indicator){
    		String tommorowIndicator = null;
    		if(date.equals(getTommorow())){
    			tommorowIndicator =  indicator;
    		}
    		return tommorowIndicator;
    	}
    	
    	public String tommorowCalendarImportance(String date, String importance){
    		String tommorowImportance = null;
    		if(date.equals(getTommorow())){
    			tommorowImportance =  importance;
    		}
    		return tommorowImportance;
    	}
    	
    	public String tommorowCalendarForecast(String date, String forecast){
    		String tommorowForecast = null;
    		if(date.equals(getTommorow())){
    			tommorowForecast =  forecast;
    		}
    		return tommorowForecast;
    	}
    	
    	public String tommorowCalendarPrevious(String date, String previous){
    		String tommorowPrevious = null;
    		if(date.equals(getTommorow())){
    			tommorowPrevious =  previous;
    		}
    		return tommorowPrevious;
    	}
    	
    	public String tommorowCalendarActual(String date, String actual){
    		String tommorowActual = null;
    		if(date.equals(getTommorow())){
    			tommorowActual =  actual;
    		}
    		return tommorowActual;
    	}
    	
    	public String tommorowCalendarDescription(String date, String description){
    		String tommorowDescription = null;
    		if(date.equals(getTommorow())){
    			tommorowDescription =  description;
    		}
    		return tommorowDescription;
    	}
    	
    	public String tommorowCalendarPeriod(String date, String period){
    		String tommorowPeriod = null;
    		if(date.equals(getTommorow())){
    			tommorowPeriod =  period;
    		}
    		return tommorowPeriod;
    	}
    	
    	public String tommorowCalendarLocation(String date, String location){
    		String tommorowLocation = null;
    		if(date.equals(getTommorow())){
    			tommorowLocation =  location;
    		}
    		return tommorowLocation;
    	}

    пришло с аутсорса. Такого в проекте очень много)

    slavik, 15 Июня 2015

    Комментарии (6)
  6. Java / Говнокод #18314

    +144

    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
    // ====================== БОЛЬШОЕ Спасибо разработчикам архитектуры FzMobile  (GI Center)=====================
            // =============================== Очень удобно трэкать пурчейсы через вьюшку ================================
    
                // Почему бы и не заинитить вьюшку на статическом контексте.
           /*     final FzView fzView = new FzView(sRelatedApplication);
                // Тут мы тупо дадим отдохнуть процесору,
                // и понадеемся, что во время отдыха их сервис все тами, каким то чудом, поднимется.
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        FzController fzController = null;
                        for (int i = 0 ; i < 4; i++){ // Паттерн "настойчивость(с)" был взаимствован непосредственно из их архитектуры.
                            fzController = fzView.getController();
                        }
                        try{ // а тут может и пиздануться.
                            final float fPrice = price/100f;
                            fzController.savePayment(id, "gbp", fPrice, "gbp", fPrice); // даже и не спрашивайте что это за дублирование....
                        }catch (Throwable t){
                            t.printStackTrace();
                        }
                    }
                },555*//*а почему бы и нет*//*);*/ // - слава Аллаху, мы выпилили эту хуету!
            //==============================================================================================

    Egor, 10 Июня 2015

    Комментарии (0)
  7. Pascal / Говнокод #18296

    +144

    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
    82. 82
    83. 83
    84. 84
    85. 85
    Unit Web;
    
    interface
    
    uses System, System.Drawing, System.Windows.Forms;
    
    var f: Form;
    
    type
      WebBro = class(Form)
        procedure button1_Click(sender: Object; e: EventArgs);
      {$region FormDesigner}
      private
        {$resource Web.WebBro.resources}
        button1: Button;
        webBrowser1: WebBrowser;
        {$include Web.WebBro.inc}
      {$endregion FormDesigner}
      public
        constructor;
        begin
          InitializeComponent;
        end;
      end;
    
    implementation
    
    Procedure FindForm();
    begin
      var i:=0;
      while i < Application.OpenForms.Count do
        begin
          f := Application.OpenForms.Item[i];
          if f.Name = 'TwiGen_News' then exit
            else inc(i);
        end;
    end;
    
    procedure WebBro.button1_Click(sender: Object; e: EventArgs);
    begin
      WebBro.ActiveForm.Hide();
      FindForm;
      f.Show();
    end;
    
    end.
    
    //----------------
    
    Unit Unit1;
    
    interface
    
    uses System, System.Drawing, System.Windows.Forms, Web;
    
    var NewsForm: WebBro;
    
    type
      TwiGen_News = class(Form)
        procedure News_Click(sender: Object; e: EventArgs);
      {$region FormDesigner}
      private
        {$resource Unit1.TwiGen_News.resources}
        LogIn: Button;
        News: Button;
        Reg: Button;
        {$include Unit1.TwiGen_News.inc}
      {$endregion FormDesigner}
      public
        constructor;
        begin
          InitializeComponent;
        end;
      end;
    
    implementation
    
    procedure TwiGen_News.News_Click(sender: Object; e: EventArgs);
    begin
      TwiGen_News.ActiveForm.Hide();
      NewsForm := new WebBro;
      NewsForm.Show;
    end;
    
    end.

    Друг писал, но мне он говорил, что переписывал говнокод.
    Pascal ABC.NET.

    Janycz, 08 Июня 2015

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

    +144

    1. 1
    2. 2
    $testing[$i]['ddate'] = ((substr("$departureDate", 0, -4)) . "/" . (substr("$departureDate", -4, 2)) . "/" . (substr("$departureDate", -2))) . "(" . ((substr("$departureTime", 0, -2)) . ":" . (substr("$departureTime", -2))) . ")";
    $testing[$i]['adate'] = ((substr("$arrivalDate", 0, -4)) . "/" . (substr("$arrivalDate", -4, 2)) . "/" . (substr("$arrivalDate", -2))) . "(" . ((substr("$arrivalTime", 0, -2)) . ":" . (substr("$arrivalTime", -2))) . ")";

    из реального проекта, который писал индус.

    форматирование даты. это все еще и в цикле

    namreg, 05 Июня 2015

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

    +144

    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
    function timeToSec($date){
    		
    		$timeToSec = 0;
    		
    		$month_to_days = array(1=>0,2=>31,3=>59,4=>90,5=>90,6=>151,7=>181,8=>212,9=>243,10=>273,11=>304,12=>334);
    		
    		$year = intval(substr($date, 0, 4));
    		$month = intval(substr($date, 5, 2));
    		$day = intval(substr($date, 8, 2));
    		$hover = intval(substr($date, 11, 2));
    		$minute = intval(substr($date, 14, 2));
    		$second = intval(substr($date, 17, 2));
    		
    		$timeToSec+= ($year-1 - ($year-1)%4)/4 * 24 * 60 * 60 + ($year-1) * 355 * 24 * 60 * 60;
    		$timeToSec+= $month_to_days[$month] * 24 * 60 * 60;
    		if($year%4==0 && $month>2){
    				$timeToSec+= 24 * 60 * 60;
    		}
    		$timeToSec+= ($day-1) * 24 * 60 * 60;
    		$timeToSec+= $hover * 60 * 60;
    		$timeToSec+= $minute * 60;
    		$timeToSec+= $second;
    		
    		return $timeToSec;		
    	}

    просто смотрел проекты прошлого программера....

    kolibri, 03 Июня 2015

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

    +144

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    10 MEDIAN=0
    15 FOR Q=1 TO 10000 REM Lifes
    20 TOTAL=0 REM Money
    25 FOR I=1 TO 100
    30 M=RND
    35 IF M<0.5 THEN N=INT(10*RND)
    40 IF M>=0.5 THEN N=-INT(10*RND)
    45 TOTAL=TOTAL+N
    50 NEXT I
    55 MEDIAN=MEDIAN+TOTAL
    60 PRINT Q,"MEDIAN="MEDIAN/Q
    65 NEXT Q

    GW-BASIC
    "Жизнь по генератору случайных чисел: стратегия успеха"
    автор: Евгений Золотов

    grait, 03 Июня 2015

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

    +144

    1. 1
    if ((int)$qty && ((int)$qty > 0)) {

    OpenCart

    OverOverMind, 28 Мая 2015

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