Skip to content

Instantly share code, notes, and snippets.

View juanpabloprado's full-sized avatar
🛖
Working From Hut

Juan Pablo Prado juanpabloprado

🛖
Working From Hut
View GitHub Profile
package com.electricobjects.client.onboarding;
import android.app.Dialog;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.content.ContextCompat;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

#Installing TeamCity for building Android projects

##Requirements

  • MySQL
  • JDK 1.7
  • 32-bit libstdc++ zlib.i686

##Install JDK

@antoniolg
antoniolg / SwipeRefreshActivity.java
Last active July 29, 2019 11:59
An activity that uses a SwipeRefreshLayout as a container for the layout of the classes that extend it.
/*
* Copyright (C) 2014 Antonio Leiva Gordillo.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@thomasdarimont
thomasdarimont / application.yml
Last active November 14, 2019 17:40
Hello OAuth Groovy example (Keycloak + Spring Security OAuth)
security:
oauth2:
client:
# clientId in keycloak
clientId: demo
# clientSecret in keycloak
clientSecret: xxxx
# From Authorization Server's metadata
# Keycloak realm is spring-security-sso
accessTokenUri: http://localhost:8081/auth/realms/spring-security-sso/protocol/openid-connect/token
@jonikarppinen
jonikarppinen / Messages.java
Last active February 23, 2021 23:36
Example of using message resources in Spring Boot service layer code, in as simple way as possible (hopefully!). NOTE: this approach supports only a single locale, not dynamically changing it.
package com.company.project.components;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.support.MessageSourceAccessor;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.Locale;
@christherama
christherama / Gif.java
Last active May 17, 2021 07:55
These files demonstrate how to implement a custom Spring validator for a Gif entity that includes as a mapped property a Category entity.
/*
Notice the @Transient annotation on the MultipartFile field.
This means that the field value will NOT be persisted to the database.
*/
package com.teamtreehouse.giflib.model;
import org.springframework.web.multipart.MultipartFile;
import javax.persistence.*;
@odrotbohm
odrotbohm / StoreRepository.java
Last active October 22, 2021 09:08
Dynamic, Querydsl-based filter bindings using Spring Data REST
public interface StoreRepository extends PagingAndSortingRepository<Store, String>,
QueryDslPredicateExecutor<Store>, QuerydslBinderCustomizer<QStore> {
@RestResource(rel = "by-location")
Page<Store> findByAddressLocationNear(Point location, Distance distance, Pageable pageable);
default void customize(QuerydslBindings bindings, QStore store) {
bindings.bind(store.address.city).single((path, value) -> path.startsWith(value));
bindings.bind(String.class).single((StringPath path, String value) -> path.contains(value));
}
#!/bin/bash
set -e
JAVA_HOME=${1-text}
[ $# -eq 0 ] && { echo "Usage: sudo $0 \$(/usr/libexec/java_home -v '1.8*')" ; exit 1; }
KEYSTORE=$JAVA_HOME/jre/lib/security/cacerts
wget https://letsencrypt.org/certs/letsencryptauthorityx1.der
wget https://letsencrypt.org/certs/letsencryptauthorityx2.der
@LuisEnMarroquin
LuisEnMarroquin / .bash_profile
Last active September 15, 2022 21:50
My bash aliases and functions
#!/bin/bash
CL_NULL='\e[0m'
CL_FAIL='\e[0;31m'
CL_NICE='\e[0;32m'
CL_WARN='\e[0;33m'
CL_BLUE='\e[0;34m'
CL_PURP='\e[0;35m'
CL_CYAN='\e[0;36m'
@thomasdarimont
thomasdarimont / App.java
Created November 6, 2018 19:09
Simple Spring Boot App protected by Keycloak with initial roles from Keycloak and additional hierarchical app Internal roles. Supports fine grained permission checks, where the permissions are derived from roles.
package demo;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;