Skip to content

Instantly share code, notes, and snippets.

View alissonfpmorais's full-sized avatar

Álisson Morais alissonfpmorais

View GitHub Profile
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
let
homeManager =
fetchTarball
https://github.com/nix-community/home-manager/archive/release-22.11.tar.gz;
@alissonfpmorais
alissonfpmorais / env_loader.exs
Last active July 28, 2022 14:14
Environment file loader for elixir projects
import Config
defmodule EnvFile do
@moduledoc """
This module may load environment files (commonly ".env")
into PID's environment.
After loading a file, all variables may be accessed using
&System.get_env/0 or &System.get_env/2
export class ChargeProcessorFactory {
static getProvider(): Provider<Promise<ChargeProcessor>> {
return {
// Interface
provide: ChargeProcessor,
// Factory que retorna implementação concreta
useFactory: async (gatewayService: GatewayService) => {
const billetGateways = await gatewayService.getGatewaysByPaymentMethod(BILLET_METHOD).toPromise();
const creditCardGateways = await gatewayService.getGatewaysByPaymentMethod(CREDIT_CARD_METHOD).toPromise();
const pixGateways = await gatewayService.getGatewaysByPaymentMethod(PIX_METHOD).toPromise();
@alissonfpmorais
alissonfpmorais / docker-compose.yml
Created January 25, 2021 13:51
Setup mongodb replica set with docker-compose
version: '3.1'
services:
mongo-setup:
container_name: mongo-setup
image: mongo
restart: on-failure
networks:
default:
volumes:
fuzz4 :
Fuzzer a
-> Fuzzer b
-> Fuzzer c
-> Fuzzer d
-> String
-> (a -> b -> c -> d -> Expectation)
-> Test
fuzz4 fuzzerA fuzzerB fuzzerC fuzzerD description fn =
fuzz2
@alissonfpmorais
alissonfpmorais / Response.kt
Created January 8, 2019 12:03
Response Type acting like Either pattern
sealed class Response<out S, out E>
data class Success<S>(val success: S) : Response<S, Nothing>()
data class Failure<E>(val error: E) : Response<Nothing, E>()
fun <S, E, R> Response<S, E>.map(f: (S) -> R): Response<R, E> = when (this) {
is Success -> Success(f(this.success))
is Failure -> this
}
fun <S, E, R> Response<S, E>.flatMap(f: (S) -> Response<R, E>): Response<R, E> = when (this) {
@alissonfpmorais
alissonfpmorais / cielo_payment.java
Last active October 30, 2018 13:52
Cielo payment
// CieloServiceBindListener.java
public class CieloServiceBindListener implements ServiceBindListener {
private final NavController navController;
private final PaymentViewModel viewModel;
private final Method method;
public CieloServiceBindListener(@NonNull final NavController navController, @NonNull final PaymentViewModel viewModel, @NonNull final Method method) {
this.navController = navController;
this.viewModel = viewModel;
this.method = method;
@alissonfpmorais
alissonfpmorais / non_remote_geekhunter.js
Last active September 25, 2018 18:13
search remote jobs on geekhunter.com.br
/**
* O uso é bem simples, basta seguir os passos:
* 1) Entre no site https://www.geekhunter.com.br/lista-empresas
* 2) Selecione quaisquer filtros que deseje aplicar a pesquisa;
* 3) Role até o final da página (para carregar todos as vagas correspondentes);
* 4) Cole o código abaixo no console do seu navegador;
* 5) Execute o código!
*
* Continuarão na lista apenas as vagas remotas
**/
fun t(msg: String = "alisson") {
println(f(msg, Either.monadError()))
println("11111111111111111111111111111111111")
println(f(msg, Try.monadError()))
println("22222222222222222222222222222222222")
println(g(msg, Either.monadError()))
println("33333333333333333333333333333333333")
println(g(msg, Try.monadError()))
println("44444444444444444444444444444444444")
IO.async()
@alissonfpmorais
alissonfpmorais / challenge_hashing_.idea_challenge_hashing.iml
Created August 7, 2017 19:57
Challenge made in "Algoritmos e Estruturas de Dados III" class
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />