├── .gitignore ├── .tool-versions ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── Makefile ├── README.md ├── build_cheatsheets.sh ├── config.rb ├── elixir_cheatsheet.adoc ├── erlang-cheatsheet-screenshot-window.jpg ├── erlang_cheatsheet.adoc ├── img └── erlang-logo.svg ├── otp_cheatsheet.adoc ├── sass ├── ie.scss ├── paper.scss ├── print.scss └── screen.scss └── template.html /.gitignore: -------------------------------------------------------------------------------- 1 | stylesheets 2 | build 3 | .sass-cache 4 | -------------------------------------------------------------------------------- /.tool-versions: -------------------------------------------------------------------------------- 1 | ruby 2.6.3 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | source "https://rubygems.org" 3 | 4 | git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } 5 | 6 | gem "asciidoctor" 7 | gem "compass" 8 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | asciidoctor (1.5.8) 5 | chunky_png (1.3.11) 6 | compass (1.0.3) 7 | chunky_png (~> 1.2) 8 | compass-core (~> 1.0.2) 9 | compass-import-once (~> 1.0.5) 10 | rb-fsevent (>= 0.9.3) 11 | rb-inotify (>= 0.9) 12 | sass (>= 3.3.13, < 3.5) 13 | compass-core (1.0.3) 14 | multi_json (~> 1.0) 15 | sass (>= 3.3.0, < 3.5) 16 | compass-import-once (1.0.5) 17 | sass (>= 3.2, < 3.5) 18 | ffi (1.10.0) 19 | multi_json (1.13.1) 20 | rb-fsevent (0.10.3) 21 | rb-inotify (0.10.0) 22 | ffi (~> 1.0) 23 | sass (3.4.25) 24 | 25 | PLATFORMS 26 | ruby 27 | 28 | DEPENDENCIES 29 | asciidoctor 30 | compass 31 | 32 | BUNDLED WITH 33 | 1.15.4 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Trevor Brown 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all compile watch release 2 | 3 | all: release 4 | 5 | watch: 6 | compass watch 7 | 8 | compile: 9 | compass compile 10 | 11 | release: compile 12 | mkdir -p build 13 | cp -r img stylesheets build 14 | # Generate HTML files 15 | ./build_cheatsheets.sh 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Erlang Cheatsheet 2 | 3 | ![Erlang Cheatsheet screenshot](erlang-cheatsheet-screenshot-window.jpg "Erlang Cheatsheet screenshot") 4 | 5 | The quirks of exit signals and exception handling you always forget. 6 | 7 | See the Erlang Cheatsheet here: https://stratus3d.com/erlang-cheatsheet 8 | See the OTP Cheatsheet here: https://stratus3d.com/otp-cheatsheet 9 | 10 | ## Contributing 11 | 12 | Feel free to create an issue or pull request if you find a mistake or see something that could be improved. 13 | 14 | ## Development 15 | 16 | Sass is used for the stylesheets. Dependencies are specified in the Gemfile. Makefile contains targets to build the final page and place it in `build/`. 17 | 18 | ## LICENSE 19 | 20 | MIT License 21 | -------------------------------------------------------------------------------- /build_cheatsheets.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Unofficial Bash "strict mode" 4 | # http://redsymbol.net/articles/unofficial-bash-strict-mode/ 5 | set -euo pipefail 6 | #ORIGINAL_IFS=$IFS 7 | IFS=$'\t\n' # Stricter IFS settings 8 | 9 | # Erlang Cheatsheet 10 | asciidoctor -s -o build/erlang_cheatsheet_content.html erlang_cheatsheet.adoc 11 | 12 | ( 13 | export CHEATSHEET_TITLE CHEATSHEET_HTML CHEATSHEET_DESCRIPTION 14 | CHEATSHEET_TITLE="Erlang Cheatsheet"; 15 | CHEATSHEET_HTML="$(cat build/erlang_cheatsheet_content.html)"; 16 | CHEATSHEET_DESCRIPTION="The quirks of exit signals and exception handling you always forget"; 17 | envsubst < template.html > build/erlang_cheatsheet.html 18 | rm build/erlang_cheatsheet_content.html 19 | ) 20 | 21 | # OTP Cheatsheet 22 | asciidoctor -s -o build/otp_cheatsheet_content.html otp_cheatsheet.adoc 23 | ( 24 | export CHEATSHEET_TITLE CHEATSHEET_HTML CHEATSHEET_DESCRIPTION 25 | CHEATSHEET_TITLE="OTP Cheatsheet"; 26 | CHEATSHEET_HTML="$(cat build/otp_cheatsheet_content.html)"; 27 | CHEATSHEET_DESCRIPTION="The details of OTP that you may have forgotten or never known!"; 28 | envsubst < template.html > build/otp_cheatsheet.html 29 | rm build/otp_cheatsheet_content.html 30 | ) 31 | 32 | # OTP Cheatsheet 33 | asciidoctor -s -o build/elixir_cheatsheet_content.html elixir_cheatsheet.adoc 34 | ( 35 | export CHEATSHEET_TITLE CHEATSHEET_HTML CHEATSHEET_DESCRIPTION 36 | CHEATSHEET_TITLE="Elixir Cheatsheet"; 37 | CHEATSHEET_HTML="$(cat build/elixir_cheatsheet_content.html)"; 38 | CHEATSHEET_DESCRIPTION="The details of Elixir that you often forget"; 39 | envsubst < template.html > build/elixir_cheatsheet.html 40 | rm build/elixir_cheatsheet_content.html 41 | ) 42 | -------------------------------------------------------------------------------- /config.rb: -------------------------------------------------------------------------------- 1 | require 'compass/import-once/activate' 2 | # Require any additional compass plugins here. 3 | 4 | # Set this to the root of your project when deployed: 5 | http_path = "/" 6 | css_dir = "stylesheets" 7 | sass_dir = "sass" 8 | images_dir = "images" 9 | javascripts_dir = "javascripts" 10 | 11 | # You can select your preferred output style here (can be overridden via the command line): 12 | # output_style = :expanded or :nested or :compact or :compressed 13 | 14 | # To enable relative paths to assets via compass helper functions. Uncomment: 15 | # relative_assets = true 16 | 17 | # To disable debugging comments that display the original location of your selectors. Uncomment: 18 | # line_comments = false 19 | 20 | 21 | # If you prefer the indented syntax, you might want to regenerate this 22 | # project again passing --syntax sass, or you can uncomment this: 23 | # preferred_syntax = :sass 24 | # and then run: 25 | # sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass 26 | -------------------------------------------------------------------------------- /elixir_cheatsheet.adoc: -------------------------------------------------------------------------------- 1 | = Elixir Cheatsheet 2 | 3 | [.sigils] 4 | == link:https://elixir-lang.org/getting-started/sigils.html[Sigils] 5 | 6 | Sigils support 8 different delimiters - `//`, `||`, `""`, `''`, `()`, `[]`, `{}`, `<>`. 7 | 8 | [%autowidth, options="header"] 9 | |================= 10 | |Sigil |Explanation 11 | |`~r()` |Regular Expression 12 | |`~s()` |String (binary) 13 | |`~c()` |Char list 14 | |`~w()s` |Word list of strings (binaries) 15 | |`~w()c` |Word list of char lists 16 | |`~w()a` |Word list of atoms 17 | |================= 18 | 19 | [.escape-codes] 20 | == link:https://elixir-lang.org/getting-started/sigils.html[Escape Codes] 21 | 22 | The following escape codes can be used in strings and char lists: 23 | 24 | [%autowidth, options="header"] 25 | |================= 26 | |Code |Explanation |Code |Explanation 27 | |`\\` | single backslash |`\a` | bell/alert 28 | |`\b` | backspace |`\d` | delete 29 | |`\e` | escape |`\f` | form feed 30 | |`\n` | newline |`\r` | carriage return 31 | |`\s` | space |`\t` | tab 32 | |`\v` | vertical tab |`\0` | null byte 33 | |`\xDD` |represents a single byte in hexadecimal (such as \x13) |`\uDDDD` and `\u{D...}` |represents a Unicode codepoint in hexadecimal (such as \u{1F600}) 34 | |================= 35 | 36 | A double quote literal inside a double quoted string also needs to be escaped. 37 | 38 | [.metaprogramming] 39 | == link:https://elixir-lang.org/getting-started/meta/macros.html[Metaprogramming] 40 | 41 | Various metaprogramming variables and macros. 42 | [%autowidth, options="header"] 43 | |================= 44 | |Expression |Explanation 45 | |`__ENV__` |A struct containing details about the compilation environment 46 | |`defmacro (name) do ... end` |Define a macro 47 | |`quote do ... end` |Convert the code inside the block to AST 48 | |`unquote(expression)` |Use to inject values from outside of the `quote` block 49 | |`def __using__` |The using macro 50 | |`\_\_MODULE\_\_` |Expands to the module name of the current module 51 | |`__CALLER__` | 52 | |`__DIR__` | 53 | |`__STACKTRACE__` | 54 | |================= 55 | 56 | == Structs, Maps, and Lists 57 | 58 | [%autowidth, options="header"] 59 | |================= 60 | |Operation |List |Keyword List |Map |link:https://elixir-lang.org/getting-started/structs.html[Struct] 61 | |Define | | | | 62 | ---- 63 | defmodule Person do 64 | defstruct first_name: "", last_name: "" 65 | end 66 | ---- 67 | |Create |`[1,2,3]` |`[a: :foo]` |`%{a: :foo}` | `%Person{first_name: "Joe", last_name: "Armstrong"}` 68 | |Match |`[a, b \| rest] = list` |`[a: value] = list` |`%{a: value} = map` |`%Person{first_name: name} = struct` 69 | |Update |`[new_value \| list]` | |`%{map \| a: new_value}` |`%{first_name: new_value}` 70 | |================= 71 | 72 | [.comprehensions] 73 | == link:https://elixir-lang.org/getting-started/comprehensions.html[Comprehensions] 74 | 75 | [source, elixir] 76 | ---- 77 | for var1 <- generator1, 78 | var2 <- generator2, 79 | new_var = some_expr(var1, var2), 80 | a_check?(new_var) do 81 | operation_to_generate_final_value(var1, var2) 82 | end 83 | ---- 84 | 85 | [[footer]] 86 | [.credit] 87 | https://elixir-lang.org/getting-started/introduction.html[Elixir Guide] Created by https://stratus3d.com[Stratus3D]  Copyright 2018.  https://github.com/Stratus3D/erlang-cheatsheet[Source Code] 88 | -------------------------------------------------------------------------------- /erlang-cheatsheet-screenshot-window.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stratus3D/erlang-cheatsheet/9c57d8dd0a4946adbb0ed5bf9a6398bd89bb36ff/erlang-cheatsheet-screenshot-window.jpg -------------------------------------------------------------------------------- /erlang_cheatsheet.adoc: -------------------------------------------------------------------------------- 1 | = Erlang Cheatsheet 2 | 3 | [.logo] 4 | image:img/erlang-logo.svg[Erlang e logo] 5 | 6 | [.subscript] 7 | The quirks of exit signals and exception handling you always forget 8 | 9 | [.trapping-exits] 10 | == Trapping Exits 11 | 12 | Trapping exits means the exit signals are converted to messages before being sent to the process. Trapping exits is done on a per process basis. Execute `process_flag(trap_exit, true).` in the process you want to be trapping exits. 13 | 14 | == Exit Signals 15 | 16 | [%autowidth, options="header"] 17 | |================= 18 | |Exit Type |Initiated by |Not trapping exits |Trapping exits 19 | |Normal |`exit(Pid, normal)` |Nothing |Receives `{'EXIT', Pid, normal}` 20 | |Normal |`exit(self(), normal)` |Terminates normally |Receives `{'EXIT', Pid, normal}` 21 | |Abnormal |`exit(Pid, Reason)` |Terminates abnormally |Receives `{'EXIT', Pid, Reason}` 22 | |Kill |`exit(Pid, kill)` |Terminates abnormally |Terminates abnormally 23 | |================= 24 | 25 | == Raising and Handling Exceptions 26 | 27 | [options="header", cols="~,20,25,~"] 28 | |================= 29 | |Purpose |Expression to generate |`try catch` handling pattern |`trap_exit` message 30 | |Stop execution because of runtime error |`exit/2` |`error:Reason` |`{'EXIT', Pid, Reason}` 31 | |Stop execution for any reason |`exit/1` |`exit:Reason` |`{'EXIT', Pid, Reason}` 32 | |non-local return |`throw/1` |`throw:Reason` |`{'EXIT', Pid, {{nocatch, Reason}, MFA}}` 33 | |================= 34 | 35 | == Errors 36 | 37 | `badmatch`:: 38 | pattern match error 39 | `badarg`:: 40 | BIF called with the wrong type 41 | `badarith`:: 42 | arithmetic error 43 | `undef`:: 44 | function not defined 45 | `function_clause`:: 46 | no matching function clause 47 | `if_clause`:: 48 | no matching if clause 49 | [.test] 50 | `case_clause`:: 51 | no matching case clause 52 | 53 | [.process-relationships] 54 | == Process Relationships 55 | 56 | [options="header", cols="~,~,~,28,20"] 57 | |================= 58 | |Name |Type |Purpose |Function to Create / + 59 | Example Calls |Function to Destroy / + 60 | Example Calls 61 | |Link |Symmetrical |Propagate exit signal from a process to all linked processes |`link/1`, `spawn_link/1,2,3,4` + 62 | `link(Pid).` |`unlink/1` + 63 | `unlink(Pid)` 64 | |Monitor |Asymmetrical |Sends a message to the monitoring process when the monitored process dies |`monitor/2`, `spawn_monitor/1,3` + 65 | `monitor(Pid)` |`demonitor/1,2` + 66 | `demonitor(Pid)` 67 | |================= 68 | 69 | [[footer]] 70 | [.credit] 71 | Created by https://stratus3d.com[Stratus3D]  Copyright 2018.  https://github.com/Stratus3D/erlang-cheatsheet[Source Code] 72 | -------------------------------------------------------------------------------- /img/erlang-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /otp_cheatsheet.adoc: -------------------------------------------------------------------------------- 1 | = OTP Cheatsheet 2 | 3 | [.logo] 4 | image:img/erlang-logo.svg[Erlang e logo] 5 | 6 | [.subscript] 7 | The details of OTP that you may have forgotten or never known! 8 | 9 | == Behaviors 10 | 11 | [%autowidth] 12 | |================= 13 | |link:http://erlang.org/doc/man/gen_server.html[`gen_server`] |For implementing the server of a client-server relation 14 | |link:http://erlang.org/doc/man/gen_statem.html[`gen_statem`] |For implementing state machines 15 | |link:http://erlang.org/doc/man/gen_event.html[`gen_event`] |For implementing event handling functionality 16 | |link:http://erlang.org/doc/man/supervisor.html[`supervisor`] |For implementing a supervisor in a supervision tree 17 | |================= 18 | 19 | == link:http://erlang.org/doc/design_principles/applications.html[Applications] 20 | 21 | [%autowidth, options="header"] 22 | |================= 23 | 2+|Application Types 24 | |*Applications* |Regular applications that define their own supervision tree 25 | |*Libraries* |A simple collection of modules and doesn't implement an application behavior callback module 26 | |================= 27 | 28 | [options="header", cols="12,~"] 29 | |================= 30 | |Start Types |Affect on Runtime when Application Terminates 31 | |`temporary` |Termination is reported but no other applications are terminated 32 | |`transient` |If application terminates abnormally all other applications and the runtime system are terminated 33 | |`permanent` |All other applications and the runtime system are terminated 34 | |================= 35 | 36 | == Supervisors 37 | 38 | === link:http://erlang.org/doc/design_principles/sup_princ.html#maximum-restart-intensity[Restart Intensity] 39 | 40 | The supervisor's maximum restart intensity limits the number of restarts that can occur within an period of time. Restart intensity is specified as a map with two keys - `intensity` and `period`. Restarts are limited to the to number specified by `intensity` that occur within the number of seconds specified by `period`. 41 | 42 | [.child-specs] 43 | === link:http://erlang.org/doc/design_principles/sup_princ.html#child-specification[Child Specs] 44 | 45 | Child specs are maps with the following keys: 46 | 47 | [%autowidth, options="header"] 48 | |================= 49 | |Key |Optional |Description 50 | |`id` |required |An identifier to use for the process 51 | |`start` |required |The MFA to use to start the process 52 | |`restart` |optional |See the restart types 53 | |`shutdown` | optional |`brutal_kill` or an integer timeout for workers. Must be `infinity` for supervisors. 54 | |`type` | optional| See the child types 55 | |`modules` | optional| The callback module if there is one 56 | |================= 57 | 58 | [.child-types] 59 | === Child Types 60 | 61 | [%autowidth] 62 | |================= 63 | | `worker` |Any process that is not a supervisor 64 | | `supervisor` |A supervisor process 65 | |================= 66 | 67 | [.restart-types] 68 | === Restart Types 69 | 70 | [%autowidth] 71 | |================= 72 | |`permanent` |The process is always restarted 73 | |`temporary` |The process is never restarted 74 | |`transient` |The process is only restarted if it terminates abnormally 75 | |================= 76 | 77 | [.restart-strategies] 78 | === Restart Strategies 79 | 80 | [%autowidth, options="header"] 81 | |================= 82 | |Strategy |Description 83 | |`one_for_one` |If one child process crashes only restart that process 84 | |`one_for_all` |If one child process crashes all other child processes are terminated and all of them are restarted 85 | |`rest_for_one` |If one child process crashes the rest of the child processes are terminated and the crashed process and other terminated processes are restarted 86 | |`simple_one_for_one` |Like the one_for_one strategy, but it can only dynamically start processes from a single child spec 87 | |================= 88 | 89 | [[footer]] 90 | [.credit] 91 | http://erlang.org/doc/design_principles/des_princ.html[OTP Design Principles] Created by https://stratus3d.com[Stratus3D]  Copyright 2018.  https://github.com/Stratus3D/erlang-cheatsheet[Source Code] 92 | -------------------------------------------------------------------------------- /sass/ie.scss: -------------------------------------------------------------------------------- 1 | /* Welcome to Compass. Use this file to write IE specific override styles. 2 | * Import this file using the following HTML or equivalent: 3 | * */ 6 | -------------------------------------------------------------------------------- /sass/paper.scss: -------------------------------------------------------------------------------- 1 | // Taken from https://github.com/cognitom/paper-css 2 | 3 | @page { margin: 0 } 4 | body { margin: 0 } 5 | .sheet { 6 | margin: 0; 7 | //overflow: hidden; // This caused me trouble 8 | position: relative; 9 | box-sizing: border-box; 10 | page-break-after: always; 11 | } 12 | 13 | /** Paper sizes **/ 14 | body.A3 .sheet { width: 297mm; height: 419mm } 15 | body.A3.landscape .sheet { width: 420mm; height: 296mm } 16 | body.A4 .sheet { width: 210mm; height: 296mm } 17 | body.A4.landscape .sheet { width: 297mm; height: 209mm } 18 | body.A5 .sheet { width: 148mm; height: 209mm } 19 | body.A5.landscape .sheet { width: 210mm; height: 147mm } 20 | body.letter .sheet { width: 216mm; height: 279mm } 21 | body.letter.landscape .sheet { width: 280mm; height: 215mm } 22 | body.legal .sheet { width: 216mm; height: 356mm } 23 | body.legal.landscape .sheet { width: 357mm; height: 215mm } 24 | 25 | /** Padding area **/ 26 | .sheet.padding-10mm { padding: 10mm } 27 | .sheet.padding-15mm { padding: 15mm } 28 | .sheet.padding-20mm { padding: 20mm } 29 | .sheet.padding-25mm { padding: 25mm } 30 | 31 | /** For screen preview **/ 32 | @media screen { 33 | body { background: #e0e0e0 } 34 | .sheet { 35 | background: white; 36 | box-shadow: 0 .5mm 2mm rgba(0,0,0,.3); 37 | margin: 5mm auto; 38 | } 39 | } 40 | 41 | /** Fix for Chrome issue #273306 **/ 42 | @media print { 43 | body.A3.landscape { width: 420mm } 44 | body.A3, body.A4.landscape { width: 297mm } 45 | body.A4, body.A5.landscape { width: 210mm } 46 | body.A5 { width: 148mm } 47 | body.letter, body.legal { width: 216mm } 48 | body.letter.landscape { width: 280mm } 49 | body.legal.landscape { width: 357mm } 50 | } 51 | -------------------------------------------------------------------------------- /sass/print.scss: -------------------------------------------------------------------------------- 1 | /* Welcome to Compass. Use this file to define print styles. 2 | * Import this file using the following HTML or equivalent: 3 | * */ 4 | 5 | @import "screen"; 6 | -------------------------------------------------------------------------------- /sass/screen.scss: -------------------------------------------------------------------------------- 1 | @import "compass/reset"; 2 | @import "compass/utilities/tables"; 3 | @import "compass/utilities/tables/alternating-rows-and-columns"; 4 | @import "paper"; 5 | 6 | // Colors 7 | $black: #000; 8 | $gray: #666; 9 | $light-gray: #e6e6e6; 10 | $red: #a90533; 11 | $white: #fff; 12 | 13 | // Typography 14 | body { 15 | font-family: Helvetica Neue, Helvetica, Arial, sans-serif; 16 | font-size: 0.85em; 17 | color: $black; 18 | line-height: 1.3em; 19 | } 20 | 21 | h1, h2, h3, h4, h5, h6 { 22 | font-weight: 500; 23 | margin-bottom: 0.5em; 24 | margin-top: 0.5em; 25 | text-transform: uppercase; 26 | } 27 | 28 | h1 { 29 | margin-top: 0.2em; 30 | font-size: 2.8em; 31 | } 32 | 33 | h2 { 34 | font-size: 1.8em; 35 | } 36 | 37 | h3 { 38 | font-size: 1.55em; 39 | } 40 | 41 | h4 { 42 | font-size: 1.45em; 43 | } 44 | 45 | h5 { 46 | font-size: 1.3em; 47 | } 48 | 49 | h6 { 50 | font-size: 1.1em; 51 | } 52 | 53 | 54 | p, code, span, table, dd, dt { 55 | font-size: 0.95em; 56 | } 57 | 58 | a { 59 | color: $red; 60 | } 61 | 62 | // don't make heading links red 63 | h1, h2, h3, h4, h5, h6 { 64 | a { 65 | color: $black; 66 | } 67 | } 68 | 69 | .subscript { 70 | float: left; 71 | clear: left; 72 | font-style: italic; 73 | color: adjust-lightness($gray, -20); 74 | margin: -6px 0 10px 0; 75 | } 76 | 77 | div.paragraph { 78 | margin-bottom: 0; 79 | } 80 | 81 | code { 82 | font-family: Courier New, Courier, Lucida Sans Typewriter, Lucida Typewriter, monospace; 83 | background: $light-gray; 84 | color: adjust-lightness($red, -5); 85 | font-weight: 600; 86 | 87 | border-radius: 4px; 88 | padding: 0px 3px; 89 | display: inline-block; 90 | } 91 | 92 | .credit a { 93 | font-weight: bold; 94 | } 95 | 96 | // Layout 97 | html { 98 | background: $light-gray; 99 | } 100 | 101 | body { 102 | margin: 0 auto; 103 | max-width: 210mm; // TODO: Refactor this out of here 104 | 105 | } 106 | 107 | .wrapper { 108 | display: block; 109 | overflow: auto; 110 | padding: 1em; 111 | 112 | h1 { 113 | float: left; 114 | } 115 | } 116 | .header, .sect1 { 117 | display: block; 118 | overflow: auto; 119 | float: left; 120 | clear: left; 121 | } 122 | 123 | .trapping-exits { 124 | display: block; 125 | clear: left; 126 | float: none; 127 | } 128 | 129 | // Specific to OTP cheatsheet 130 | .child-specs { 131 | float: left; 132 | } 133 | 134 | .restart-types, .child-types { 135 | float: left; 136 | clear: none; 137 | } 138 | 139 | .child-specs, .restart-types, .child-types { 140 | width: 38%; 141 | padding-right: 2%; 142 | } 143 | 144 | .child-specs { 145 | width: 58%; 146 | } 147 | 148 | .restart-strategies { 149 | clear: both; 150 | } 151 | 152 | // Specific to Elixir cheatsheet 153 | .sigils, .escape-codes { 154 | float: left; 155 | clear: none; 156 | } 157 | 158 | .sigils { 159 | clear: both; 160 | width: 33%; 161 | } 162 | 163 | .escape-codes { 164 | width: 66%; 165 | } 166 | 167 | #footer { 168 | padding: 1em 0; 169 | float: right; 170 | } 171 | 172 | 173 | table { 174 | clear: both; 175 | margin-bottom: 0.5em; 176 | $table-color: $red; 177 | @include table-scaffolding; 178 | 179 | th { 180 | text-align: left; 181 | } 182 | 183 | td { 184 | padding: 3px 4px; 185 | } 186 | //@include inner-table-borders(2px, $white); 187 | //@include outer-table-borders(2px, $white); 188 | //@include alternating-rows-and-columns($table-color, adjust-hue($table-color, -120deg), #222222); 189 | //@include alternating-rows-and-columns($white, $red, $white); 190 | thead { 191 | background: $light-gray; 192 | 193 | td { 194 | font-weight: bold; 195 | } 196 | } 197 | 198 | tr:nth-child(2n) { 199 | background: $light-gray; 200 | } 201 | 202 | p { 203 | float: left; 204 | display: block; 205 | } 206 | } 207 | 208 | // Misc. 209 | .logo img { 210 | max-height: 120px; 211 | max-width: 140px; 212 | float: right; 213 | margin: 0 0 1em 1em; 214 | } 215 | 216 | dt, dd { 217 | float: left; 218 | margin-right: 0.2em; 219 | } 220 | dd { 221 | margin-right: 1em; 222 | 223 | p { 224 | font-size: inherit; 225 | } 226 | } 227 | 228 | strong { 229 | font-weight: bold; 230 | } 231 | 232 | .listingblock { 233 | float: left; 234 | } 235 | -------------------------------------------------------------------------------- /template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $CHEATSHEET_TITLE 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 24 |
25 |

$CHEATSHEET_TITLE

26 | $CHEATSHEET_HTML 27 |
28 | 29 | 30 | --------------------------------------------------------------------------------