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?"/ \\" : ""));
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
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!
var validAccountData = account.email != nil
validAccountData = account.firstName != nil
validAccountData = account.lastName != nil
if validAccountData {
return account
}
return nil
Proper validation
@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*/
}
public enum YesNoEnum
{
Yes = 0,
No = 1
}
I also like how they defined the enum values.
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?
int t;
if ((t > 1) && (t < 2))
{
errorString = errorBuffer;
return -1;
}
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
public boolean logout(String token)
{
LogedUser user = logedUsers.remove(token);
return (user != null) ? true : false;
}
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.
public void Method1(Enum foo)
{
if (GetCondition1(foo))
{
doSomething();
}
}
private bool GetCondition1(Enum foo)
{
if (foo == Enum.Value1)
return true;
return false;
}
try {
$order->addItem($item);
} catch (Exception $ex) {
throw $ex;
}
public static bool HasValues<T>(this ICollection<T> collection)
{
if (collection == null)
{
return false;
}
if (collection.Count == 0)
{
return false;
}
return true;
}
var query = $("#search-query");
query.click(function() {
if (query.val() == 'szukaj...') {
query.val('');
}
});