Skip to content

Instantly share code, notes, and snippets.

View edgurgel's full-sized avatar

Eduardo Gurgel edgurgel

View GitHub Profile

Keybase proof

I hereby claim:

  • I am edgurgel on github.
  • I am edgurgel (https://keybase.io/edgurgel) on keybase.
  • I have a public key ASCFFdznd_xIcmqTNu9r9OB470iWR9qAaJi0dOKjeSfpPQo

To claim this, I am signing this object:

@edgurgel
edgurgel / nginx-custom-build.sh
Created March 25, 2016 21:59
Build Ubuntu or Debian packages for nginx with custom patches, configs, and name suffixes in one command
#!/bin/bash
# Author: Alexander Rodin <rodin.alexander@gmail.com>
# License: MIT
BUILD_DIR=build
while getopts "hp:s:r:b:o:c:n" opt; do
case $opt in
h)
echo "Usage: $0 [options]"
@edgurgel
edgurgel / example.ex
Created October 10, 2014 22:39
Overriding HTTPoison.Base.request/5
defmodule Example do
use HTTPoison.Base
def request(method, url, body \\ "", headers \\ [], options \\ []) do
IO.inspect [method, url, body, headers, options]
super(method, url, body, headers, options)
end
end
1) test assert received when different message having more than 10 on mailbox (ExUnit.AssertionsTest)
test/ex_unit/assertions_test.exs:108
No message matching :hello. Process mailbox (11): {:message, 1}
{:message, 2}
{:message, 3}
{:message, 4}
{:message, 5}
{:message, 6}
{:message, 7}
{:message, 8}
@edgurgel
edgurgel / unusedwarning_test.exs
Created August 26, 2014 09:28
Unused warning
test "should not give warning?" do
a = "a"
b = "b"
send self, {a, b}
assert_receive {a, b}
# test/unusedwarning_test.exs:8: warning: variable a is unused
# test/unusedwarning_test.exs:8: warning: variable b is unused
end
Hey guys,
Now that ListDict is dead, I'm using List API and I find annoying that we need to specify the key position on the tuple (I know this is not a dict) and I think it would be nice to have position as 0 by default.
My proposal is to have a function with less arguments that call the original with 0. We could have position on the end as optional argument, but this would break people's code and maybe harder to read.
keyreplace(list, key, new_tuple) -> keyreplace(list, key, 0, new_tuple)
This would be keyreplace, keystore, keyfind. Also other functions that already have position on the end could be 0 by default.
@edgurgel
edgurgel / wth.rb
Created March 28, 2014 02:02
WTH 0.0.3 formula
require "formula"
# https://github.com/Homebrew/homebrew/blob/master/Library/Formula/elixir.rb
class ErlangInstalled < Requirement
fatal true
default_formula 'erlang'
env :userpaths
satisfy {
erl = which('erl') and begin
@edgurgel
edgurgel / rest-cowboy
Created June 30, 2013 13:38
REST Cowboy
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/PR-SVG-20010719/DTD/svg10.dtd">
<svg width="12cm" height="13cm" viewBox="7 9 231 243" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="Background">
<g>
<polygon style="fill: #dbedf3; fill-opacity: 1" points="179.156,28.429 195.383,33.3794 179.156,38.3297 162.929,33.3794 "/>
<polygon style="fill: none; stroke-opacity: 1; stroke-width: 0.2; stroke: #000000" points="179.156,28.429 195.383,33.3794 179.156,38.3297 162.929,33.3794 "/>
<text font-size="1.6" style="fill: #000000; fill-opacity: 1;text-anchor:middle;font-family:sans-serif;font-style:normal;font-weight:normal" x="179.156" y="33.8794">
<tspan x="179.156" y="33.8794">previously_existed/2</tspan>
</text>
  • Brennar:

    • v.t.d. o ato de derrubar, derramar, algo ou alguma coisa sem a intenção do praticante da ação. Isso serve pra qualquer coisa água, almoço (ex. Brennou yourself <- sempre ocorre), café (mais costumeiramente).
  • Joiçar:

    • v.t.i. O ato de ficar até tarde no escritório; ou
    • v.t.i. Ficar mechendo no celular o tempo todo, principalmente em eventos sociais; ou
    • v.t.i. Não tomar café e/ou almoçar; ou
    • v.t.d. Brigar com Mateus porque ele sempre Mateusa (vide Mateusar) com o que eu falo ¬¬
  • Halanzar:

@doc """
Loads the rebar.config and evaluates rebar.config.script if it
exists in the given directory.
"""
def load_config(dir) do
config_path = Path.join(dir, "rebar.config")
script_path = Path.join(dir, "rebar.config.script")
config = case :file.consult(config_path) do
{ :ok, config } ->