Skip to content

Instantly share code, notes, and snippets.

View yogonza524's full-sized avatar
:octocat:
Coding..

Gonza yogonza524

:octocat:
Coding..
View GitHub Profile
A problem occurred configuring root project 'demo'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.0-RC1.
Required by:
project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.0.0-RC1
> No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.0.0-RC1 was found. The consumer was configured to find a runtime of a library compatible with Java 14, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5.1' but:
- Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.0-RC1 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 17 and the consumer needed a runtime of a component compatible with Java 14
- Othe
@yogonza524
yogonza524 / github-actions-mask-all-secrets.yml
Last active January 30, 2022 14:20
Run at begin of Job execution to avoid show any secret at any step
name: Mask secrets
on:
workflow_dispatch:
jobs:
Mask Secrets:
name: Mask secrets at job
runs-on: ubuntu-latest
steps:
@yogonza524
yogonza524 / [Puzzle] Find the number.java
Last active October 19, 2020 16:42
There's a 10-digit number, ABCDEFGHIJ, whose digits are all different, and that has an interesting property: if you take the first N digits from left to right, the resulting number is exactly divisible by N. What's the number? To clarify: A is divisible by 1, AB is divisible by 2, ABC is divisible by 3, etc., up to ABCDEFGHIJ that is divisible b…
@Test
public void findNumber() {
int[] CD = new int[]{12,16,24,28,32,36,48,64,68,72,76,84,92,96};
int[] B = new int[]{2,4,6,8};
int[] F = new int[]{2,4,6,8};
int[] FGH = new int[]{216, 248, 264, 296, 416, 432, 472, 496, 624, 632, 648, 672, 816, 824, 832, 864, 872, 896};
int[] valid = new int[]{1,2,3,4,6,7,8,9};
validate(CD, B, F, FGH, valid);
@yogonza524
yogonza524 / gist:0da512034856ca8adc6189ae2e6a1803
Created September 17, 2020 09:55
Clean Camo cache of Github Repository (Home page)
// Just run next command:
curl -X GET "https://badge-dx.herokuapp.com/camo/YOUR_USERNAME_AT_GITHUB/YOUR_REPO_NAME_AT_GITHUB" -H "accept: */*"
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.HashMap;
import java.util.Map;
import java.util.function.BiFunction;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.platform.commons.util.StringUtils;
public class RomanNumberTest {
package testcontainer.sample;
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import static org.junit.jupiter.api.Assertions.*;
@Testcontainers
plugins {
id 'java-library'
}
repositories {
jcenter()
}
dependencies {
api 'org.apache.commons:commons-math3:3.6.1'
@GetMapping("/createAndRedirect")
public String createAndRecirect() throws MPException {
Preference preference = new Preference();
preference.setBackUrls(
new BackUrls()
.setFailure("http://localhost:8080/failure")
.setPending("http://localhost:8080/pending")
.setSuccess("http://localhost:8080/success")
);
@SpringBootApplication
public class MpSampleApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(MpSampleApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
MercadoPago.SDK.setAccessToken(System.getenv("MP_ACCESS_TOKEN"));
plugins {
id 'org.springframework.boot' version '2.3.0.M4'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
}
group = 'com.mp'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'