1. Куча / Говнокод #16078

    +142

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    Начните зарабатывать деньги с Bitcoin прямо сейчас!
    
    Как заработать на биткойнах? Очень просто!
    
    1. Зарегистрируйте кошелёк Bitcoin: https://blockchain.info/ru/wallet
    2. После регистрации введите свой Bitcoin-адрес здесь: http://eb.by/freebitcoins
    3. Нажмите кнопку «ROLL!», чтобы получить бесплатные биткойны
    4. Спустя час вы можете получить ещё, поэтому рекомендую периодически возвращаться на этот сайт.
    5. Как только вы наберёте такую сумму, которую вы хотели бы вывести, зарегистрируйтесь на бирже btc-e.com, и получите рубли, доллары или евро.
    
    Или оставьте деньги в биткойнах, и наблюдайте, как вы становитесь всё богаче за счёт роста стоимости Bitcoin!

    ifkelvofep34lf, 29 Мая 2014

    Комментарии (8)
  2. C++ / Говнокод #16077

    +3

    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
    #define BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(TRAITS_PREFIX, TYPEDEF_TO_FIND) \
    template <class T>\
    struct TRAITS_PREFIX##_bool\
    {\
       template<bool Add>\
       struct two_or_three {one _[2 + Add];};\
       template <class U> static one test(...);\
       template <class U> static two_or_three<U::TYPEDEF_TO_FIND> test (int);\
       static const std::size_t value = sizeof(test<T>(0));\
    };\
    \
    template <class T>\
    struct TRAITS_PREFIX##_bool_is_true\
    {\
       static const bool value = TRAITS_PREFIX##_bool<T>::value > sizeof(one)*2;\
    };\
    //

    Ну тут как бы все просто и понятно. Но зачем заканчивают макрос кодом

    \
    //
    ?

    laMer007, 29 Мая 2014

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

    +5

    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
    struct A {
      int a;
      virtual ~A() {}
    };
    struct B: public A {
      int b;
      B(int _b):b(_b){}
      virtual ~B() {}
    };
    A func(){return A();}
     
    int main(int argc, char* argv[])
    {
      A* a = new B(2);  
      *a = func();
      a->a = 5;
      B *b = dynamic_cast<B*>(a);
      std::cout << b->b << "\t" << b->a;
      return 0;
    }

    Меня попросили ответить что выведет на экран.

    laMer007, 29 Мая 2014

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

    +11

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    for (_i = 1;_i <= int(strlen(Query10->FieldValue("pattern").c_str()));_i++) {
        // ...
    }
    
    if (strlen(Query10->FieldValue("pattern_before").c_str()) == strlen(Query10->FieldValue("pattern_short").c_str())) {
        // ...
    }

    Nuff said.

    bormand, 29 Мая 2014

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

    +12

    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
    template<typename T, typename T1>
    	class TSwitch
    	{
    		private:
    			std::function<T1(T)> _functionSwitch;
    			std::function<void(T)> _defaultFunction;
    			std::map<T1, std::function<void(T)> > _map;
    		private:
    			IActorPtr _protocol;
    			IActorPtr _port;
    			IActorPtr _listParam;
    			IActorPtr _managerData;
    
    		public:
    		TSwitch(std::function<T1(T)> functionSwitch,std::map<T1, std::function<void(T)> > mapSwitch):_functionSwitch(functionSwitch)
    																									,_defaultFunction([](T value){std::cout<<"no way";})
    																									,_map(mapSwitch){}
    		TSwitch(std::function<T1(T)> functionSwitch, std::function<void(T)> defaultValue,std::map<T1, std::function<void(T)> > mapSwitch):_functionSwitch(functionSwitch)
    																																		,_defaultFunction(defaultValue)																																,_map(mapSwitch){}
    		virtual ~TSwitch(){}
    		public:
    			void switches(T value)
    			{
    				auto it=_map.find(_functionSwitch(value));
    				if (it==_map.end()) {_defaultFunction(value); return;}
    				it->second(value);
    			}
    	};

    Вот такая замена switch. Отстойно не правда-ли?

    IKing, 29 Мая 2014

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

    +126

    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
    // sometimes I believe compiler ignores all my comments
    
    // Class used to work around Richard being a fucking idiot
    
    // somedev1 -  6/7/02 Adding temporary tracking of Login screen
    // somedev2 -  5/22/07 Temporary my ass
    
    // Magic. Do not touch.
    
    // Я посвящаю весь этот код, все мою работу, моей жене Дарлин, которая будет поддерживать меня и наших троих детей и собаку, когда выйдет в релиз
    
    return 1; # returns 1
    
    // I am not sure if we need this, but too scared to delete. 
    
    // I am not responsible of this code.
    // They made me write it, against my will.
    
    /* Please work */
    
    options.BatchSize = 300; //Madness? THIS IS SPARTA!
    
    // I have to find a better job
    
    // hack for ie browser (assuming that ie is a browser)
    
    } catch (PartInitException pie) {
        // Mmm... pie
    	
    /*
    after hours of consulting the tome of google
    i have discovered that by the will of unknown forces
    without the below line, IE7 believes that 6px = 12px
    */
    font-size: 0px;

    Самые смешные коментарии в коде собрали на stackoverflow
    Я пролистал первые три страницы, и выписал несколько, которые мне понравились

    http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered

    Smekalisty, 29 Мая 2014

    Комментарии (8)
  7. Ruby / Говнокод #16072

    −136

    1. 1
    2. 2
    3. 3
    4. 4
    it 'traders email should be nil' do
       trader = FactoryGirl.create(:trader, :email => nil)
       trader.email.should be nil
    end

    captain obvious test

    andrejlr, 28 Мая 2014

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

    +5

    1. 1
    2. 2
    3. 3
    4. 4
    //Так я легко "девушку" найду
    If(user.usingOS =="linux" && user.female=true){
    user.Подкатить();
    }

    Решил выпендриться, и сам наговнокодил

    joker, 28 Мая 2014

    Комментарии (14)
  9. SQL / Говнокод #16070

    −167

    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
    insert into #rez
     select  ('<html>')
      Union all
     select  ('<head>')
      Union all
     select  ('<meta http-equiv="content-type" content="text/html; charset=Windows-1251">')
      Union all
     select  ('<title> Report </title>')
      Union all
     select  ('<style type="text/css">')
      Union all
     select  ('.{font-family:Arial;font-size:7pt;}')
      Union all
     select  ('#top{border-top-style:solid;border-width:1;}')
      Union all
     select  ('.titl{font-size:15px;}')
      Union all
     select  ('.title{background-color:rgb(240,240,240)}')
      Union all
     select  ('.data{background-color:rgb(248,248,248)}')
      Union all
     select  ('.nam{background-color:rgb(245,245,245)}')
      Union all
     select  ('</style>')
      union all
     select  ('</head>')
      union all
     select  ('<body>')
     UNION ALL
     select  '<P align=left><SPAN style="FONT-SIZE: 12pt">' + @var1 + '<br><br>'
      union all
    -- ... и еще килобайт 50 подобной фигни. местами с генерацией табличек, с помощью if/case подсвеченных ячеек.

    Спорите FastCGI vs WSGI? Говорите "Логика отдельно, шаблончики отдельно", ORM? Ну-ну. добро пожаловать в Махровый ентепрайз.

    bliznezz, 28 Мая 2014

    Комментарии (7)
  10. Python / Говнокод #16069

    −94

    1. 1
    l.category_out = lambda x: filter(lambda y: y != u'»', x)

    kyzi007, 28 Мая 2014

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