Mistři v programování na #hovnokod

Generovani unikatniho id

public class FFMPEGWorker {

    public static final Set<Integer> activeConversions = new HashSet<>();

    public static int getTaskID() {
        int response = (int)(Math.random() * Math.pow(2,30));
        if (activeConversions.isEmpty()) {
            activeConversions.add(response);
            return response;
        }
        while (activeConversions.contains(response) && response < 100000000 && response >= 1000000000) {
            response = (int)(Math.random() * Math.pow(2,30));
        }
        activeConversions.add(response);
        return response;
    }

}

Anonymous,

Placená verze pluginu do Wordpressu (99 €)

$load_admin = false;
if( is_admin() ) {
    $load_admin = true;
}

Anonymous,


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,