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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    foreach (array(167, 163) as $low_rise_apartment_id)
    {
            $arParams["SEARCH_DATA"]["articletype"][] = $low_rise_apartment_id;
    }
                
    $arParams["SEARCH_DATA"]["articletype"] = array_unique($arParams["SEARCH_DATA"]["articletype"]);

    solnatus, 22 Октября 2014

    Комментарии (1)
  2. Java / Говнокод #16909

    +86

    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
    public PriceComparator {
    
       private PriceComparator INSTANCE;
    
        public PriceComparator() {
            INSTANCE = this;
        }
    
        public PriceComparator getInstance() {
            return INSTANCE;
        }
    
    ...
    }

    Singleton fail...

    StanDalone, 22 Октября 2014

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

    +43

    1. 1
    2. 2
    3. 3
    for each (ToolStripMenuItem ^item in пользователиToolStripMenuItem->DropDownItems) {
    	item->Enabled = true;
    }

    Это C++, и это работает!

    hdkeeper, 22 Октября 2014

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

    −399

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    id  obj =  [[FHSTwitterEngine sharedEngine] getHomeTimelineSinceID:nil count:100];
    
          if ( ![[[obj class] description] isEqualToString:@"NSError"] &&
              ![[[obj class] description] isEqualToString:@"NSURLError"])
     {
         if ([_categoriesDelegate respondsToSelector:@selector(didGetPostFromMyTW: forFeed:)])
             [_categoriesDelegate didGetPostFromMyTW:obj forFeed:@{@"id":feedId}];
     }
          else
              [SVProgressHUD dismiss];

    оригинальное форматирование сохранено

    heyyou, 22 Октября 2014

    Комментарии (2)
  5. JavaScript / Говнокод #16906

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    var component_prop = {};
    // create property array
    for (var i = 0; i < object_data.properties.length; i++) {
        component_prop[object_data.properties[i].name] = object_data.properties[i].value;
    }
    // convert property arrays to JSON object for parameters on component create
    component_prop = JSON.parse(JSON.stringify(component_prop));

    может кто-то понимает этот танец?

    kissarat, 22 Октября 2014

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

    −863

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    select top 1 v.Id
       from dbo.Verification v
       where v.ApplicationId = a.Id
        and v.ResultId = 'D69E0B3A-C5CA-42D0-A8CA-FA7FF63BC414'
        and not exists (
         select 1 from Verification vo
         where vo.ApplicationId = v.ApplicationId
          and vo.ResultId = v.ResultId
          and vo.Id != v.Id
          and vo.Position > v.Position
        )

    MS SQL. Видимо, автору не рассказали об order by

    alex123098, 21 Октября 2014

    Комментарии (39)
  7. C# / Говнокод #16902

    +132

    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
    IEnumerator CalcTimeToEnd()
    		{
    			while (Work.TimeToEnd > 0)
    			{
    				Work.TimeToEnd -= 1;
    				Text timerText = questTimerBg.gameObject.transform.FindChild("Text").GetComponent<Text>();
    				
    				int iHours = 0;
    				int iMunuts = 0;
    				int iSeconds = Quest.TimeToEnd;
    				if (iSeconds > 60)
    				{
    					iMunuts = iSeconds / 60;
    					iSeconds = iSeconds % 60;
    				}
    				if (iMunuts > 60)
    				{
    					iHours = iMunuts / 60;
    					iMunuts = iMunuts % 60;
    				}
    				string strTime = "";
    				if (iHours > 0)
    					strTime = iHours.ToString() + ":";
    				if (iMunuts < 10)
    					strTime += "0"; 
    				strTime += iMunuts.ToString() + ":";
    				if (iSeconds < 10)
    					strTime += "0";
    				strTime += iSeconds.ToString();
    				timerText.text = strTime;
    				yield return new WaitForSeconds(1f);
    			}
    			Work.SetState(EQuestState.eQS_ABORT);
    		}

    перевод времени в текст, на индусском

    govnim, 21 Октября 2014

    Комментарии (11)
  8. JavaScript / Говнокод #16898

    +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
    <FORM name="searchForm">
    
    .....
    <input onclick="customSubmitSearchForm()" type="button" value="Търси">
    ......
    </form>
    
    <script language="javascript">
    	function customSubmitSearchForm()
    	{
      	// may add additional checks here
      	alert('Няма данни по избраните критерии');
    	}
    </script>

    Bulgarian National Bank - http://www.bnb.bg/AboutUs/AUAdvancedSearch/index.htm

    CappY, 20 Октября 2014

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

    +154

    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
    <?php if( !empty($documents[4]) ):?>
                    <hr>
                    <h3>Выполняемые работы</h3>
                    <table class="b-transparent-table">
    
                        <?php foreach ($documents[4] as  $file_name => $text): ?>
    
                            <tr>
                                <td class ="td_big">
                                    <h6><?= $text;?></h6>
                                </td>
                                <td>
                                    <a href="<?= $dir.$passport['reforma_id'].DIRECTORY_SEPARATOR."4".DIRECTORY_SEPARATOR.$file_name;?>">скачать</a>
                                </td>
                            </tr>
    
                        <?php endforeach; ?>
                    </table>
                <?php endif;?>

    магический документ 4. В файле откуда взят код есть также документ 5.

    memclutter, 20 Октября 2014

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

    +153

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    /*рыба*/
                $render['variables']['winter_complite'] = array(
                    'Жилищный фонд'             =>100
                ,'Котельные'                =>100
                ,'Тепловые сети'            =>100
                ,'Водопроводные сети'       =>100
                ,'Канализационные сети'     =>100
                ,'Создание запасов топлива' =>100
                );

    reformat me!

    memclutter, 19 Октября 2014

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