Skip to content

Instantly share code, notes, and snippets.

// Based on https://developer.okta.com/blog/2019/05/23/java-microservices-spring-cloud-config
application {
config {
baseName gateway,
packageName com.okta.developer.gateway,
applicationType gateway,
authenticationType jwt,
prodDatabaseType postgresql,
serviceDiscoveryType eureka,
@leonardortlima
leonardortlima / mercosul_brasil_plate_regex.md
Last active May 15, 2023 12:57
Regex for Mercosul plate - brazilian version

(?=(?:.*[0-9]){3})(?=(?:.*[A-Z]){4})([A-Z0-9]){6}([0-9])

The plate must have:

  • Four letters
  • Three numbers
  • Characters don't have a fixed position, except for the last one, that must be a number.

Adapted from https://stackoverflow.com/a/29834536

@leonardortlima
leonardortlima / .gitconfig
Created October 25, 2017 13:20
Adds the "apply-gitignore" command to git, which remove entries that are in .gitignore but are still tracked.
# Appended to ~/.gitconfig file
# https://stackoverflow.com/a/7532131
[alias]
apply-gitignore = !git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached
private static boolean hasNetwork(Context context) {
ConnectivityManager connectivityManager = (ConnectivityManager)
context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null;
}
public static boolean canAccessInternet(Context context) {
if (hasNetwork(context)) {
try {