Skip to content

Instantly share code, notes, and snippets.

View alissonfpmorais's full-sized avatar

Álisson Morais alissonfpmorais

View GitHub Profile
defmodule Variadic do
# https://elixirforum.com/t/defining-an-anonymous-function-of-dynamic-arity-not-variadic/38228/7?u=eksperimental
def spread_combine(h, f, g) do
{:arity, f_arity} = Function.info(f, :arity)
{:arity, g_arity} = Function.info(g, :arity)
args = Macro.generate_arguments(f_arity + g_arity, __MODULE__)
{f_args, g_args} = Enum.split(args, f_arity)
fn_ast =
@harveyconnor
harveyconnor / a-mongodb-replica-set-docker-compose-readme.md
Last active June 24, 2024 15:07
MongoDB Replica Set / docker-compose / mongoose transaction with persistent volume

This will guide you through setting up a replica set in a docker environment using.

  • Docker Compose
  • MongoDB Replica Sets
  • Mongoose
  • Mongoose Transactions

Thanks to https://gist.github.com/asoorm for helping with their docker-compose file!

function wait(signal, ms) {
return new Promise((res, rej) => {
const timeOut = setTimeout(() => {
console.log("I was called");
res("ok");
}, ms);
signal.catch(err => {
rej(err);
clearTimeout(timeOut);
@raulraja
raulraja / Tagless.kt
Last active January 20, 2020 15:53
Tagless in Kotlin with Arrow and manual DI
import arrow.Kind
import arrow.core.Option
import arrow.core.Try
import arrow.core.functor
import arrow.effects.IO
import arrow.effects.fix
import arrow.effects.functor
import arrow.typeclasses.Functor
/* algebras */
@Aetherus
Aetherus / scale-out-phoenix-with-websocket.md
Last active February 23, 2024 14:31
How to scale out a Phoenix application with websocket

How to scale out a Phoenix application with websocket

Foreword

It's relatively easy to scale out stateless web applications. You often only need a reverse proxy. But for those stateful web applications, especially those applications that embeds websocket services in them, it's always a pain to distribute them in a cluster. The traditional way is introducing some external services like Redis to handle pubsub, however, in such way, you often need to change your code. Can Erlang/Elixir, the "concurrency oriented programming languages", best other languages in this use case? Has Phoenix framework already integrated the solution of horizontally scaling websocket? I'll do an experiment to prove (or disprove) that.

Resources

@kelvinst
kelvinst / git-aliases.md
Last active April 7, 2024 20:30
Git alias - seja rápido, seja breve!

Git alias - seja rápido, seja breve!

Git freak como sou, precisava compartilhar algo útil sobre ele, claro. E, já que não vejo muito por aí o pessoal usando, resolvi falar dos alias do git! É um recurso que eu uso muito, e nunca entendi porque muitas pessoas não são adeptas. 😕

Pelo nome você já deve perceber que os alias no git são atalhos. Atalhos pro quê? São atalhos para comandos do git e até comandos shell se você quiser. E é bem fácil cadastrar um alias:

$ git config --global alias.st status