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 BCP47 do | |
@moduledoc ~S""" | |
Main BCP47 module. | |
The `BCP47` module provides a parser for | |
[bcp 47](https://tools.ietf.org/html/bcp47) spec'd language tags. | |
""" | |
@type tag :: String.t |
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 Blank do | |
@moduledoc """ | |
Tools around checking and handling undefined or blank data. | |
""" | |
@doc """ | |
Returns `true` if data is considered blank/empty. | |
""" | |
def blank?(data) do | |
Blank.Protocol.blank?(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 Sequencer do | |
@base 256 | |
def find_mid(a, b, n \\ 1) do | |
[a, b] = ensure_order([a, b]) | |
ad = bin_to_list(a) | |
bd = bin_to_list(b) | |
intermediate_bytes = long_linspace(ad, bd, n) |
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 WorkWithFlags do | |
@moduledoc """ | |
Feature Toggle overlay for when having fun is not an option. | |
The main difference from the main lib is the precedence of gates | |
and how they combine. | |
In this implementation, we define Boolean > Actor > (Group & Percent). | |
The Boolean gate works as a master switch; requiring the flag be expressly |
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 ExUnit.Assertions.JSON do | |
@moduledoc """ | |
Assertions for validating JSON responses. | |
This code was cribbed from [Voorhees](https://github.com/danmcclain/voorhees) | |
and adapted to follow the modern ExUnit `lhs == rhs` assertion syntax, | |
as well as simplify matching logic. | |
""" | |
import ExUnit.Assertions |