Skip to content

Instantly share code, notes, and snippets.

View michalgce's full-sized avatar
🎯
CodeBuster

Michał Witkowski michalgce

🎯
CodeBuster
  • CodeBuster CEO
  • Gliwice
View GitHub Profile
@baberali
baberali / LoggingFilter.java
Created August 15, 2016 11:48
Instead of writing your own classes to cache request response for logging, Spring provides a couple of useful classes i.e. ContentCachingRequestWrapper and ContentCachingResponseWrapper. These classes can be utilized very effectively, for example, in the following little filter:
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
@jprante
jprante / binary-put-es.sh
Last active May 9, 2020 15:06
Put binary data to Elasticsearch
# first, set
#
# http.compression: true
#
# in config/elasticsearch.yml
curl -XDELETE 'localhost:9200/test'
rm -f content.json content.json.gz
echo '{"content":"Hello World"}' > content.json
anonymous
anonymous / TestDb.java
Created August 21, 2014 07:40
// Use this in your testLocationTable() method
// Test data we're going to insert into the DB to see if it works.
String testLocationSetting = "99705";
String testCityName = "North Pole";
double testLatitude = 64.7488;
double testLongitude = -147.353;