Skip to content

Instantly share code, notes, and snippets.

View sleepiecappy's full-sized avatar

Evangelista sleepiecappy

View GitHub Profile
@sleepiecappy
sleepiecappy / spring-style.xml
Created August 26, 2014 06:12
IntelliJ code style based on Spring Project pattern
<?xml version="1.0" encoding="UTF-8"?>
<code_scheme name="spring-framework">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
@sleepiecappy
sleepiecappy / EnumsUtils.java
Created September 5, 2014 04:28
to get all enum values as a Set
public static Set getAllByClass(Class clazz) {
return new HashSet<>(Arrays.asList(clazz.getEnumConstants()));
}
@sleepiecappy
sleepiecappy / ehcache.xsd
Created September 14, 2014 03:32
ehcache
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="1.7">
<xs:element name="ehcache">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" ref="diskStore"/>
<xs:element maxOccurs="1" minOccurs="0" ref="sizeOfPolicy"/>
<xs:element maxOccurs="1" minOccurs="0" ref="transactionManagerLookup"/>
<xs:element maxOccurs="1" minOccurs="0" ref="cacheManagerEventListenerFactory"/>
@sleepiecappy
sleepiecappy / pom.xml
Last active August 29, 2015 14:06
pom
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>$group$</groupId>
<artifactId>$artifact$</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>$name$</name>
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" version="2.1">
<persistence-unit name="PersistenceDefault">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>br.com.cheetahracing.warehouse.entity.Car</class>
<class>br.com.cheetahracing.warehouse.entity.Tool</class>
<class>br.com.cheetahracing.warehouse.entity.PartAssignment</class>
<class>br.com.cheetahracing.warehouse.entity.Part</class>
<class>br.com.cheetahracing.warehouse.entity.Storage</class>
<!--suppress ALL -->
<configuration scan="true">
<!--
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/mylog.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>logs/mylog.%i.log.zip</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>3</maxIndex>
</rollingPolicy>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>Spring MVC Application</display-name>
<!-- Configure ContextLoaderListener to use AnnotationConfigWebApplicationContext
instead of the default XmlWebApplicationContext -->
<context-param>
<c:set var="firstUrl" value="${pageContext.request.contextPath}/warehouse/parts"/>
<c:set var="lastUrl" value="${pageContext.request.contextPath}/warehouse/parts?page=${totalPages - 1}"/>
<c:set var="prevUrl" value="${pageContext.request.contextPath}/warehouse/parts?page=${currentIndex - 1}"/>
<c:set var="nextUrl" value="${pageContext.request.contextPath}/warehouse/parts?page=${currentIndex + 1}"/>
<div class="pagination">
<ul class="pagination pagination-sm">
<c:choose>
<c:when test="${currentIndex == 1}">
<li class="disabled"><a href="#">&lt;&lt;</a></li>
@sleepiecappy
sleepiecappy / ubuntuGoesUp.sh
Last active October 14, 2024 07:23
Bash script to install everything I need on Ubuntu dists. Development and Desktop usage things
#!/bin/bash
# Update System
# Install prerequisites
echo 'Installing prerequisites...'
sudo apt-get install -y curl
sudo apt-get install -y autoconf
sudo apt-get install -y bison
sudo apt-get install -y build-essential
@sleepiecappy
sleepiecappy / RibbonRestBalanced.java
Created April 5, 2015 21:03
Resquest Interceptor Bean Impl
@Bean
@ConditionalOnMissingBean(RequestInterceptor.class)
@ConditionalOnBean(OAuth2ClientContext.class)
@ConditionalOnClass({RequestInterceptor.class, Feign.class})
feign.RequestInterceptor requestInterceptor(OAuth2ClientContext context) {
if (context == null) return null;
return new OAuth2FeignRequestInterceptor(context);
}
public class OAuth2FeignRequestInterceptor implements RequestInterceptor {