This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package exemplos; | |
| import java.util.Random; | |
| public class MontyHall { | |
| // Dadas duas portas, escolhe aquela que restou. | |
| // Exemplos: | |
| // se forem dadas as portas 0 e 1, retorna 2 | |
| // se forem dadas as portas 0 e 2, retorna 1 | |
| // se forem dadas duas portas iguais (0 e 0, por ex.) retorna a primeira livre, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| |-------------------------------------------------------------------------- | |
| | 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. | |
| | | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Component | |
| public class Carro { | |
| private Motor motor; | |
| @Autowired | |
| public Carro(@Qualifier("motorAGasolina") Motor motor) { | |
| this.motor = motor; | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Validate { | |
| public static boolean not(boolean expression){ | |
| return !expression; | |
| } | |
| public static boolean in(String value, String[] options){ | |
| return StringUtil.in(value, options); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| find -name "*.jsp" | xargs sed -i "s:\\]\[:,:g" && find -name "*.jsp" | xargs sed -i "s:\(linkTo\[[a-zA-Z0-9]*\]\.[a-zA-Z0-9]*\)\[\(.*\)\]:\1(\2):" |