Skip to content

Instantly share code, notes, and snippets.

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<outputDirectory>${project.build.directory}/modified</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
@Configuration
@EnableSwagger2
public class SpringFoxConfig {
public static final String AUTHORIZATION_HEADER = "Authorization";
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.ignoredParameterTypes(AuthenticationPrincipal.class, DespaniPrincipal.class)
@Bean(name = "piTaskExecutor")
@Primary
public Executor piTaskExecutor() {
log.debug("Creating Async Task Executor");
final ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(4);
executor.setMaxPoolSize(10);
executor.setQueueCapacity(5);
executor.setAllowCoreThreadTimeOut(false);
executor.setThreadNamePrefix("PiExecutor-");
public static String getURL(HttpServletRequest curRequest) {
if(curRequest ==null) {
return "https://treespond.com/";
}
String scheme = curRequest.getScheme(); // http
String serverName = curRequest .getServerName(); // hostname.com
int serverPort = curRequest .getServerPort(); // 80
List<MyObject> largeList = /* your large list */;
List<MyObject> smallList = /* your small list */;
Collections.sort(largeList, Comparator.comparing(MyObject::getTicker));
List<MyObject> matchingObjects = smallList.stream()
.filter(item -> Collections.binarySearch(largeList, item, Comparator.comparing(MyObject::getTicker)) >= 0)
.collect(Collectors.toList());
public class JWTAuthenticationEntryPoint implements AuthenticationEntryPoint {
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception)
throws IOException, ServletException {
response.setStatus(403);
response.setContentType(MediaType. APPLICATION_JSON_VALUE);
String message;
if (exception.getCause() != null) {
@Configuration
@EnableWebSecurity(debug = false)
public class DespaniDualSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
DespSecurityManager secMan;
@Autowired
private UserServices userDetailsService;
@levancho
levancho / dabblet.css
Created December 20, 2013 20:34
The first commented line is your dabbler’s title Joe
/**
* The first commented line is your dabbler’s title Joe
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
</body>
</html>
YUI.add("SomeOtherModuleOne", function(Y){
//something here
}, "0.1", { requires: ["io-base"] });
YUI.add("SomeOtherModuleTwo", function(Y){
//something here
}, "0.1", { requires: ["io-base"] });