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

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

    +172

    1. 1
    2. 2
    if ( is_int(intval($_GET['y'])) ) {
      //...

    Lowezar, 22 Февраля 2012

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

    +168

    1. 1
    2. 2
    3. 3
    $isHttp = $_tumbpath[0] == 'h' && $_tumbpath[1] == 't' && $_tumbpath[2] == 't' && $_tumbpath[3] == 'p';
    
    if ($isHttp){...}

    хорошо еще, что слово - http :)

    unVooDoo, 22 Февраля 2012

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

    +160

    1. 1
    2. 2
    $v2 = str_replace('\"', '"', $v2);
    $v2 = str_replace("\'", "'", $v2);

    no comments

    englandpost, 22 Февраля 2012

    Комментарии (4)
  5. Python / Говнокод #9502

    −178

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    cursor.execute(bla)
    count = cursor.fetchone()
    
    if count[0] > 0 or True:
        cursor.execute(bla)

    ragzovkii, 21 Февраля 2012

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

    +158

    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
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    function get($sel, $od='', $show_error=1)
    {
      global $__DB_CONN;
      $select=$sel;
      //echo $select.'<br>';
      if($od=="")
      {
        $res=sql_execute($select, $show_error);
        if(!$res)
          return array();
        $mc_runtime=get_magic_quotes_runtime();
        set_magic_quotes_runtime(0);
        $mas=array();
        while($v=@mysql_fetch_assoc($res))
          array_push($mas, $v);
        set_magic_quotes_runtime($mc_runtime);
        return $mas;
      }
    ... //тоже самое еще пару раз
      if($od=="by id")
      {
        $res=sql_execute($select, $show_error);
        if(!$res)
          return array();
        $mc_runtime=get_magic_quotes_runtime();
        set_magic_quotes_runtime(0);
        $mas=array();
        while($v=mysql_fetch_assoc($res))
          $mas[$v["id"]]=$v;
        set_magic_quotes_runtime($mc_runtime);
        return $mas;
      }
      if($od=="ins")
      {
        $res=sql_execute($select, $show_error);
        return mysql_insert_id($__DB_CONN);
      }
      return;
    }
    
    function get2($sel, $od='', $show_error=1)
    {
      global $__DB_CONN2;
      $select=$sel;
      //echo $select.'<br>';
      if($od=="")
      {
        $res=sql_execute2($select, $show_error);
        if(!$res)
          return array();
        $mc_runtime=get_magic_quotes_runtime();
        set_magic_quotes_runtime(0);
        $mas=array();
        while($v=@mysql_fetch_assoc($res)) {
    	foreach($v as $ii=>$vv)
            $v[$ii] = iconv('windows-1251','utf-8' ,$vv);
       array_push($mas,$v);
      }
        set_magic_quotes_runtime($mc_runtime);
        return $mas;
      }
    ... //тоже самое еще пару раз
      if($od=="ins")
      {
        $res=sql_execute2($select, $show_error);
        return mysql_insert_id($__DB_CONN2);
      }
      return;
    }

    Функции для работы с бд!

    uint, 19 Февраля 2012

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

    −118

    1. 1
    my $res_id = $q->param('ordernumber')?$q->param('ordernumber'):$q->param('order_idp')?$q->param('order_idp'):undef

    santa_microbe, 16 Февраля 2012

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

    +148

    1. 1
    2. 2
    3. 3
    4. 4
    /**
    	 * Assign
    	 **/
        function Assign ($mTplArray, $mTrailer = "")

    Зачем этот комментарий, над каждым методов вообще?!
    Будто я не вижу как называется метод класса.

    Zerstoren, 15 Февраля 2012

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

    +115

    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
    try
    {
    	foreach (MapObjectBase item in objects)
    	{
    		GisTrack track = item as GisTrack;
    
    		if (track != null)
    		{
    			//ToolTipContent - наследник TextContent
    			ToolTipContent oToolTip = (ToolTipContent)track.ContentList.FirstOrDefault<IContent>(a => a is TextContent);
    			if (oToolTip != null)
    			{
    				track.ContentList.Remove(oToolTip);
    			}
    		}
    	}
    
    	this.map.Redraw(false);
    }
    catch (Exception ex)
    {
    	MonitoringManager.Instance.WriteLog(ex.ToString());
    }

    Linq - как граната. Смотря в чьих руках.

    ICELedyanoj, 14 Февраля 2012

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

    +120

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    public class BillingService : Handles<NewDayHasComeInMoscow>
    {
            public void When(NewDayHasComeInMoscow ev)
            {
                // ...
            }
    }

    pavelhritonenko, 14 Февраля 2012

    Комментарии (4)
  11. Си / Говнокод #9364

    +104

    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
    #ifdef _DEBUG
                if ( !
    #endif
                    dt_time_sprintf_current( tbuf, sizeof(tbuf), false )
    #ifdef _RELEASE
                    ;
    #else
                    )
                {
                    fprintf( stderr, "-- unable to get current time\n" );
                }
    #endif
            }
    #ifdef _DEBUG

    ;(

    ilardm, 09 Февраля 2012

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