Skip to content

Instantly share code, notes, and snippets.

View topera's full-sized avatar
😎
Minimalism is Power!

Rafael Topera topera

😎
Minimalism is Power!
  • Brazil
View GitHub Profile
@topera
topera / WordPresenterTest.java
Created March 10, 2019 17:32
Example of unit test of Android presenters (MVP architecture)
public class WordPresenterTest {
@Mock
WordPresenter.View view;
@Mock
WordService wordService;
private WordPresenter presenter;
@topera
topera / bitbucket-pipelines.yml
Created January 5, 2019 00:35
Bitbucket pipelines to run unit tests
image: java:8
pipelines:
default:
- step:
caches:
- gradle
script:
- bash ./gradlew test
@topera
topera / ForwardingController.java
Created July 8, 2018 13:20
Controller for springboot that redirects any url to /
@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 July 7, 2018 19:13
Example of basic Jenkinspipeline
pipeline {
agent {
any {}
}
stages {
stage('setup') {
steps {
sh './gradlew tasks'
}
@topera
topera / .travis.yml
Created July 1, 2018 23:45
Example of travis YAML file, using Gradle and SASS
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 June 29, 2018 01:51
Gradle file with many options to deploy on AWS Elastic Beanstalk
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 June 26, 2018 02:55
How to run SASS inside Travis CI

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 June 26, 2018 01:55
How to run Travis-CI locally
@topera
topera / dependencies.gradle
Created June 25, 2018 00:11
How to make Spring Boot reload changed java code. Just change the code and call "gradle assemble"
// spring: allow automatic restart
compile "org.springframework.boot:spring-boot-devtools:2.0.3.RELEASE"
@topera
topera / .travis.yml
Created June 24, 2018 00:00
How to run sass in travis(add this to your travis.yml file)
before_install:
- gem install sass --version "=3.5.6"