Skip to content

Commit 09168e9

Browse files
author
José Valim
committed
Fix links, instructions, update cheatsheet
1 parent 4e411f2 commit 09168e9

File tree

4 files changed

+8
-26
lines changed

4 files changed

+8
-26
lines changed

cheatsheets/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ references, also called cheat sheets.
44

55
To produce a .pdf starting from the .tex source, you need `tex`,
66
and more specifically [LaTeX](https://www.latex-project.org/get/).
7-
The BasicTex variant is enough for the purpose of these sheets.
87

9-
If you do not manage to compile the source into a pdf, or if you
10-
manage only after taking additional steps, not mentioned here,
11-
please add the steps in this description.
8+
The BasicTex variant can be used as long as the following packages
9+
are available:
10+
11+
$ tlmgr install courier framed charter enumitem ec helvetica
1212

1313
To compile a tex file EQUIS.tex into its corresponding EQUIS.pdf:
1414

cheatsheets/gen-server.pdf

-1.54 KB
Binary file not shown.

cheatsheets/gen-server.tex

+3-21
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
\section*{GenServer - a cheat sheet}
101101
\begin{itemize}
102102
\setlength\itemsep{0em}
103-
\item[---] last version: \verb|https://elixir-lang.org/getting-started/mix-otp/cheat-sheet.pdf|
103+
\item[---] last version: \verb|https://elixir-lang.org/cheatsheets/gen-server.pdf|
104104
\item[---] reference: \verb|https://hexdocs.pm/elixir/GenServer.html|
105105
\end{itemize}
106106
\begin{comment}
@@ -109,8 +109,6 @@ \section*{GenServer - a cheat sheet}
109109
based on a work by Benjamin Tan Wei Hao,
110110
rewritten as a tex/tikz document by Mario Frasca,
111111
with José Valim validating the content.
112-
113-
TODO: add yourself to the authors if you think so.
114112
\end{comment}
115113

116114
\begin{parchment}[initialization: .start $\rightarrow$ \bf\texttt{init/1}]
@@ -162,22 +160,11 @@ \section*{GenServer - a cheat sheet}
162160
(result.north west)+(0,-38pt) -- ($ (result.north east)+(0,-38pt) $);
163161

164162
\path (result.south east)+(3em,0) node (reason) [immediate,anchor=south west,fill=green!30!yellow!18!white] {
165-
\vspace*{-\baselineskip}
166-
\begin{verbatim}
167-
:normal
168-
:shutdown
169-
{:shutdown, _}
170-
_
171-
\end{verbatim}
163+
One of \verb|:normal|, \verb|:shutdown|, \verb|{:shutdown, _}|, or any other value. See the footnote for a link to the complete reference.
172164
};
173165
\path (reason.north west)+(-2pt,0) node [left-title,fill=green!25] {\rotatebox{90}{\^{}reason = }};
174166
\path (reason.north west)+(0,2pt) node [top-title,anchor=south west,fill=green!25] {applies globally};
175167

176-
\path (reason.north west)+(0,2em) node (explain) [explain,anchor=south west] {
177-
$\bullet$ \texttt{:normal} doesn't log, doesn't break links $\bullet$ \texttt{:shutdown}, \texttt{\{:shutdown, \_\}} doesn't log, breaks links $\bullet$ anything else logs, breaks links.
178-
};
179-
\path (explain.north west)+(-2pt,0) node [left-title,fill=white] {\rotatebox{90}{stop reasons}};
180-
181168
\draw[->,draw=blue!50!black,dashed,thick,anchor=north west] (-7.3em,-3.3em) .. controls (-7em,-7em) and (-22.45em,-1em) .. (-22.45em,-5.5em) -- (-22.45em,-6.9em);
182169

183170
\end{tikzpicture}
@@ -396,12 +383,6 @@ \section*{GenServer - a cheat sheet}
396383

397384
\path (result.north west)+(-2pt,0) node [left-title,fill=green!25] {\rotatebox{90}{\^{}result =}};
398385

399-
\path (result.south east)+(3em,0) node (explain) [explain,anchor=south west] {
400-
the reasons (\verb|:normal|, \verb|:shutdown|, \verb|{:shutdown, _}|) expected from a well behaved \verb|GenServer| are not defined by \verb|GenServer|, but by either Erlang (\verb|:normal|) or the \verb|Supervisor| module.
401-
};
402-
403-
\path (explain.north west)+(-2pt,0) node [left-title,fill=white] {\rotatebox{90}{explain reason}};
404-
405386
\draw[color=blue!10!yellow!5,draw=blue!25!yellow,dashed]
406387
(result.north west)+(0,-38pt) -- ($ (result.north east)+(0,-38pt) $);
407388

@@ -411,6 +392,7 @@ \section*{GenServer - a cheat sheet}
411392
\vspace*{-\baselineskip}
412393
\begin{itemize}
413394
\setlength\itemsep{0em}
395+
\item[---] More on exit reasons: \verb|https://hexdocs.pm/elixir/Supervisor.html#module-exit-reasons-and-restarts|
414396
\item[---] use \verb|@impl true| before each definition to guarantee it matches the equivalent \verb|GenServer| callback.
415397
\item[---] callbacks not listed here are: \verb|code_change/3| and \verb|format_status/2|.
416398
\item[---] source: \verb|https://github.com/elixir-lang/elixir-lang.github.com|

getting-started/mix-otp/genserver.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ So far we have used three callbacks: `handle_call/3`, `handle_cast/2` and `handl
322322

323323
Since any message, including the ones sent via `send/2`, go to `handle_info/2`, there is a chance unexpected messages will arrive to the server. Therefore, if we don't define the catch-all clause, those messages could cause our registry to crash, because no clause would match. We don't need to worry about such cases for `handle_call/3` and `handle_cast/2` though. Calls and casts are only done via the `GenServer` API, so an unknown message is quite likely a developer mistake.
324324

325-
To help developers remember the differences between call, cast and info, the supported return values and more, we have a tiny [GenServer cheat sheet](https://raw.githubusercontent.com/elixir-lang/elixir-lang.github.com/master/cheatsheets/gen-server.pdf), and it comes with `tex`/`tikz` source.
325+
To help developers remember the differences between call, cast and info, the supported return values and more, we have a tiny [GenServer cheat sheet](/cheatsheets/gen-server.pdf), and it comes with `tex`/`tikz` source.
326326

327327
## Monitors or links?
328328

0 commit comments

Comments
 (0)