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
Originally from: http://erlang.org/pipermail/erlang-questions/2017-August/093170.html | |
For a safe and fast Erlang SSL server, there's a few | |
configuration values you might want by default: | |
[{ciphers, CipherList}, % see below | |
{honor_cipher_order, true}, % pick the server-defined order of ciphers | |
{secure_renegotiate, true}, % prevent renegotiation hijacks | |
{client_renegotiation, false}, % prevent clients DoSing w/ renegs | |
{versions, ['tlsv1.2', 'tlsv1.1']}, % add tlsv1 if you must |
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
# You will need fswatch installed (available in homebrew and friends) | |
# The command below will run tests and wait until fswatch writes something. | |
# The --stale flag will only run stale entries, it requires Elixir v1.3. | |
fswatch lib/ test/ | mix test --stale --listen-on-stdin |
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 ReleaseManager.Plugin.ReleaseTasks do | |
@name "release_tasks" | |
@shortdoc "Generates an escript to invoke PS.ReleaseTasks" | |
use ReleaseManager.Plugin | |
alias ReleaseManager.Utils | |
def before_release(_), do: nil | |
def after_release(%Config{name: name}) do |
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 Lookup do | |
@wordfile "words.txt" | |
@external_resource @wordfile | |
@times 1_000_000 | |
@words @wordfile |> File.stream! |> Enum.map(&String.strip/1) | |
@hash_set Enum.into(@words, HashSet.new) | |
@map_set Enum.into(@words, MapSet.new) |
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
language: elixir | |
elixir: | |
- 1.0.5 | |
otp_release: 17.3 | |
matrix: | |
include: | |
- elixir: 1.2 |
This gist is deprecated in favor of https://github.com/ninenines/cowboy/blob/master/doc/src/guide/specs.asciidoc which has a formatted version at https://ninenines.eu/docs/en/cowboy/2.0/guide/specs/
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
iex> """ |> Erlang.module_to_core |> IO.puts | |
...> -file("nofile", 1). | |
...> -module('Elixir.M'). | |
...> | |
...> -export([hello/0]). | |
...> | |
...> hello() -> hello. | |
...> """ | |
module 'Elixir.M' ['hello'/0, | |
'module_info'/0, |
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
defp escape({ left, meta, right }) do | |
{ '{}', meta, [escape(left), meta, escape(right)] } | |
end | |
defp escape({ left, right }) do | |
{ escape(left), escape(right) } | |
end | |
defp escape(list) when is_list(list) do | |
Enum.map(list, escape(&1)) |
A couple weeks ago, we have pushed support to unquote fragments:
Enum.each [a: 1, b: 2], fn { k, v } ->
def map(unquote(k)), do: unquote(v)
end
Although it provide a nice way to dynamically define functions, after discussing with developers and extending Elixir to rely more on it, some flaws became aparent.
NewerOlder