Console.WriteLine("|"+ Espace(x-1) + (h==3?" o":""));
Console.WriteLine("|"+ Espace(x-1) + (h==2?" o":(h==3?"/|\\":"")));
Console.WriteLine("|"+ Espace(x-1) + (h==1?" o":(h==2?"/|\\":(h==3?" |":""))));
Console.WriteLine("|"+ Espace(x-1) + (h==0?" o":(h==1?"/|\\":(h==2?" |":(h==3?"/ \\":"")))));
Console.WriteLine("|"+ Espace(x-1) + (h==0?"/|\\":(h==1?" |":(h==2?"/ \\":""))));
Console.WriteLine("|"+ Espace(x-1) + (h==0?" |":(h==1?"/ \\":"")));
Console.WriteLine("|"+ Espace(x-1) + (h==0?"/ \\" : ""));
By Caribou décoiffé, 2018-04-29 20:27:53
if((substr($onefile, -4) == ".Mp3") OR 
    (substr($onefile, -4) == ".ogg") OR 
    (substr($onefile, -4) == ".OGG") OR 
    (substr($onefile, -4) == ".oGG") OR 
    (substr($onefile, -4) == ".OGg") OR 
    (substr($onefile, -4) == ".Ogg") OR 
    (substr($onefile, -4) == ".OgG") OR 
    (substr($onefile, -4) == ".mP3") OR 
    (substr($onefile, -4) == ".MP3") OR 
    (substr($onefile, -4) == ".mp3")){
    
    // do stuff
} 

gotta make sure you account for capitalization

By Kyuunex, 2018-07-02 04:58:09
Double value = item.getPrice() * loyaltyPointMultiplier;
String[] s = String.split(value.toString(), "\\.");
points = Integer.parseInt(s[0]);
if(Integer.parseInt(s[1]) > 0) {
    points++;
}
    
return points;

Want to round up? Math.ceil() uses too little memory! Use this instead!

By phytyca, 2017-12-12 05:02:48
        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
@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
public enum YesNoEnum
{
	Yes = 0,
	No = 1
}

I also like how they defined the enum values.

By Anonymous, 2018-05-19 19:33:44
    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
int t;

if ((t > 1) && (t < 2))
{
    errorString = errorBuffer;
	return -1;
}
By Anonymous, 2017-12-13 19:42:08
if (logger.isDebugEnabled()) {
			logger.debug("process (FollettPojo) - start");	
		}
String dnum = StringUtil.toCapitalizedString(pojo.getDnum().toString()); 
pojo.setDnum(new String(dnum));
	    
if (logger.isDebugEnabled()) {
    logger.debug("process (FollettPojo) - middle ");
}

String rawI = StringUtil.toCapitalizedString(pojo.getRawInput().trim().toString()); 
pojo.setRawInput(new String(rawI));

if (logger.isDebugEnabled()) {
	logger.debug("process (FollettPojo) - end ");
}
		
		
/* And you may ask what is this toCapitalizedString? Well here you go a separate class to boot */
	public static String toCapitalizedString(String string){
		StringBuilder strb = new StringBuilder();
		if(string != null && string.trim().length() > 0
				&& Character.isLetter(string.charAt(0))
				&& Character.isLowerCase(string.charAt(0))){

			strb.append(string.substring(0,1).toUpperCase()).append(string.substring(1));
			return strb.toString();
		}
		return string;

	}

SpringBatch this is the processor for each record...dnum example D00000000

By Albert, 2017-12-15 23:53:41
public boolean logout(String token)
{
    LogedUser user = logedUsers.remove(token);
    return (user != null) ? true : false;
}
By Slacki, 2015-11-17 17:58:53
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
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
try {
	$order->addItem($item);
} catch (Exception $ex) {
	throw $ex;
}
By baueri, 2019-04-10 16:49:46
public static bool HasValues<T>(this ICollection<T> collection)
{
    if (collection == null)
    {
        return false;
    }
    if (collection.Count == 0)
    {
        return false;
    }
    return true;
}
By oskarnrk, 2017-12-12 16:49:43
var query = $("#search-query");
query.click(function() {
  if (query.val() == 'szukaj...') {
     query.val('');
  }
});
By Kadet, 2016-02-14 14:54:32