Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
Minimalism is Power!

Rafael Topera topera

😎
Minimalism is Power!
View GitHub Profile
@topera
topera / WordPresenterTest.java
Created Mar 10, 2019
Example of unit test of Android presenters (MVP architecture)
View WordPresenterTest.java
public class WordPresenterTest {
@Mock
WordPresenter.View view;
@Mock
WordService wordService;
private WordPresenter presenter;
@topera
topera / bitbucket-pipelines.yml
Created Jan 5, 2019
Bitbucket pipelines to run unit tests
View bitbucket-pipelines.yml
image: java:8
pipelines:
default:
- step:
caches:
- gradle
script:
- bash ./gradlew test
@topera
topera / ForwardingController.java
Created Jul 8, 2018
Controller for springboot that redirects any url to /
View ForwardingController.java
@Controller
public class ForwardingController {
@RequestMapping("/**/{path:[^\\.]+}")
public String forward() {
// path: checks only the path of url
// [^\.]: any char, except literal dot (because if the url is foo.css (for example) we don't want to redirect)
return "forward:/";
}
@topera
topera / Jenkinsfile
Created Jul 7, 2018
Example of basic Jenkinspipeline
View Jenkinsfile
pipeline {
agent {
any {}
}
stages {
stage('setup') {
steps {
sh './gradlew tasks'
}
@topera
topera / .travis.yml
Created Jul 1, 2018
Example of travis YAML file, using Gradle and SASS
View .travis.yml
sudo: required # need by docker
dist: trusty
group: travis_lts # travis_lts (stable) vs travis_latest (more features-fixes)
language: java
jdk:
- oraclejdk8
services:
@topera
topera / fobit-aws.gradle
Created Jun 29, 2018
Gradle file with many options to deploy on AWS Elastic Beanstalk
View fobit-aws.gradle
import com.terahorse.gradle.AWS
import com.terahorse.gradle.SimpleExec
def group = 'fobit-aws'
task setupFobitPackage(type: SimpleExec, group: group) {
description 'Creates a simple package for AWS EB. This package contains only Dockerrun.aws.json.'
doFirst {
run "cp Dockerrun-fobit.aws.json Dockerrun.aws.json"
}
@topera
topera / sass-inside-travis.md
Last active Jun 26, 2018
How to run SASS inside Travis CI
View sass-inside-travis.md

SASS Inside Travis CI

Working Solution

I was able to run it installing npm and then installing sass package of npm. I needed also to add a workaround to Error: CERT_UNTRUSTED error, using the config set registry command.

before_install:
  - sudo apt update
  - sudo apt install npm
@topera
topera / travis-docker.md
Last active Jun 26, 2018
How to run Travis-CI locally
View travis-docker.md
@topera
topera / dependencies.gradle
Created Jun 25, 2018
How to make Spring Boot reload changed java code. Just change the code and call "gradle assemble"
View dependencies.gradle
// spring: allow automatic restart
compile "org.springframework.boot:spring-boot-devtools:2.0.3.RELEASE"
@topera
topera / .travis.yml
Created Jun 24, 2018
How to run sass in travis(add this to your travis.yml file)
View .travis.yml
before_install:
- gem install sass --version "=3.5.6"
You can’t perform that action at this time.