1. PHP / Говнокод #14169

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    $_where = array();
    $_where[] = "`activity` = 'active'";
    $_where[] = "`counter_of_waiting_questions` = '0'";
    $_where = implode(' AND ', $_where);

    g0rky, 03 Декабря 2013

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

    +76

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    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));
    Не знаю, откуда ты, но знаю, куда тебе дальше.

    Stertor, 03 Декабря 2013

    Комментарии (250)
  3. Java / Говнокод #14167

    +69

    1. 1
    2. 2
    3. 3
    4. 4
    if (errors.isEmpty())
                success(result);
            else
                throw new UnsupportedOperationException();

    ошибки быть не может!

    Dougrinch, 03 Декабря 2013

    Комментарии (1)
  4. 1C / Говнокод #14166

    −131

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    Процедура ОбработкаЗаполения(Основание)
    
    	// Другой говнокод
    
    КонецПроцедуры

    Стажёр подошёл с вопросом, почему не обрабатывается ввод на основании, а до этого бился не менее часа.

    Voittamaton, 03 Декабря 2013

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

    +130

    1. 1
    class Int extends Float {}

    http://haxe.ru/ref-base_types

    someone, 02 Декабря 2013

    Комментарии (21)
  6. C# / Говнокод #14163

    +129

    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
    [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>>();

    не шутка

    taburetka, 02 Декабря 2013

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

    +77

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    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

    roman-kashitsyn, 02 Декабря 2013

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

    +155

    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
    $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 и т.д. из строки запроса)

    Homess, 02 Декабря 2013

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

    +121

    1. 1
    http://developerslife.ru/7879

    // говнокодогенератор, он существует

    Smekalisty, 02 Декабря 2013

    Комментарии (0)
  10. C++ / Говнокод #14156

    +13

    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
    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;
            }
    };

    Это ж пипец, дорогие товарищи...

    blackhearted, 29 Ноября 2013

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