Skip to content

Instantly share code, notes, and snippets.

View fmcarvalho's full-sized avatar

Miguel Gamboa de Carvalho fmcarvalho

View GitHub Profile
import swaggerUi = require('swagger-ui-express');
import express = require('express');
const app = express();
const swaggerDocument = {
"swagger": "2.0",
"info": {
"title": "Blah",
"description": "",
"version": "1.0"
@fmcarvalho
fmcarvalho / flatMap-in-Java.md
Last active May 10, 2019 11:40
Corresponding Stream, Optional and CompletableFuture

I would love if Java has given consistent names for the same operations among these types:

Stream<T> (S<T>) Optional<T> (O<T>) CompletableFuture<T> (CF<T>)
void forEach(Consumer<T>) void ifPresent(Consumer<T>) CF<Void> thenAccept(Consumer<T>)
S<R> map(Function<T, R>) O<R> map(Function<T, R>) CF<R> thenApply(Function<T, R>)
S<R> flatMap(Function<T, S<R>>) O<R> flatMap(Function<T, O<R>>) CF<R> thenCompose(Function<T, CF<R>>)
S<T> peek(Consumer<T>) -- CF<T> whenComplete(BiConsumer<T,Throwable>)
S<R> zip(S<U>, BiFunction<T, U, R>) (*) -- CF<R> thenCombine(CF<U>, BiFunction<T, U, R>)
@stuart-marks
stuart-marks / ReadFileJavaApplicationBufferedReader7.java
Last active May 3, 2021 10:39
Processing Large Files in Java, Variation 7
package com.example.readFile.readFileJava;
import java.io.BufferedReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collections;
@Saissaken
Saissaken / Update git fork with tags.sh
Last active April 20, 2024 18:10
Update git fork with tags
# Repo: someuser/myframework
# Fork: superteam/myframework
# Track:
git clone https://github.com/superteam/myframework.git
cd myframework
git remote add upstream https://github.com/someuser/myframework.git
# Update:
git fetch upstream
@fmcarvalho
fmcarvalho / vscode-csharp-cheatsheet.md
Last active February 24, 2017 12:20
Build a Visual Studio Code solution from the scratch for .Net Core with unit tests

This topic applies to .NET Core Tools Preview 2 and Visual Studio 2015.

First of all ensure that you have all required tools installed -- Installation

Cheatsheet for VS Code .Net Core solution with unit tests

  1. Create the projects folders structure according to Figure 1 (NOTE: create only folders and not the files), e.g. in boilerplate solution we have 3 projects in src folder, corresponding to Fibonacci, Primes and
@staltz
staltz / introrx.md
Last active May 18, 2024 05:17
The introduction to Reactive Programming you've been missing
@ramnathv
ramnathv / gh-pages.md
Created March 28, 2012 15:37
Creating a clean gh-pages branch

Creating a clean gh-pages branch

This is the sequence of steps to follow to create a root gh-pages branch. It is based on a question at [SO]

cd /path/to/repo-name
git symbolic-ref HEAD refs/heads/gh-pages
rm .git/index
git clean -fdx
echo "My GitHub Page" &gt; index.html