- 1
- 2
- 3
- 4
$_where = array();
$_where[] = "`activity` = 'active'";
$_where[] = "`counter_of_waiting_questions` = '0'";
$_where = implode(' AND ', $_where);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+147
$_where = array();
$_where[] = "`activity` = 'active'";
$_where[] = "`counter_of_waiting_questions` = '0'";
$_where = implode(' AND ', $_where);
+76
procedure TForm1.FormCreate(Sender: TObject);
begin
SetCurrentDir(ExtractFileDir(Application.ExeName));
try
ADOConnection1.Connected:=true;
if ADOConnection1.Connected=true then
begin
ADOTable1.Active:=True;
end;
except
MessageDLG('Îøèáêà ïîäêëþ÷åíèÿ ÁÄ',mtError,[mbOk],0);
end;
SetCurrentDir(ExtractFileDir(Application .ExeName));
Не знаю, откуда ты, но знаю, куда тебе дальше.
+69
if (errors.isEmpty())
success(result);
else
throw new UnsupportedOperationException();
ошибки быть не может!
−131
Процедура ОбработкаЗаполения(Основание)
// Другой говнокод
КонецПроцедуры
Стажёр подошёл с вопросом, почему не обрабатывается ввод на основании, а до этого бился не менее часа.
+130
class Int extends Float {}
http://haxe.ru/ref-base_types
+129
[Serializable]
private class NameValue<N, V>
{
public N Name { get; set; }
public V Value { get; set; }
public NameValue() { }
public NameValue(N name, V value)
{
Name = name;
Value = value;
}
}
private System.Collections.Generic.List<NameValue<string, string>> productList =
new System.Collections.Generic.List<NameValue<string, string>>();
не шутка
+77
final Pair<List<Pair<Pair<Long, String>, Maybe<String>>>, List<Pair<Pair<Long, String>, Maybe<String>>>> split = Cu.split(pushResults, new Filter<Pair<Pair<Long, String>, Maybe<String>>>() {
@Override
public boolean fits(final Pair<Pair<Long, String>, Maybe<String>> arg) {
return arg.second.hasValue();
}
});
Functional Java: simply clever
+155
$sqlQuery = trim(str_replace("\n", ' ', $sqlQuery));
$sqlQuery = trim(str_replace("\r", ' ', $sqlQuery));
$sqlQuery = trim(str_replace("\r\n", ' ', $sqlQuery));
$sqlQuery = trim(str_replace("\t", ' ', $sqlQuery));
$len = strlen($sqlQuery);
$type = '';
$i = 0;
while ($i < $len && $sqlQuery{$i} != ' ') {
$type .= $sqlQuery{$i};
$i++;
}
$type = strtoupper($type);
Получение типа запроса (SELECT, UPDATE и т.д. из строки запроса)
+121
http://developerslife.ru/7879
// говнокодогенератор, он существует
+13
typedef std::queue<Msg> Queue;
struct SharedQueue
{
private:
Queue m_queue;
boost::mutex m_mux;
boost::condition_variable m_condvar;
private:
struct is_empty
{
Queue& queue;
is_empty( Queue& q):
queue(q)
{
}
bool operator()() const
{
return !queue.empty();
}
};
public:
void push(const Msg& msg)
{
boost::mutex::scoped_lock lock(m_mux);
m_queue.push( msg);
m_condvar.notify_one();
}
bool try_pop( Msg& msg, Kind kind)
{
boost::system_time const timeout=boost::get_system_time()+ boost::posix_time::milliseconds( 30000);
boost::mutex::scoped_lock lock( m_mux);
if ( m_condvar.timed_wait( lock, timeout, is_empty( m_queue)))
{
if( !m_queue.empty() && m_queue.front().kind == kind)
{
msg = m_queue.front();
m_queue.pop();
return true;
}
}
return false;
}
};
Это ж пипец, дорогие товарищи...