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

    +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
    16. 16
    17. 17
    //выведет таблицу для отладки
    function ExecSQL_SelectTable($sql)
    {
    	if($data = ExecSQL_Select($sql)->fetchAll(PDO::FETCH_ASSOC)){
    		print '<table border=2>';
    		print '<tr>';
    		foreach(array_keys($data[0]) AS $v) print '<td>'.$v.'</td>';
    		print '</tr>';
    		foreach($data AS $row){
    			print '<tr>';
    			foreach($row AS $v) print '<td>'.$v.'</td>';
    			print '</tr>';
    		}
    		print '</table>';
    	}
    	die;
    }

    Что только люди не предумают чтобы не юзать нормальный debug и не отлаживать код нормально.

    smpl, 08 Апреля 2014

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

    +142

    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
    List<EntryChange> changes = new List<EntryChange>();
    
    for (int index = 0;
                index < partsContainer.transform.childCount;
                        ++index)
    {
    
        if (partsContainer
                    .transform
                        .GetChild(index)
                                .GetComponent<castle_parts_container>()
                                    .inSave()
                        ==
                        true)
        {
    
            // id of current part on scene
            int partId =
                    partsContainer.transform
                        .GetChild(index).gameObject
                                .GetComponent<castle_parts_container>()
                                                        .partIdentificator;
    
            int partColor =
                    partsContainer.transform
                        .GetChild(index).gameObject
                                .GetComponent<castle_parts_container>()
                                                            .savedColor();
            int partNumber =
                    partsContainer.transform
                        .GetChild(index).gameObject
                                .GetComponent<castle_parts_container>()
                                                            .savedNumber();
    
            EntryChange change = new EntryChange();
    
            change.original =
                    partsContainer.transform
                                    .GetChild(index).gameObject;
            change.target =
                    partPrefabs.Where(
                        x => x.GetComponent<castle_parts_container>().partIdentificator
                                ==
                                partId
                                    &&
                                x.GetComponent<castle_parts_container>().partColor
                                    ==
                                    partColor
                                        &&
                                    x.GetComponent<castle_parts_container>().partNumber
                                        ==
                                        partNumber
                    ).First();
    
            changes.Add(change);

    Избыточный код с форматированием в стиле Маяковского

    arazect, 08 Апреля 2014

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

    +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
    <?php
    	$month = date("m", strtotime($model->order->created));
    	
    	if($month==01){
    		$month = "января";
    	}elseif($month==02){
    		$month = "февраля";
    	}elseif($month==03){
    		$month = "марта";
    	}elseif($month==04){
    		$month = "апреля";
    	}elseif($month==05){
    		$month = "мая";
    	}elseif($month==06){
    		$month = "июня";
    	}elseif($month==07){
    		$month = "июля";
    	}elseif($month==08){
    		$month = "августа";
    	}elseif($month==09){
    		$month = "сентября";
    	}elseif($month==10){
    		$month = "октября";
    	}elseif($month==11){
    		$month = "ноября";
    	}elseif($month==12){
    		$month = "декабря";
    	}
    ?>

    Это facepalm!

    jonasas, 08 Апреля 2014

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

    +138

    1. 1
    http://www.microsoft.com/ru-ru/smb/campaigns/get-modern/default.aspx

    Таймер идёт назад.
    Да они поехали!

    laMer007, 08 Апреля 2014

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

    +9

    1. 1
    #define  FindElem( L )   _FindElem( [=] (VEC4 iter) -> bool  {  return (L);  } )

    На что только не пойдут люди, чтобы писать

    VEC4* pv = vecs.FindElem( iter.x==1.0f );

    laMer007, 07 Апреля 2014

    Комментарии (16)
  6. SQL / Говнокод #15698

    −123

    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
    ALTER TRIGGER [dbo].[ObjectTrade]
    ON [dbo].[packets] 
    AFTER INSERT
    AS 
    BEGIN
    SET NOCOUNT ON;
    
    DECLARE
    @id_key int,
    @id_th int,
    @date_end datetime,
    @date_beg datetime
    
    SET @id_key = (SELECT id_key FROM inserted)
    SET @id_th = (SELECT id_th FROM inserted WHERE id_key = @id_key)
    SET @date_end = (SELECT date_end FROM inserted WHERE id_key = @id_key)
    SET @date_beg = (SELECT date_beg FROM inserted WHERE id_key = @id_key)
    
    IF @id_th = 183 
    UPDATE packets 
    SET packets.date_end = CAST('12-05-2014' AS DATE) 
    WHERE id_key =@id_key
    
    IF (CAST(@date_end AS DATE) BETWEEN '08-03-2014' and '10-03-2014') SET @date_end = '07-03-2014'
    IF (CAST(@date_end AS DATE) BETWEEN '01-05-2014' and '04-05-2014') SET @date_end = '30-04-2014'
    IF (CAST(@date_end AS DATE) BETWEEN '09-05-2014' and '11-05-2014') SET @date_end = '08-05-2014'
    IF (CAST(@date_end AS DATE) BETWEEN '12-06-2014' and '15-06-2014') SET @date_end = '11-06-2014'
    IF (CAST(@date_end AS DATE) BETWEEN '02-11-2014' and '04-11-2014') SET @date_end = '01-11-2014'
    IF (CAST(@date_end AS DATE) BETWEEN '01-01-2015' and '08-01-2015') SET @date_end = '31-12-2014'
    IF DATEPART(WEEKDAY, @date_end) = 7 SET @date_end = DATEADD(DAY, -1, @date_end)
    UPDATE packets SET packets.date_end = @date_end WHERE id_key =@id_key
    
    END

    kerberos, 07 Апреля 2014

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

    +31

    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
    if(!$_SESSION["subscribe_user"]){
    
    		   $arr_subscribes = unserialize('a:94:{i:212;s:3:"212";i:228;s:3:"228";i:302;s:3:"302";i:304;s:3:"304";i:322;s:3:"322";i:354;s:3:"354";i:366;s:3:"366";i:382;s:3:"382";i:402;s:3:"402";i:406;s:3:"406";i:458;s:3:"458";i:484;s:3:"484";i:492;s:3:"492";i:548;s:3:"548";i:564;s:3:"564";i:572;s:3:"572";i:622;s:3:"622";i:646;s:3:"646";i:700;s:3:"700";i:706;s:3:"706";i:714;s:3:"714";i:716;s:3:"716";i:718;s:3:"718";i:730;s:3:"730";i:740;s:3:"740";i:746;s:3:"746";i:766;s:3:"766";i:770;s:3:"770";i:816;s:3:"816";i:826;s:3:"826";i:832;s:3:"832";i:834;s:3:"834";i:852;s:3:"852";i:884;s:3:"884";i:894;s:3:"894";i:914;s:3:"914";i:920;s:3:"920";i:982;s:3:"982";i:988;s:3:"988";i:1010;s:4:"1010";i:1194;s:4:"1194";i:1456;s:4:"1456";i:1528;s:4:"1528";i:1598;s:4:"1598";i:1644;s:4:"1644";i:1828;s:4:"1828";i:1938;s:4:"1938";i:1942;s:4:"1942";i:1990;s:4:"1990";i:2130;s:4:"2130";i:2154;s:4:"2154";i:2250;s:4:"2250";i:2272;s:4:"2272";i:2338;s:4:"2338";i:2714;s:4:"2714";i:2798;s:4:"2798";i:2892;s:4:"2892";i:3018;s:4:"3018";i:3178;s:4:"3178";i:3181;s:4:"3181";i:3182;s:4:"3182";i:43;s:2:"43";i:23;s:2:"23";i:25;s:2:"25";i:26;s:2:"26";i:27;s:2:"27";i:28;s:2:"28";i:2;s:1:"2";i:67;s:2:"67";i:74;s:2:"74";i:70;s:2:"70";i:72;s:2:"72";i:13;s:2:"13";i:14;s:2:"14";i:15;s:2:"15";i:16;s:2:"16";i:17;s:2:"17";i:18;s:2:"18";i:19;s:2:"19";i:20;s:2:"20";i:21;s:2:"21";i:22;s:2:"22";i:52;s:2:"52";i:66;s:2:"66";i:68;s:2:"68";i:36;s:2:"36";i:37;s:2:"37";i:38;s:2:"38";i:39;s:2:"39";i:40;s:2:"40";i:41;s:2:"41";i:42;s:2:"42";i:76;s:2:"76";i:78;s:2:"78";}');
    
    			$subscr=new subscribe_new();
    			$subscr->GetUserSubscr();
    
    			if(!count($subscr->user_subscribes)){
    				$subscr->user2subscr_table = 'utos';
    				$sql="select subscribe.* from subscribe LEFT JOIN enterprises ON enterprises.id=subscribe.enterprise where subscribe.visible='Y' AND (subscribe.enterprise = 0 OR enterprises.visible = 'Y') order by priority desc, week_day,id";
    				$res=@mysql_db_query($DB,$sql);
    				$all_subscribe=array();
    				while ($row=@mysql_fetch_assoc($res)):
    					$subscr->all_subscribes[$row["id"]]=$row;
    
    				endwhile;
    				
    				$q = $subscr->UpdateSubscr($arr_subscribes);
    				#print_r($arr_subscribes);
    				
    				#exit;
    			}
    
    	   }

    ну хрясь чтоле

    brainstorm, 07 Апреля 2014

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

    −136

    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
    /**
     *  @private
     *  Calculates the height needed for heightInLines lines using the default
     *  font.
     */
    private function calculateHeightInLines():Number
    {
        var height:Number = getStyle("paddingTop") + getStyle("paddingBottom");
        
        if (_heightInLines == 0)
            return height;
        
        var effectiveHeightInLines:int;
        
        // If both height and width are NaN use 10 lines.  Otherwise if 
        // only height is NaN, use 1.
        if (isNaN(_heightInLines))
            effectiveHeightInLines = isNaN(_widthInChars) ? 10 : 1;   
        else
            effectiveHeightInLines = _heightInLines;
        
        // Position of the baseline of first line in the container.
        value = getStyle("firstBaselineOffset");
        if (value == lineHeight)
            height += lineHeight;
        else if (value is Number)
            height += Number(value);
        else
            height += ascent;
        
        // Distance from baseline to baseline.  Can be +/- number or 
        // or +/- percent (in form "120%") or "undefined".  
        if (effectiveHeightInLines > 1)
        {
            var value:Object = getStyle("lineHeight");     
            var lineHeight:Number =
                RichEditableText.getNumberOrPercentOf(value, getStyle("fontSize"));
            
            // Default is 120%
            if (isNaN(lineHeight))
                lineHeight = getStyle("fontSize") * 1.2;
            
            height += (effectiveHeightInLines - 1) * lineHeight;
        }            
        
        // Add in descent of last line.
        height += descent;              
        
        return height;
    }

    Внимательно следим за жизненным циклом переменной lineHeight.

    wvxvw, 07 Апреля 2014

    Комментарии (17)
  9. PHP / Говнокод #15690

    +155

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    $title = str_replace("1", "", $title);
    	$title = str_replace("2", "", $title);
    	$title = str_replace("3", "", $title);
    	$title = str_replace("4", "", $title);
    	$title = str_replace("5", "", $title);
    	$title = str_replace("6", "", $title);
    	$title = str_replace("7", "", $title);
    	$title = str_replace("8", "", $title);
    	$title = str_replace("9", "", $title);
    	$title = str_replace("0", "", $title);
    	echo $title;

    Убираем цифры из строки!

    mrmany, 06 Апреля 2014

    Комментарии (139)
  10. PHP / Говнокод #15686

    +143

    1. 1
    2. 2
    3. 3
    О... О... О, нет... О... Я чувствую, как "blandermein" жарко облизывает мои потные яйца своим шаловливым язычком... О, да...
    О... А потом он захватывает своим жадно зовущим ротиком мой раскалённый пенис, и начинает телебонить его головку,
    забирая по самые гланды... О... Да, давай ещё... О... Ах...

    Konardillo, 06 Апреля 2014

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