This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
db: | |
image: postgres:11-alpine | |
restart: always | |
ports: | |
- 5432:5432 | |
volumes: | |
- ./db-data:/var/lib/postgresql/data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Report do | |
defmacro __using__(_opts) do | |
quote do | |
import Report | |
end | |
end | |
defmacro dispatch(name, do: block) do | |
function_name = String.to_atom(name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Reports do | |
use Decorator.Define, [trace: 0] | |
def trace(body, context) do | |
quote do | |
try do | |
unquote(body) | |
rescue | |
e -> | |
IO.puts("Erro: " <> e.message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule HTTPServer do | |
@moduledoc """ | |
Este módulo é responsável por estabelecer uma conexão de servidor TCP | |
para suportar requisições HTTP. | |
Função principal: `start/1` | |
""" | |
defmodule Conn do | |
@moduledoc """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Let's write some Elixir. | |
defmodule FooBar do | |
def foo(a) do | |
if a < 0 do | |
bar(a, -1) | |
else | |
bar(a, 1) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#pragma warning(disable:4996) | |
struct WAV_FORMAT { | |
char riff[4]; | |
int32_t file_size; | |
char wave[4]; | |
char fmt[4]; | |
int32_t data_length; | |
int16_t format_tag; |