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 MyTest { | |
| @Rule | |
| public MethodRule screenshot = new ScreenshotOnFailureRule(); | |
| @Test | |
| public void myTest() { ... } | |
| ... | |
| } |
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
| 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 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
| 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 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
| package br.com.caelum.vraptor.benchmark; | |
| import java.lang.invoke.MethodHandle; | |
| import java.lang.reflect.Method; | |
| import java.util.concurrent.TimeUnit; | |
| import org.openjdk.jmh.annotations.BenchmarkMode; | |
| import org.openjdk.jmh.annotations.GenerateMicroBenchmark; | |
| import org.openjdk.jmh.annotations.Measurement; | |
| import org.openjdk.jmh.annotations.Mode; |
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
| /** | |
| * Copyright 2006-2013 the original author or authors. | |
| * | |
| * 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 |
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 ApplicationHelper implements ViewHelper { | |
| private final PrettyTimeFormatter formatter; | |
| public ApplicationHelper(PrettyTimeFormatter formatter) { | |
| this.formatter = formatter; | |
| } | |
| public String format(AbstractInstant instant) { |
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 br.com.smartcoders.easyclinic.components; | |
| import org.springframework.http.HttpStatus; | |
| import br.com.caelum.vraptor.Intercepts; | |
| import br.com.caelum.vraptor.Result; | |
| import br.com.caelum.vraptor.InterceptionException; | |
| import br.com.caelum.vraptor.core.InterceptorStack; | |
| import br.com.caelum.vraptor.interceptor.Interceptor; | |
| import br.com.caelum.vraptor.interceptor.ParametersInstantiatorInterceptor; |