Mistři v programování na #hovnokod

def validate(timeinstr):
    if timeinstr:
        timeinstr = timeinstr.split(':')
        if len(timeinstr) != 2:
            return 0, 0
        hour = int(timeinstr[0])
        minute = int(timeinstr[1])
        if (hour < 0) or (hour > 23):
            return 0, 0
        if (minute < 0) or (minute > 59):
            return 0, 0
        return hour, minute
    return 0, 0

Anonymous,


Anonymous,

Pochopili jste to někdo? A to ani neříkám, že se jedná o dokumentaci k SDK ...

  private static final String AUTH_TOKEN = "your developer token";

// později v kódu

    String token = System.getenv("AUTH_TOKEN");
    if (token == null) {
      token = AUTH_TOKEN;
    }
    if ("your developer token".equals(token)) {
      System.err.println("Please fill in your developer token");
      return;
    }


Martin Jašek,

Java 9: Learn functional programming they said, see the world they said...

public static <T,U,A,R> Collector<T,?,R> flatMapping​(Function<? super T,? extends Stream<? extends U>> mapper,
                                                     Collector<? super U,A,R> downstream)

 Map<String, Set<LineItem>> itemsByCustomerName
   = orders.stream().collect(
     groupingBy(Order::getCustomerName,
                flatMapping(order -> order.getLineItems().stream(),
                            toSet())));

Anonymous,

bazén? bazén. bazén!

bool hasPool = hotelInfo.BoxCheck.Any(i => i.DataName.ToLower().Contains("bazén"));
info.AppendFormat("<span>Bazén: <b>{0}</b></span>", hasPool ? "ANO" : "NE");

Anonymous,