1. Ruby / Говнокод #2582

    −121

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    def has_currency_rate?
      val = false
      if self.currency.id == self.client.company.currency.id or self.currency_rate.blank?
      else
        val = true
      end
      val
    end

    тяжело же жилось людям...

    rakoth3d, 09 Февраля 2010

    Комментарии (14)
  2. Pascal / Говнокод #2581

    +94.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
    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
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    unit uboot;
    
    	procedure boot;
    
    	begin
    
    	delay(100);
    
    	output_buffer:='Uboot v0.1'+chr(10)+'Status: ...Ready!';
    
    	uboot_shell;
    
    	end;
    
    	procedure uboot_shell;
    
    	begin
    
    	showForm;
    
    	removeCommand(enter_cmd);
    
    	input_buffer_num:=formAddString(output_buffer);
    
    	enter_cmd:=createCommand('ok', CM_ITEM, 1);
    
    	input_buffer_num:=formAddTextField('boot >>', '', 256, TF_ANY);
    
    	addCommand(enter_cmd);
    
    	repaint;
    
    	repeat
    
    	delay(100);
    
    	until getClickedCommand=enter_cmd;
    
    	uboot_parse;
    
    	end;
    
    	procedure uboot_parse;
    
    	//Получаем буфер ввода в нижнем регестре
    
    	input_buffer:=locase(formGetText(input_buffer_num));
    
    	if input_buffer='shutdown' then shutdown;
    
    	else if input_buffer='help' then output_buffer:='shutdown, help, boot, clear';
    
    	else if input_buffer='boot' then	os_boot;
    
    	else if input_buffer='clear' then clear;
    
    	else output_buffer:='Unsupported command';
    
    	uboot_shell;
    
    	end;
    
    	procedure shutdown;
    
    	begin
    
    	clearForm;
    
    	halt;
    
    	end;
    
    	procedure clear;
    
    	begin
    
    	clearForm;
    
    	output_buffer:='';
    
    	delay(100);
    
    	uboot_shell;
    
    	end;
    
    	procedure os_boot;
    
    	begin
    
    	input_buffer:='';
    
    	output_buffer:='';
    
    	clearForm;
    
    	kernel.kernel_start('');

    SieMaster, 09 Февраля 2010

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

    +109.4

    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
    //Dictionary used to check if eventValues are unique
    Dictionary<string, string> uniqueEventValues = new Dictionary<string, string>();
    
    //... заполняем коллекцию
    
    try {
        uniqueEventValues.Add(eventValue, "X");
    }
    catch (Exception ex) {
        if (ex.Message.Equals("An item with the same key has already been added.")) {
            msgAddEventParams.Text = "EventValues must be unique. " + eventValue + " is duplicate.";
            msgAddEventParams.Visible = true;
            return;
        }
    }

    мы не ищем легких путей!

    Sharp, 09 Февраля 2010

    Комментарии (7)
  4. Java / Говнокод #2579

    +77.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
    /**
     * todo не самый лучший способ обработки завершения диалогов
     * 
     * @author roman
     */
    public final class MyBoolean
    {
        private boolean value = false;
        public boolean getValue()
        {
            return value;
        }
        public void setValue(
            boolean value )
        {
            this.value = value;
        }
    }

    ctepx, 09 Февраля 2010

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

    +162.9

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    // Реализованно не верно, надо узнать как разобраться.
    $.prototype.deleteClass = function(name) // Удаляет один из классов элемента
    {                                     	 // Пример:$('closeSpan').deleteClass('dialogTitleCloseSpanOver');
    
     this.setClass( (this.className()).replace(" "+name+" ", ' ') );
     this.setClass( (this.className()).replace(""+name+" ", ' ') );
     this.setClass( (this.className()).replace(" "+name+"", ' ') );
    
    return this;
    }

    Я плакалЪ.

    Cr@ZyBoY, 09 Февраля 2010

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

    +176.5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    e=0.55;
    c=e.toString().split('.')[0];
    k=e.toString().split('.')[1].substr(0, 1);
    r=parseInt(c);
    if (k > 4) r=r+1;

    Округление числа старинным индусским способом

    fuckyounoob, 09 Февраля 2010

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

    +144.5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    private static List<KeyValuePair<string, string>> m_destinationUrlByRole = new List<KeyValuePair<string,string>>();
    
    ... 
    дальше по коду
    
    foreach(KeyValuePair<string, string> destination in m_destinationUrlByRole)
    {
         ...
    }

    Если честно, то долго пытался понять сакральный смысл типа приватного поля...

    iVoffka, 09 Февраля 2010

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

    +144.4

    1. 1
    if (1 || $ar_res['NAME'] == "Московские офисы")

    У кого есть трава ?

    atarix12, 09 Февраля 2010

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

    +53.4

    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
    #include <iostream>
    using namespace std;
    struct CandyBar
    {
      char name[20];
      float weight;
      int energy;
    };
    int main()
    {
      CandyBar * snack = new CandyBar;
      *snack =
      {
        "Moncha Munch",
        2.3,
        350
      };
      cout << "Имя = " << *snack->name;
      cout << "\nМасса = " << (*snack).weight;
      cout << "\nЭнергетическая ценность = " << snack->energy << "\n";
      return 0;
    }

    unnicked, 09 Февраля 2010

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

    +170.7

    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
    if ((($company == "1none")&&($office == "loreal"))||($company == "146/710")){
       $from = "[email protected]";
       if ($kto == "c"){
        $to = $req1['email'].",[email protected]";
       }
       else{
        $to = $req1['MAILR'].",[email protected]";
       }
      }
    
      else{
       $from = "[email protected]";
       if ($kto == "c"){
        $to = $req1['email'].",[email protected]";
       }
       else{
        $to = $req1['MAILR'].",[email protected]";
       }
      }

    сейчас вот это говно приходится переводить на нормальный язык

    CountZero, 08 Февраля 2010

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