Skip to content

Instantly share code, notes, and snippets.

View josefigueredo's full-sized avatar
🚀

Jose Figueredo josefigueredo

🚀
View GitHub Profile
### Keybase proof
I hereby claim:
* I am josefigueredo on github.
* I am josefigueredo (https://keybase.io/josefigueredo) on keybase.
* I have a public key ASCQ8yBb1Qr4i4uEPgw7rWtzrhWkzHntPXM6B87tBdhAQAo
To claim this, I am signing this object:
.exchangeStrategies(
ExchangeStrategies.builder()
.codecs {
it.defaultCodecs()
.jackson2JsonEncoder(
Jackson2JsonEncoder(newMapper)
)
}
.codecs {
it.defaultCodecs()
@josefigueredo
josefigueredo / httpsig-in-postman-pre-request-script.js
Created April 7, 2021 15:26 — forked from DinoChiesa/httpsig-in-postman-pre-request-script.js
pre-request script for Postman, to perform HttpSignature calculation. Also SHA-256 message digest.
function computeHttpSignature(config, headerHash) {
var template = 'keyId="${keyId}",algorithm="${algorithm}",headers="${headers}",signature="${signature}"',
sig = template;
// compute sig here
var signingBase = '';
config.headers.forEach(function(h){
if (signingBase !== '') { signingBase += '\n'; }
signingBase += h.toLowerCase() + ": " + headerHash[h];
});
@josefigueredo
josefigueredo / minimal_payment.java
Created April 5, 2021 18:35 — forked from joelibaceta/minimal_payment.java
Ejemplos de creación de pagos con el del SDK para Java de MercadoPago
// Implementacion Minima de un Pago usando el SDK para Java de MercadoPago
//import com.mercadopago.MP;
//import org.codehaus.jettison.json.JSONArray;
//import org.codehaus.jettison.json.JSONObject;
MP mp = new MP("ACCESS_TOKEN");
JSONObject payment = null;
try {
{
ResultActions result = mockMvc.perform(post(USERS)
.contentType(APPLICATION_JSON_UTF8)
.content(toJson(new UserRequest("user")))
.accept(APPLICATION_JSON)
);
result.andExpect(status().isCreated())
.andExpect(content().contentType(APPLICATION_JSON_UTF8));
@josefigueredo
josefigueredo / index.html
Last active March 8, 2021 01:40
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Clock</title>
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
</head>
<body>
Whenever I want to create pull requests to a repo that I don't have write access to, I:
1. Fork the original repo to my account.
2. Clone the original repo to my local machine.
3. Add my fork as an additional remote and make it the push default.
4. Make changes in a new branch locally.
5. Push this branch to my fork.
6. Create a pull request from there.
```
@josefigueredo
josefigueredo / optionalNullableExtension.kt
Last active January 13, 2021 18:07 — forked from bastman/optionalToNullable.kt
Kotlin extension function to convert Java8 Optional<T> to Kotlin nullable T?
fun <T : Any> Optional<T>.toNullable(): T? = this.orElse(null);
fun <T : Any> T?.toOptional(): Optional<T> = Optional.ofNullable(this)
package com.josefigueredo.patterns;
public class StrategyPatternRunner {
public static void main(String[] args) {
String originalText = "This is a test from December 8th, 2020";
String expectedText = "ThisisatestfromDecember8th,2020";
noWhitespaces = Remover.remove(originalText, s -> s.replace(" ", ""));
assert noWhitespaces.equals(expectedText);
package com.josefigueredo.patterns;
public interface RemoveStrategy {
String execute(String s);
}