1. Лучший говнокод

    В номинации:
    За время:
  2. PHP / Говнокод #16163

    +165

    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
    /* Выше HTML ... */
    
    include_once "config/mysql.php";
    
    $email = $_POST['email'];
    $password = $_POST['password'];
    $confirm = $_POST['confirm'];
    
    $email = stripslashes($email);
    $email = htmlspecialchars($email);
    $email = trim($email);
    
    $password = stripslashes($password);
    $password = htmlspecialchars($password);
    $password = trim($password);
    
    $confirm = stripslashes($confirm);
    $confirm = htmlspecialchars($confirm);
    $confirm = trim($confirm);
    
    /* ... больше ПоХаПэ */

    Мммм... О функциях не слышали?

    volter9, 14 Июня 2014

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

    +103

    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
    public bool Enabled(string elementId)
            {
                bool flag = false;
                bool flagFalse = false;
                bool flagTrue = false;
                bool mainFlag = false;
                IWebElement input = Driver.FindElement(By.Id(elementId));
                if (input.Enabled == true)
                {
                    flagTrue = true;                
                }
                else
                    if (input.Enabled == false)
                    {
                        flagFalse = false;                    
                    }
    
                if (flagTrue = true)
                {
                    mainFlag = flagTrue;
                }
    
                else if (flagFalse == false)
                {
                    mainFlag = flagFalse;
                }
                return mainFlag;
            }

    Астрологи объявили неделю флагов. Их количество увеличивается вдвое.

    alexCoder2007, 07 Июня 2014

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

    +5

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

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

    joker, 28 Мая 2014

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

    +129

    1. 1
    mixin(iota(3).map!(i => format("v[%1$d]+=rhs.v[%1$d];", i)).join());

    LispGovno, 23 Мая 2014

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

    +15

    1. 1
    2. 2
    3. 3
    int main() {
    //new int;
    FreeConsole();

    LispGovno, 19 Мая 2014

    Комментарии (14)
  7. Си / Говнокод #15983

    +131

    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
    #include <stdio.h>
    #include <tchar.h>
    
    #define MVALUE 6
    
    
    void bufret(int pos, int limit, int maxlimit, bool direction)
    {
    	putchar((char)((pos&0xff)+0x30)) ;
    	if(((pos<limit)&&direction)||((pos>1)&&(!direction)))
    	{   
         putchar('-') ;
    	 if(direction)
    		 pos++ ;
    	 else 
    		 pos--;
    	}    
    	else
    	{
          limit++ ;   
          if(direction)
    		pos=limit;
    	  else
    	    pos=1 ;
    	    direction=!direction ;
    	 
    		putchar('\n') ;
    	}
    	if(limit < maxlimit)
    		bufret(pos,limit,maxlimit,direction) ;
    
    }
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    	 bufret(1, 1, MVALUE+1, true) ;
    	 getchar() ;
    	return 0;
    }

    Решил наговнокодить по мотивам этой статьи:
    http://habrahabr.ru/post/116842/

    Как думаете, получилось,

    ASDASD, 14 Мая 2014

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

    +151

    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
    <?
    						$arPrimary = array();
    						if(!empty($item['IB_ELEMENT']['PROPERTIES']['MANUFACTURER']['VALUE'])){
    							$arPrimary['ПРОИЗВОДИТЕЛЬ'] = $item['IB_ELEMENT']['PROPERTIES']['MANUFACTURER']['VALUE'];
    						}
    						if(!empty($item['IB_ELEMENT']['PROPERTIES']['MATERIAL']['VALUE'])){
    							$arPrimary['ПРОИЗВОДИТЕЛЬ'] = $item['IB_ELEMENT']['PROPERTIES']['MATERIAL']['VALUE'];
    						}
    						
    						if(!empty($arPrimary)):
    							$c = count($arPrimary); $i = 1;
    						?>
    							<ul class="primary">
    								<?foreach($arPrimary as $k => $v):
    									$last = false;
    									if($i == $c){
    										$last = true;
    									}
    								?>
    									<li<?if($last):?> class="last"<?endif;?>>
    										<span class="label"><?=$k?>:</span>
    										<?=$v?>
    									</li>
    								<?
    								$i++;
    								endforeach;?>
    							</ul>
    						<?endif;?>

    Bitrix же!

    TBoolean, 13 Мая 2014

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

    +63

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    template <typename T>
    void function_name(T &&data)
    {
        static_assert(std::is_rvalue_reference<decltype(data)>::value, "data must be rvalue");
        // ...
    }

    Все лишнее убрано

    Setry, 30 Апреля 2014

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

    +77

    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
    #define SK_SIMPLE_SIZE SK_BIG : case SK_SMALL : case SK_MIDDLE
    
    switch (some_shit)
    {
      case SK_TINY : 
      {
        do_smth();
      }
      break;
      case SK_SIMPLE_SIZE :
      {
        do_smth2();
      }
      break;
    }

    странно что вроде бы тут не было

    TarasB, 17 Апреля 2014

    Комментарии (14)
  11. PHP / Говнокод #15754

    +153

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    <?php if(isset($the_cat_id)): ?>
        <?php
            $query_args['showposts'] = $brp_count_category;
            $query_args['cat'] = $the_cat_id;
        ?>
    <?php else: ?>
        <?php
            $query_args['showposts'] = $brp_count_index;
        ?>
    <?php endif; ?>

    { }? Нет, не слышали...

    russling, 14 Апреля 2014

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