- 1
- 2
- 3
if (($arrRoleInHold = $this->syncByToken($token)) && (!$arrRoleInHold)) {
throw new Exception('');
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+161
if (($arrRoleInHold = $this->syncByToken($token)) && (!$arrRoleInHold)) {
throw new Exception('');
}
хорошее условие!
+156
if (!!window.Worker){
var worker = new Worker('worker.js');
worker.postMessage('Hellow World');
worker.onmessage = function (e){
alert(e.data);
};
}
Из статьи на швабре: /post/132785/
+107
var a : int64;
begin
assign(input, 'input.txt'); reset(input);
assign(output, 'output.txt'); rewrite(output);
read(a);
if a=25 then write ('2.7182818284590452353602875');
if a=24 then write ('2.718281828459045235360288');
if a=23 then write ('2.71828182845904523536029');
if a=22 then write ('2.7182818284590452353603');
if a=21 then write ('2.718281828459045235360');
if a=20 then write ('2.71828182845904523536');
if a=19 then write ('2.7182818284590452354');
if a=18 then write ('2.718281828459045235');
if a=17 then write ('2.71828182845904524');
if a=16 then write ('2.7182818284590452');
if a=15 then write ('2.718281828459045');
if a=14 then write ('2.71828182845905');
if a=13 then write ('2.7182818284590');
if a=12 then write ('2.718281828459');
if a=11 then write ('2.71828182846');
if a=10 then write ('2.7182818285');
if a=9 then write ('2.718281828');
if a=8 then write ('2.71828183');
if a=7 then write ('2.7182818');
if a=6 then write ('2.718282');
if a=5 then write ('2.71828');
if a=4 then write ('2.7183');
if a=3 then write ('2.718');
if a=2 then write ('2.72');
if a=1 then write ('2.7');
if a=0 then write ('3')
end.
Вывод числа e с заданной точностью
+135
/// <summary>
/// Converts to number.
/// </summary>
/// <param name="value">The value.</param>
/// <returns>System.String.</returns>
public static string convertToNumber(string value) {
string mvalue = "0";
string wildchars = @"~!@#$%^&*()_+={}[]|\/?><,`:;'";
bool chknegative = false;
if (value == null)
value = "";
try {
if (value == "") {
mvalue = "0";
}
for (var i = 0; i < wildchars.Length; i++) {
string wildchar = wildchars.Substring(i, 1);
//chknegative = value.Contains(wildchar);
mvalue = value.Replace(wildchar, "");
value = mvalue;
}
chknegative = value.Contains("-");
if (chknegative) {
mvalue = value.Replace("-", "");
mvalue = "-" + mvalue;
}
else {
mvalue = value;
}
}
catch {
mvalue = "0";
}
return mvalue;
}
−404
UIImageView *footerWhite1PxLineThatOnlyAndersWillNotice = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sidebar_line_white"]];
ох уж этот Андерс!
+155
express_static = express.static(static_files.file_path)
app.use('/files', (req, res, next) ->
if Math.random() > app.failureProbability
express_static.handle(req, res, next)
else
# server failure or timeout
if Math.random() < 0.5
console.log('\x1B[31mRandom failure\x1B[0m')
res.send(500, 'Fuck you')
else
console.log('\x1B[31mRandom timeout\x1B[0m')
)
а вот так мы тестируем сетевую нагрузку (нода, кофе)
+132
var resultList = new List<CentralBankRateData>();
using (var resultSet = m_Service.GetCursOnDate(request.Date))
using (var reader = new DataTableReader(resultSet.Tables["ValuteCursOnDate"]))
while (reader.Read())
resultList.Add(new CentralBankRateData
{
Name = (string) reader["Vname"],
Nominal = (decimal) reader["Vnom"],
Rate = (decimal) reader["Vcurs"],
NumberCode = (int) reader["Vcode"],
StringCode = (string) reader["VchCode"]
});
Какой Центробанк, такая и валюта. m_Service типа DailyInfoSoap, это сервис отдачи курсов валют. А еще у них получение актуального списка БИКов возможно только в древнейшем формате dBASE.
+153
// В чем смысл переменной knc?
var knc = 0;
var k_fr = parent.document.getElementById(kph);
if (k_fr) {
knc = 1;
}
Маленький кусочек говнокода.
Не сказал бы что тут что-то феноменальное, но подобная логика на всем проекте
"Мы создали переменную для проверки для того что бы проверить переменную для проверки"
+88
procedure sr(var q, w: string; j, k: integer);
begin
for j := 1 to 100 do
begin
if ord(q[j]) - ord(w[j]) > 0 then begin for k := 1 to pos(' ', q) do write(q[k]);exit; end
else if ord(q[j]) - ord(w[j]) < 0 then begin for k := 1 to pos(' ', w) do write(w[k]);exit; end;
end;
for k := 1 to pos(' ', w) do write(w[k]);
end;
procedure sr2(var q, w, e, r: string; j, k, p: integer);
begin
for j := 1 to 101 do
begin
if ord(q[j]) - ord(w[j]) > 0 then begin r := q;break; end
else if ord(q[j]) - ord(w[j]) < 0 then begin r := w;break;end;
inc(p);
end;
if p>100 then r:=w;
for j := 1 to 100 do
begin
IF E[J]=' ' Then break;
if ord(e[j]) - ord(r[j]) > 0 then begin for k := 1 to pos(' ', e) do write(e[k]);exit; end
else if ord(e[j]) - ord(r[j]) < 0 then begin for k := 1 to pos(' ', r) do write(r[k]);exit; end;
end;
for k := 1 to pos(' ', r) do write(r[k]);
end;
var
st, a, b, c, rd: string;
i, s: integer;
begin
assign(input, 'input.txt'); reset(input);
assign(output, 'output.txt'); rewrite(output);
read(st);
for i := 1 to 102
do
begin
a := a + ' ';
b := b + ' ';
c := c + ' ';
end;
for i := 1 to length(st) do
if st[i] = ' ' then inc(s)
else
case s of
0: a[i] := st[i];
1: b[i - pos(' ', a)] := st[i];
2: c[i - pos(' ', a) - pos(' ', b)] := st[i];
end;
if (a=b) and (b=c) then for i := 1 to pos(' ', a) do write(a[i])
else if (pos(' ', a) > pos(' ', b)) and (pos(' ', a) > pos(' ', c)) then for i := 1 to pos(' ', a) do write(a[i])
else if (pos(' ', b) > pos(' ', a)) and (pos(' ', b) > pos(' ', c)) then for i := 1 to pos(' ', b) do write(b[i])
else if (pos(' ', c) > pos(' ', b)) and (pos(' ', c) > pos(' ', a)) then for i := 1 to pos(' ', c) do write(c[i])
else if (pos(' ', a) = pos(' ', b)) and (pos(' ', b) = pos(' ', c)) then sr2(a, b, c, rd, 0, 0, 0)
else if pos(' ', a) = pos(' ', b) then sr(a, b, 0, 0)
else if pos(' ', c) = pos(' ', b) then sr(c, b, 0, 0)
else if pos(' ', a) = pos(' ', c) then sr(a, c, 0, 0);
end.
Выбор максимума из 3 целых длинных чисел
+57
if (this->IsWhiteFigure())
{
if (abs(position_x - this->GetPositionX()) == 1 && position_y - this->GetPositionY() == -1)
{
this->SetPositionX(position_x);
this->SetPositionY(position_y);
}
else
{
throw IncorrectMoveException();
}
}
else
{
if (abs(position_x - this->GetPositionX() == 1) && position_y - this->GetPositionY() == 1)
{
this->SetPositionX(position_x);
this->SetPositionY(position_y);
}
else
{
throw IncorrectMoveException();
}
}
Тест на внимательность. Сможете ли вы догадаться почему это не работает ?