Skip to content

Instantly share code, notes, and snippets.

View fabriciofx's full-sized avatar
🎯
Focusing

Fabrício Cabral fabriciofx

🎯
Focusing
  • Brazil
  • 01:12 (UTC -03:00)
View GitHub Profile
@fabriciofx
fabriciofx / EnumDescribable.java
Created October 18, 2015 21:28 — forked from francofabio/EnumDescribable.java
vraptor4 gson enum serialization
public interface EnumDescribable {
String getDescription();
}
package br.com.triadworks.core.hibernate;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.criterion.CriteriaQuery;
import org.hibernate.criterion.SQLProjection;
import org.hibernate.type.Type;
import java.util.Arrays;
public class Capitalize {
public static String capitalize (String x) {
return x.substring(0,1).toUpperCase() + x.substring(1).toLowerCase();
}
public static void main(String[] args) {
String text = "gabinete do deputado fulando de tal e de dona maria";
package foo.model.repository;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.junit.AfterClass;
import org.junit.BeforeClass;
public abstract class AbstractRepositoryTest {
package fx.time;
import java.sql.Date;
import java.time.LocalDate;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
@Converter(autoApply = true)
public class PersistentLocalDate implements AttributeConverter<LocalDate, Date> {
package icob.model.entity.converter;
import java.sql.Timestamp;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import org.joda.time.LocalDateTime;
@Converter(autoApply = true)
/*
|--------------------------------------------------------------------------
| Delete form macro
|--------------------------------------------------------------------------
|
| This macro creates a form with only a submit button.
| We'll use it to generate forms that will post to a certain url with the DELETE method,
| following REST principles.
|
*/
java -jar war/WEB-INF/lib/htmlcompressor-*.jar \
--type html --recursive --mask '*.jsp;*.html;*.tag;*.htm' \
--compress-css --compress-js --js-compressor closure \
--remove-intertag-spaces --remove-quotes \
--preserve-server-script -p regex.txt \
-o war/ war/ 2> /dev/null
@Component
public class Carro {
private Motor motor;
@Autowired
public Carro(@Qualifier("motorAGasolina") Motor motor) {
this.motor = motor;
}
#don't send the nginx version number in error pages and Server header
server_tokens off;
# config to enable HSTS(HTTP Strict Transport Security) https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security
# to avoid ssl stripping https://en.wikipedia.org/wiki/SSL_stripping#SSL_stripping
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
# config to don't allow the browser to render the page inside an frame or iframe
# and avoid clickjacking http://en.wikipedia.org/wiki/Clickjacking
# if you need to allow [i]frames, you can use SAMEORIGIN or even set an uri with ALLOW-FROM uri