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

    +2

    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
    48. 48
    class Order_OrderProcessorBuilder
    {
        /**
         * @param $processorName
         * @return Order_Abstract_OrderAbstract
         */
        private static function createOrderProcessor($processorName)
        {
            $processorClassName = 'Order_Types_'.ucfirst($processorName);
            return new $processorClassName;
        }
    
        /**
         * @param $builderName
         * @param Order_Abstract_OrderAbstract $orderProcessor
         * @return Order_Abstract_BuilderAbstract
         */
        private static function createOrderBuilder($builderName, Order_Abstract_OrderAbstract $orderProcessor)
        {
            $builderClassName = 'Order_Builders_'.ucfirst($builderName);
            return new $builderClassName($orderProcessor);
        }
    
        /**
         * @param Order_Abstract_BuilderAbstract $orderBuilder
         * @return Order_Director
         */
        private static function createDirectorClass(Order_Abstract_BuilderAbstract $orderBuilder)
        {
            return new Order_Director($orderBuilder);
        }
    
        /**
         * @param $orderTypeName
         * @return Order_Abstract_OrderAbstract
         */
        public static function build($orderTypeName)
        {
            /** @var Order_Abstract_OrderAbstract $orderProcessor */
            $orderProcessor = self::createOrderProcessor($orderTypeName);
            /** @var Order_Abstract_BuilderAbstract $orderBuilder */
            $orderBuilder = self::createOrderBuilder($orderTypeName, $orderProcessor);
            $director = self::createDirectorClass($orderBuilder);
    
            $director->construct();
            return $orderBuilder->getResult();
        }
    }

    Вот такая у нас есть прослойка, которая работает с паттероном "строитель", честно говоря недавно понял зачем она нужна, не знаю.. Как вам решение? Код не мой

    proweber1, 16 Сентября 2015

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

    +6

    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
    #include <bits/stdc++.h>
    #define MP make_pair
    #define PB push_back
    #define int long long
    #define st first
    #define nd second
    #define rd third
    #define FOR(i, a, b) for(int i =(a); i <=(b); ++i)
    #define RE(i, n) FOR(i, 1, n)
    #define FORD(i, a, b) for(int i = (a); i >= (b); --i)
    #define REP(i, n) for(int i = 0;i <(n); ++i)
    #define VAR(v, i) __typeof(i) v=(i)
    #define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
    #define ALL(x) (x).begin(), (x).end()
    #define SZ(x) ((int)(x).size())
    #ifdef LOCAL
    #define debug(x) {cerr <<#x<<" = " <<x<<"\n"; }
    #define debug2(x, y) {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<"\n";}
    #define debug3(x, y, z) {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<", "<<#z<<" = "<<z<<"\n";}
    #define debug4(x, y, z, t) {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<", "<<#z<<" = "<<z<<", "<<#t <<" = " <<t<<"\n";}
    #define debugv(x) {{cerr <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<"\n"; }}
    #else
    #define debug(x)
    #define debug2(x, y)
    #define debug3(x, y, z)
    #define debug4(x,y,z,t)
    #define debugv(x)
    #define cerr if(0)cout
    #endif
    #define make(type, x) type x; cin>>x;
    #define make2(type, x, y) type x, y; cin>>x>>y;
    #define make3(type, x, y, z) type x, y, z; cin>>x>>y>>z;
    #define make4(type, x, y, z, t) type x, y, z, t; cin>>x>>y>>z>>t;
    #define next ____next
    #define prev ____prev
    #define left ____left
    #define hash ____hash
    using namespace std;
    typedef long long ll;
    typedef long double LD;
    typedef pair<int, int> PII;
    typedef pair<ll, ll> PLL;
    typedef vector<int> VI;
    typedef vector<VI> VVI;
    typedef vector<ll> VLL;
    typedef vector<pair<int, int> > VPII;
    typedef vector<pair<ll, ll> > VPLL;

    Даже #define int long long есть
    http://codeforces.com/contest/575/submission/12867420

    3_dar, 15 Сентября 2015

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

    −1

    1. 1
    #define y1 asdfgfgdvf

    Нехрена юзать глобальные переменные.

    3_dar, 15 Сентября 2015

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

    +4

    1. 1
    Прыщебляди соснули.

    Итак, прыщеблядки. Console.WriteLine() в C# в windows 7 замечательно выводит юникод в консоли после chcp 65001, что в консоль, что в файл (в формате utf-8 без BOM). Жду ваших оправданий, почему это не работает в ваших "кроссплатформенных" поделиях вроде питона.

    3_14dar, 15 Сентября 2015

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

    +1

    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
    class Program
    {
            static void Main()
            {
                UInt64 num;
                Console.WriteLine(num = F(Convert.ToUInt64(Console.ReadLine())));
                Main();
            }
    
            static UInt64 F(UInt64 number)
            {
                return number <= 0 ? 1 : number * F(number - 1);
            }
    }

    Считывание числа и выдача его факториала while(true).

    alexey_70707, 15 Сентября 2015

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

    −98

    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
    &НаКлиенте
    Процедура УстановитьВидимостьПотребностей(Видимость)
    
                  Если Видимость Тогда
                                   Элементы.ТекстУтвержденоПоЗаявкам.ЦветТекстаЗаголовка = Новый Цвет(0,0,0);
                                   Элементы.ТекстУтвержденнаяПотребность.ЦветТекстаЗаголовка = Новый Цвет(0,0,0);
                                   Элементы.ТекстНеиспользованнаяПотребность.ЦветТекстаЗаголовка = Новый Цвет(0,0,0);
                    Иначе
                                   Элементы.ТекстНеиспользованнаяПотребность.ЦветТекстаЗаголовка = Новый Цвет(252,250,235);
                                   Элементы.ТекстУтвержденнаяПотребность.ЦветТекстаЗаголовка = Новый Цвет(252,250,235);
                                   Элементы.ТекстУтвержденоПоЗаявкам.ЦветТекстаЗаголовка = Новый Цвет(252,250,235);
                    КонецЕсли;
    
    Элементы.ТекстСрочнойНакладной.ЦветТекстаЗаголовка = Новый Цвет(252,250,235);
    Элементы.ТекстСрочнойНакладной.ЦветТекста = Новый Цвет(252,250,235);
    
    КонецПроцедуры

    Оригинальный способ управления видимостью элементов УФ без лишних серверных вызовов. Получил женский оргазм=)

    safer_bwd, 15 Сентября 2015

    Комментарии (4)
  7. PHP / Говнокод #18720

    +6

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if (strlen($fio) < 2) {
        $error = 1; $error_text .= "Вы не представились<br>";
    }
    
    if (strlen($fio) > 5) {
        $error = 1; $error_text .= "Такого имени не бывает<br>";
    }

    Только избранный пройдет валидацию

    develop_id666, 15 Сентября 2015

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

    +2

    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
    <?php
    $connect=mysql_connect('localhost', 'gvm.12', '963741258') or die(mysql_error());
    mysql_select_db('gvm.12');
    if(isset($_POST['enter']))
    {
    $login_=$_POST['login_'];
    $password_=md5($_POST['password_']);
    
    $query=mysql_query("SELECT * FROM  users WHERE login='$login_'");
    $user_data=mysql_fetch_array($query);
    if($user_data['password']==$password_)
    {
    echo "You have succesfully enter";
    $check=true;
    }
    else 
    {
    echo "wrong login or password";
    }
    }
    ?>

    Просто пиздец!

    webalex127, 15 Сентября 2015

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

    +1

    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
    void RedoLayout(HWND dialogWindow)
    {
    	RECT rectangle;
    	GetClientRect(dialogWindow, &rectangle);
    
    	/* Status */
    	SetWindowPos(GetDlgItem(dialogWindow, IDC_STATUS), dialogWindow, 
    		0,
    		rectangle.bottom - (layout[2].bottom - layout[2].top),
    		rectangle.right - rectangle.left,
    		(layout[2].bottom - layout[2].top),
    		SWP_NOZORDER);
    
    	/* Panel */
    	SetWindowPos(
    		GetDlgItem(dialogWindow,IDC_PANEL), dialogWindow,
    		(layout[1].left - layout[0].left),
    		(layout[1].top - layout[0].top),
    		rectangle.right - (layout[1].left-layout[0].left) - (layout[0].right - layout[1].right),
    		rectangle.bottom - (layout[1].top - layout[0].top) - (layout[0].bottom - layout[1].bottom),
    		SWP_NOZORDER);
    
    	/* Buttons & CheckBoxes */
    	for (int i = 0; i < sizeof(controls) / sizeof(controls[0]); ++i)
    	{
    		SetWindowPos(
    			GetDlgItem(dialogWindow,controls[i]), dialogWindow,
    			rectangle.right - (layout[0].right - layout[3 + i].left),
    			(layout[3 + i].top - layout[0].top),
    			(layout[3 + i].right - layout[3 + i].left),
    			(layout[3 + i].bottom - layout[3 + i].top),
    			SWP_NOZORDER);
    	}
    }

    Из SDK к Intel RealSense

    kingmonstr, 13 Сентября 2015

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

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    -webkit-text-fill-color: white;
    -webkit-text-stroke-width: 1px;
    -webkit-text-stroke-color: #333;
    -moz-text-fill-color: white;
    -moz-text-stroke-width: 1px;
    -moz-text-stroke-color: #;
    text-shadow:
       1px 1px 0 #333,
     -1px -1px 0 #333,  
      1px -1px 0 #333,
      -1px 1px 0 #333,
       1px 1px 0 #333;

    Сколько нужно строчек CSS, чтобы сделать бордер у букв? (все-равно с разрывами...)

    keitoaino, 13 Сентября 2015

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