Skip to content

Instantly share code, notes, and snippets.

@gokman
gokman / Spring test - MultipartFile Example (Excel file)
Created March 9, 2017 14:54
Spring test - MultipartFile Example (Excel file)
//attributes ------------------------------
MockMultipartFile file;
XSSFWorkbook workbook;
XSSFSheet sheet;
//setup workbook and sheet ---------------------------
@Before
public void setup(){
workbook = new XSSFWorkbook();
@gokman
gokman / docker create image from container and push
Created March 10, 2017 06:09
docker create image from container and push
//create image from container
docker commit -a {authorname} {containername} {repositoryname:tag}
//push image
docker push {repositoryname:tag}
@gokman
gokman / gradle build with detail
Created March 24, 2017 13:43
gradle build with detail
gradle build -s -i
@gokman
gokman / angular heroku deploy
Created March 27, 2017 07:52
angular heroku deploy
1. set package.json file:
a. be careful about having dependencies attribute not devDependencies
b. add scripts attribute as below:
"scripts": {
"start": "gulp webserver", //used for starting web server
"postinstall": "node_modules/bower/bin/bower install", //used for installing bower dependencies
}
c. add engines attribute as below:
@gokman
gokman / spring boot heroku deploy
Created March 27, 2017 07:59
spring boot heroku deploy
1. create Procfile in the root folder of the project
web java -Dserver.port=$PORT $JAVA_OPTS -jar build/libs/{app_name}.jar
2. make commit and deploy
git init
git add .
git commit -m "commit"
@gokman
gokman / angular-gulp debug
Created May 2, 2017 06:29
angular-gulp debug
1. run gulp server task
2. go Run\Edit Configuration
3. click + button and create javascript debug task
3.1. set url as your server url (ex. localhost:5000)
3.2. set browser as chrome
@gokman
gokman / angular tooltip
Created May 2, 2017 13:36
angular tooltip
1. Add ui.bootstrap module to your app
2. Put below attributes to any html element that desire to show tooltip
data-toggle="tooltip" data-placement="top" title="{{ title }}"
Example:
<button data-toggle="tooltip" data-placement="top" title="Save">Save</button>
@gokman
gokman / format response object date in spring
Created May 5, 2017 12:53
format response object date in spring
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy HH:mm")
private Timestamp date;
By using above setting date attribute can be send to the client with that format. Otherwise you will see that date as long not
formatted date as string.
@gokman
gokman / dockerize postgresql (sample dockerfile)
Created May 16, 2017 05:44
dockerize postgresql (sample dockerfile)
FROM postgres:9.6
MAINTAINER gokhankcmn@gmail.com
RUN mkdir /sql
COPY create.sql /sql/
COPY insert.sql /sql/
EXPOSE 5433/tcp
VOLUME /var/lib/postgresql/data
@gokman
gokman / create image and container from postgresql dockerfile
Created May 16, 2017 06:00
create image and container from postgresql dockerfile
#create image
docker build -t {image_name} -f Dockerfile .
#create container
docker run -d -p 5433:5432 --name {container_name} {image_name}
#start container
docker start {container_name}
#go into the shell of the container