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
# Nginx optimal congifuration guide. | |
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies. | |
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module | |
$ cd /usr/src | |
$ wget http://nginx.org/download/nginx-1.2.2.tar.gz | |
$ tar xzvf ./nginx-1.2.2.tar.gz && rm -f ./nginx-1.2.2.tar.gz | |
$ wget http://zlib.net/zlib127.zip |
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 Map.Helpers do | |
@moduledoc """ | |
Functions to transform maps | |
""" | |
@doc """ | |
Convert map string camelCase keys to underscore_keys | |
""" | |
def underscore_keys(nil), do: nil |
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 InsensitiveString do | |
@moduledoc """ | |
Case insensitive string functions for | |
ASCII string | |
""" | |
@doc """ | |
Compare two ascii strings in a case insensitive | |
manner |
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 Treewalk do | |
@type tree :: {:node, integer(), tree(), tree()} | nil | |
def depth({:node, value, nil, nil}, _fun) do | |
value | |
end | |
def depth({:node, value, nil, right}, fun) do | |
fun.(value, depth(right, fun), nil) | |
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
defmodule FunctionClause do | |
@moduledoc """ | |
Format function clauses using Exception.blame/3 | |
""" | |
@doc """ | |
Given a `module`, `function`, and `args` see | |
if that function clause would match or not match. | |
This is useful for helping diagnose function |
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 Decode do | |
@moduledoc """ | |
Extracted from https://github.com/ewildgoose/elixir-float_pp | |
""" | |
use Bitwise | |
@float_bias 1022 | |
############################################################################ |
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 PigLatin do | |
# vowels: a, e, i, o, u, y_, x_ | |
@vowels ["a", "e", "i", "o", "u"] | |
# special constants: "ch", "qu", "squ", "th", "thr", "sch" | |
@special ["ch", "qu", "squ", "thr", "th", "sch"] | |
@ay "ay" | |
defguard is_vowel(c) when c in @vowels |
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 ParseHelpers do | |
import NimbleParsec | |
def whitespace() do | |
ascii_char([?\s]) | |
|> repeat | |
end | |
def quote_mark(combinator \\ empty()) do | |
combinator |
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 Extract do | |
@moduledoc """ | |
Split into words only when the words have a "%" as a prefix | |
or a suffix | |
""" | |
# Empty string returns empty list | |
def words("") 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 Channel do | |
@input [{0, 190}, {1, 0}, {2, 0}, {3, 0}, {6, 220}, {9, 90}] | |
@doc """ | |
Map a list of {index, value} pairs | |
into a binary, filling in any gaps in | |
the index sequence with <<0>> as | |
the list is built. | |
""" |
OlderNewer