Skip to content

Instantly share code, notes, and snippets.

View pedroct92's full-sized avatar
🤠

Pedro Torres pedroct92

🤠
View GitHub Profile
@pedroct92
pedroct92 / build.gradle
Created November 27, 2019 19:38 — forked from Alykoff/build.gradle
gradle build with release plugins net.researchgate.release (clean assemble artifactoryPublish)
import net.researchgate.release.GitAdapter
import java.util.regex.Matcher
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.1.1"
@pedroct92
pedroct92 / package.json
Created March 23, 2018 18:00 — forked from aVolpe/package.json
Build a angular-cli project with maven
{...
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json",
"clean": "rm -rf dist",
"build-prod": "yarn install && ng build -prod",
"build-dev": "yarn install && ng build -dev",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
@pedroct92
pedroct92 / CustomErrorController.java
Created January 25, 2018 21:41 — forked from jonikarppinen/CustomErrorController.java
Example of replacing Spring Boot "whitelabel" error page with custom error responses (with JSON response body)
package com.company.project.controllers;
import com.company.project.model.api.ErrorJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.web.ErrorAttributes;
import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestAttributes;
@pedroct92
pedroct92 / PdfOrErrorController.java
Created January 25, 2018 21:41 — forked from jonikarppinen/PdfOrErrorController.java
Example of using ExceptionHandler in Spring Boot: a controller method that returns either binary data or error JSON
package com.company.project.controllers;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Random;
@pedroct92
pedroct92 / web.xml
Created December 8, 2017 16:07 — forked from jtgasper3/web.xml
Force Tomcat to redirect all HTTP traffic to HTTPS.
<!--
To force Tomcat to redirect and revert all requested HTTP traffic over to HTTPS, configure the `conf/web.xml` file with the below block.
This should be placed at the very end of the file near and above the ending `</webapp>` tag:
-->
<security-constraint>
<web-resource-collection>
<web-resource-name>Automatic Forward to HTTPS/SSL
</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
@pedroct92
pedroct92 / BaseJasperReport.java
Created February 7, 2017 16:11 — forked from piotrze/BaseJasperReport.java
Using jasper reports with play framework
package lib.reports;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.export.JExcelApiExporter;
@pedroct92
pedroct92 / build.gradle
Created June 8, 2016 18:56
Findbugs and PMD with Android Gradle Plugin
//Thanks to https://github.com/stephanenicolas/Quality-Tools-for-Android/blob/master/build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}