This file contains 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 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
AddEncoding gzip .gz | |
RewriteEngine on | |
RewriteCond %{HTTP:Accept-encoding} gzip | |
RewriteCond %{HTTP_USER_AGENT} !Konqueror | |
RewriteCond %{REQUEST_FILENAME}.gz -f | |
RewriteRule ^(.*)\.css$ $1.css.gz [QSA,L] | |
RewriteRule ^(.*)\.js$ $1.js.gz [QSA,L] | |
RewriteRule ^(.*)\.html$ $1.html.gz [QSA,L] |
This file contains 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 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
module.exports = function(grunt) { | |
var config = {}; | |
// Set all the tasks you want to load. | |
var tasks = [ | |
, "grunt-contrib-concat" | |
, "grunt-contrib-uglify" | |
, "grunt-contrib-jshint" | |
, "grunt-contrib-watch" | |
]; |
This file contains 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 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 MyTest { | |
@Rule | |
public MethodRule screenshot = new ScreenshotOnFailureRule(); | |
@Test | |
public void myTest() { ... } | |
... | |
} |
This file contains 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.web.interceptor; | |
import java.util.Iterator; | |
import java.util.Locale; | |
import javax.enterprise.context.ApplicationScoped; | |
import javax.enterprise.inject.Specializes; | |
import javax.inject.Inject; | |
import javax.validation.ConstraintViolation; | |
import javax.validation.MessageInterpolator; |
This file contains 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
import java.lang.annotation.ElementType; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; | |
import java.lang.annotation.Target; | |
@Retention(RetentionPolicy.RUNTIME) | |
@Target(ElementType.METHOD) | |
public @interface PreventExternalAccess { | |
} |
This file contains 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
import java.time.LocalDate; | |
import java.time.temporal.TemporalAdjusters; | |
public class DatasImportantesNaoTestavel { | |
public LocalDate diaDoProgramadorDesseAno(){ | |
//como fazer para testar uma data do passado, por exemplo, de 2012? | |
return LocalDate.now().with(TemporalAdjusters.firstDayOfYear()).plusDays(255); | |
} | |
} |
This file contains 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> { |