Skip to content

Instantly share code, notes, and snippets.

View fmcarvalho's full-sized avatar

Miguel Gamboa de Carvalho fmcarvalho

View GitHub Profile
@fmcarvalho
fmcarvalho / flutter-cheatsheet.md
Last active September 16, 2021 12:57
Flutter cheatsheet

After installing Flutter you will have on Windows:

  • C:\src\flutter ---> Git repository ---> ~964 Mb
  • C:\src\flutter\bin ---> Tools
  • C:\src\flutter\bin\cache\dart-sdk ----> DART ---> ~418 Mb

Maybe you will need the following paths on PATH environment variable:

  • C:\src\flutter\bin ---> contains dart.bat and flutter.bat
  • C:\Users\miguel\AppData\Local\Android\Sdk\build-tools\29.0.2
@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>)
@fmcarvalho
fmcarvalho / kotlin-essentials.md
Last active January 10, 2019 15:57
kotlin essentials
  • var vs val -- mutable vs immutable
  • String interpolation -- "String of length ${b.length}"

  • classes -- Backing Fields
var <propertyName>[: <Type>] [= initializer]
                                     [get() = ...]
 [set(value) = field = value]
@fmcarvalho
fmcarvalho / isel-pi-i52d-grupos.md
Created September 10, 2018 13:05
Grupos de Pi da Turma i52d

grupo 1: grupo 2:

@fmcarvalho
fmcarvalho / ClassLoaderGw.java
Created September 20, 2017 11:49
ClassLoader interceptor
class ClassLoaderGw extends ClassLoader {
public ClassLoaderGw() {
super(null);
}
public Class<?> findClass(String name) throws ClassNotFoundException {
System.out.println("Loading...");
try{
InputStream classData = ClassLoader.getSystemResourceAsStream(name.replace('.', '/') + ".class");
@fmcarvalho
fmcarvalho / Maven-Central-Repository-cheatsheet.md
Last active December 27, 2023 16:52
Maven Central Repository deployment cheatsheet terminology

Maven Central Repository deployment cheatsheet

This is NOT a step by step tutorial guiding you on how to setup and configure your project to deploy artifacts to Maven Central Repository. There a couple of nice guides with detailed information about all setup requirements related with Maven, Sonatype OSSRH, Nexus Repository, Staging, POM, signing Your Artifact with PGP/GPG, etc.

Once you have enabled your deployment process, this guide aims to distil the core entities involved in that workflow.

Respositories

@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
import java.util.Date;
/**
* @author Miguel Gamboa
* created on 23-05-2016
*/
public class SoccerSeason {
public final int id;
public final String caption;
public final String league;
@fmcarvalho
fmcarvalho / Primes.java
Created May 16, 2016 21:47
Implementation of two approaches to calculate N prime numbers using Java 8 Streams (based on Chapter 6 proposal of Java 8 in Action)
package primes;
import org.openjdk.jmh.annotations.Benchmark;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.Properties;
import java.util.stream.IntStream;
@fmcarvalho
fmcarvalho / Streams-vs-Collections.md
Last active April 15, 2016 10:57
Comparing Streams with Collections
  • "In a nutshell, collections are about data and streams are about computations." [1]

  • "...you can see a stream as a set of values spread out in time. In contrast, a collection is a set of values spread out in space (here, computer memory)" [[2]]

    [2]: https://www.manning.com/books/java-8-in-action "Java 8 in Action"