- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 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
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−121
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
тяжело же жилось людям...
+94.1
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('');
+109.4
//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;
}
}
мы не ищем легких путей!
+77.2
/**
* todo не самый лучший способ обработки завершения диалогов
*
* @author roman
*/
public final class MyBoolean
{
private boolean value = false;
public boolean getValue()
{
return value;
}
public void setValue(
boolean value )
{
this.value = value;
}
}
+162.9
// Реализованно не верно, надо узнать как разобраться.
$.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;
}
Я плакалЪ.
+176.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;
Округление числа старинным индусским способом
+144.5
private static List<KeyValuePair<string, string>> m_destinationUrlByRole = new List<KeyValuePair<string,string>>();
...
дальше по коду
foreach(KeyValuePair<string, string> destination in m_destinationUrlByRole)
{
...
}
Если честно, то долго пытался понять сакральный смысл типа приватного поля...
+144.4
if (1 || $ar_res['NAME'] == "Московские офисы")
У кого есть трава ?
+53.4
#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;
}
+170.7
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]";
}
}
сейчас вот это говно приходится переводить на нормальный язык