Skip to content

Instantly share code, notes, and snippets.

View rhnonose's full-sized avatar

Rodrigo Nonose rhnonose

View GitHub Profile
@rhnonose
rhnonose / absinthe_collector.ex
Created October 18, 2019 17:57
Absinthe Collector
defmodule AbsintheCollector do
@moduledoc """
Module to collect absinthe telemetry events
"""
use Prometheus.Metric
require Prometheus.Contrib.HTTP
@events [
[:absinthe, :resolve, :field, :start],
[:absinthe, :resolve, :field],
@rhnonose
rhnonose / cla.md
Created October 23, 2018 20:27 — forked from kitten/cla.md
MIT CLA

Individual Contributor License Agreement (CLA)

Thank you for submitting your contributions to this project.

By signing this CLA, you agree that the following terms apply to all of your past, present and future contributions to the project.

License.

You hereby represent that all present, past and future contributions are governed by the

@rhnonose
rhnonose / Map.Helpers
Last active January 2, 2018 15:25 — forked from kipcole9/Map.Helpers
Helpers for Elixir Maps: underscore, atomise and stringify map keys
defmodule Map.Helpers do
@moduledoc """
Functions to transform maps
"""
@doc """
Convert map string camelCase keys to underscore_keys
"""
def underscore_keys(nil), do: nil
@rhnonose
rhnonose / assignment.erl
Created March 6, 2017 19:24
FutureLearn functional programming erlang assignment 1
-module(assignment).
-export([area/1, perimeter/1, enclose/1, bits/1, bits_tail/1]).
area({A,B,C}) ->
S = (A+B+C)/2,
math:sqrt(S*(S-A)*(S-B)*(S-C));
area({A,B}) ->
A*B.
@rhnonose
rhnonose / first.erl
Last active February 22, 2017 17:56
FutureLearn exercises
-module(first).
-export([double/1, mult/2, area/3, square/1, treble/1]).
mult(X,Y) ->
X*Y.
double(X) ->
mult(X, 2).
area(A,B,C) ->

Keybase proof

I hereby claim:

  • I am rhnonose on github.
  • I am rhnonose (https://keybase.io/rhnonose) on keybase.
  • I have a public key whose fingerprint is 79C4 774C 5684 8922 236E 4EFF 00D8 CD34 34AF B2E1

To claim this, I am signing this object:

@rhnonose
rhnonose / my_list.ex
Created April 27, 2016 17:40
List.flatten reimplementation in elixir.
defmodule MyList do
def flatten(array) do
reduce_flatten(array, [])
end
def reduce_flatten([], acc), do: acc
def reduce_flatten([elem | rest], acc) do
Enum.reduce([elem | rest], acc, &reduce_flatten/2)