//count to 10
#include <iostream>
#include <string>

int main()
{
  int i = 0;
  
  beginning:
  if (i < 10) {
      std::cout << ++i << std::endl;
      goto beginning;
  }
  else goto end;

  end:
  return 0;
}
By Yoges, 2017-12-19 14:43:26
    if (SelectionAndTimeData[1] < 2000 or \
        SelectionAndTimeData[2] < 1 or SelectionAndTimeData[2] > 12 or \
        SelectionAndTimeData[3] < 1 or SelectionAndTimeData[3] > 31 or \
        SelectionAndTimeData[4] < 0 or SelectionAndTimeData[4] > 24 or \
        SelectionAndTimeData[5] < 0 or SelectionAndTimeData[5] > 60 or \
        SelectionAndTimeData[2] < 0 or SelectionAndTimeData[2] >60):   
        
        print('***************************************************************************')
        print(' Entered date is not valid')
        print('****************************************************************************')
By loopyroberts, 2017-12-12 22:55:56
@Override
public void afterTextChanged(Editable s) {
    switch (paymentType) {
        case 0:
            if (s.length() == 9) etPaymentAmount.requestFocus();
            break;
        case 1:
            if (s.length() == 9) etPaymentAmount.requestFocus();
            break;
    }
}
By Anonymous, 2017-12-22 12:41:02
public void Method1(Enum foo)
{
    if (GetCondition1(foo))
    {
        doSomething();
    }
}

private bool GetCondition1(Enum foo)
{
    if (foo == Enum.Value1)
        return true;

    return false;
}
By Anonymous, 2018-02-23 17:34:55
#274 PHP +55
foreach ($k as $kk) {
    foreach ($kk as $kkk) {
    }
}
By Anonymous, 2018-04-05 14:50:22
try {
	$order->addItem($item);
} catch (Exception $ex) {
	throw $ex;
}
By baueri, 2019-04-10 16:49:46
protected void EnableEditButtons(bool Value)
{
    if (Value == false)
    {
        buttonAdd.Disabled = true;
        buttonDelete.Disabled = true;
    }
    else
    {
        buttonAdd.Disabled = false;
        buttonDelete.Disabled = false;
    }
}

// ...

if (IsEditable(ID))
    EnableEditButtons(true);
else
    EnableEditButtons(false);

I found this old code in an app I was updating for a client a number of years back. It was so good I documented it on my own blog.

By Jon Hartmann, 2017-12-12 17:09:54
<Window WindowStyle="None" MouseLeftButtonDown="WindowMouseLeftButtonDown"/>
    <x:Code>
        <![CDATA[            
            private void WindowMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
            {
                DragMove();
            }
        ]]>
    </x:Code>
</Window>

http://stackoverflow.com/a/19136910 The code highlighter should be for XAML/XML, but there's no such highlighting option, so I used HTML.

By OverCR, 2015-08-22 16:55:07
@media only screen and (-webkit-min-device-pixel-ratio:2) and (max-width:768px) and (min-width:321px),not all,only screen and (max-width:768px) and (-webkit-min-device-pixel-ratio:2) and (min-width:321px),only screen and (max-width:768px) and (min-resolution:192dpi) and (min-width:321px),only screen and (max-width:768px) and (min-resolution:2dppx) and (min-width:321px){
    /*some code here*/
}
By Anonymous, 2019-09-12 23:05:36
for(var j=0;j<10;j++){
    cell=document.createElement('td');
    switch(j)
    {
        case 0: 
            var date1 = events[i]['start'];
            var date2 = events[i]['end'];
            cell.appendChild(document.createTextNode(date1.getFullYear()+'/'+date1.getMonth()+'/'+date1.getDate()+' '+date1.getHours()+':'+date1.getMinutes()+' To '+date2.getFullYear()+'/'+date2.getMonth()+'/'+date2.getDate()+' '+date2.getHours()+':'+date2.getMinutes())); 
            break;
        case 1: cell.appendChild(document.createTextNode(events[i]['title'])); break;
        case 2: cell.appendChild(document.createTextNode(events[i]['description'])); break;
    }
    row.appendChild(cell);
}

The for loop that counts to 10, but the last seven elements are completely useless.

By Anonymous, 2017-12-13 07:16:36
public enum YesNoEnum
{
	Yes = 0,
	No = 1
}

I also like how they defined the enum values.

By Anonymous, 2018-05-19 19:33:44
public boolean logout(String token)
{
    LogedUser user = logedUsers.remove(token);
    return (user != null) ? true : false;
}
By Slacki, 2015-11-17 17:58:53
    UIButton * btn = [UIButton new];
    [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    
    //May god have mercy of me
    [[btn titleLabel] setFont:[UIFont systemFontOfSize:14 weight:UIFontWeightMedium]];
    [btn setTitle:[NSString stringWithFormat:@"  %@  ", btnTxt] forState:UIControlStateNormal];
    [btn sizeToFit];
    [btn setTitle:btnTxt forState:UIControlStateNormal];

Why keep playing with label padding or insets when you can add spaces?

By Shy developer, 2017-12-12 14:32:37
        var validAccountData = account.email != nil
        validAccountData = account.firstName != nil
        validAccountData = account.lastName != nil
        
        if validAccountData {
            return account
        }
        
        return nil

Proper validation

By Anonymous, 2017-12-12 15:17:35
if( %rightBtnCmd $= "noButtons" )
{
    //do nothing, as there are no buttons   
}

proprietary script language.

By Anonymous, 2017-12-14 19:52:22