Skip to content

Instantly share code, notes, and snippets.

@joshtriplett
Created July 29, 2020 01:51
Show Gist options
  • Save joshtriplett/ef9f4e230c70f9b132c80b346c93dd85 to your computer and use it in GitHub Desktop.
Save joshtriplett/ef9f4e230c70f9b132c80b346c93dd85 to your computer and use it in GitHub Desktop.
LaTeX source for "if a database wore a cap" meme
\documentclass{standalone}
% Josh Triplett - https://twitter.com/josh_triplett
\usepackage{tikz}
\usepackage{tikzlings}
\usetikzlibrary{shapes.geometric,positioning}
\begin{document}
\begin{tikzpicture}
\node[anchor=west,minimum height=1.2\baselineskip] at (0,1.3) {};
\begin{scope}[overlay]
\node[anchor=west,minimum height=1.2\baselineskip] at (0,1.3) {If a database wore a cap, would they wear it};
\end{scope}
\tikzstyle{db}=[draw,cylinder,shape border rotate=90,shape aspect=1.1,minimum width=2\baselineskip,minimum height=1.75\baselineskip]
\node[db] (an) at (0,0) {};
\node[db] (bn) at (1.5,0) {};
\node[db] (cn) at (0,-1) {};
\node[db] (dn) at (1.5,-1) {};
\node[db] (en) at (0,-2) {};
\node[db] (fn) at (1.5,-2) {};
\coordinate (a) at (an.before bottom);
\coordinate (b) at (bn.after bottom);
\coordinate (c) at (cn.shape center -| cn.east);
\coordinate (d) at (dn.shape center -| dn.west);
\coordinate (e) at (en.after top);
\coordinate (f) at (fn.before top);
\coordinate (ae) at (an.shape center -| an.east);
\coordinate (bw) at (bn.shape center -| bn.west);
\coordinate (ee) at (en.shape center -| en.east);
\coordinate (fw) at (fn.shape center -| fn.west);
\draw (ae) -- (bw);
\draw (an) -- (cn);
\draw (a) -- (d);
\draw (b) -- (c);
\draw (bn) -- (dn);
\draw (c) -- (d);
\draw (cn) -- (en);
\draw (c) -- (f);
\draw (d) -- (e);
\draw (dn) -- (fn);
\draw (ee) -- (fw);
\coordinate (acapshift) at (0,-1.6);
\coordinate (bcapshift) at (1.5,-1.6);
\coordinate (ccapshift) at (0,-2.6);
\coordinate (dcapshift) at (1.5,-2.6);
\coordinate (ecapshift) at (0,-3.6);
\coordinate (fcapshift) at (1.5,-3.6);
\thing[tophat,shift={(acapshift)}]
\thing[harlequin,shift={(bcapshift)}]
\thing[beret,shift={(ccapshift)}]
\thing[strawhat,shift={(dcapshift)}]
\thing[chef,shift={(ecapshift)}]
\thing[hat,shift={(fcapshift)}]
\node[anchor=base] at (0.75,-2.65) {like this};
\begin{scope}[overlay]
\node[anchor=base] at (2.25,-2.65) {or};
\end{scope}
\end{tikzpicture}
\begin{tikzpicture}
\tikzstyle{db}=[draw,cylinder,shape border rotate=90,shape aspect=1.1,minimum width=2\baselineskip,minimum height=1.75\baselineskip]
\node[db] (an) at (0,0) {};
\node[db] (bn) at (1.5,0) {};
\node[db] (cn) at (0,-1) {};
\node[db] (dn) at (1.5,-1) {};
\node[db] (en) at (0,-2) {};
\node[db] (fn) at (1.5,-2) {};
\coordinate (a) at (an.before bottom);
\coordinate (b) at (bn.after bottom);
\coordinate (c) at (cn.shape center -| cn.east);
\coordinate (d) at (dn.shape center -| dn.west);
\coordinate (e) at (en.after top);
\coordinate (f) at (fn.before top);
\coordinate (ae) at (an.shape center -| an.east);
\coordinate (bw) at (bn.shape center -| bn.west);
\coordinate (ee) at (en.shape center -| en.east);
\coordinate (fw) at (fn.shape center -| fn.west);
\draw (ae) -- (bw);
\draw (an) -- (cn);
\draw (a) -- (d);
\draw (b) -- (c);
\draw (bn) -- (dn);
\draw (c) -- (d);
\draw (cn) -- (en);
\draw (c) -- (f);
\draw (d) -- (e);
\draw (dn) -- (fn);
\draw (ee) -- (fw);
\coordinate (acapshift) at (0,-1.6);
\coordinate (bcapshift) at (1.5,-1.6);
\coordinate (ccapshift) at (0,-2.6);
\coordinate (dcapshift) at (1.5,-2.6);
\coordinate (ecapshift) at (0,-3.6);
\coordinate (fcapshift) at (1.5,-3.6);
\begin{scope}[shift=(acapshift)]
\clip[shift={(-0.4,2.55)}] (0,0) rectangle (0.5,-0.3);
\thing[tophat]
\end{scope}
\begin{scope}[shift=(bcapshift)]
\clip[shift={(-0.4,2.55)}] (0.5,0) rectangle (1,-0.3);
\thing[tophat]
\end{scope}
\begin{scope}[shift=(ccapshift)]
\clip[shift={(-0.4,2.55)}] (0,-0.3) rectangle (0.5,-0.55);
\thing[tophat]
\end{scope}
\begin{scope}[shift=(dcapshift)]
\clip[shift={(-0.4,2.55)}] (0.5,-0.3) rectangle (1,-0.55);
\thing[tophat]
\end{scope}
\begin{scope}[shift=(ecapshift)]
\clip[shift={(-0.4,2.55)}] (0,-0.55) rectangle (0.5,-0.8);
\thing[tophat]
\end{scope}
\begin{scope}[shift=(fcapshift)]
\clip[shift={(-0.4,2.55)}] (0.5,-0.55) rectangle (1,-0.8);
\thing[tophat]
\end{scope}
\node[anchor=base] at (0.75,-2.65) {like this};
\begin{scope}[overlay]
\node[anchor=base] at (2.25,-2.65) {or};
\end{scope}
\end{tikzpicture}
\begin{tikzpicture}
\begin{scope}
\thing[tophat,scale=3.75,rotate=10,shift={(0.05,-2.35)}]
\end{scope}
\tikzstyle{db}=[draw,cylinder,shape border rotate=90,shape aspect=1.1,minimum width=2\baselineskip,minimum height=1.75\baselineskip]
\node[db] (an) at (0,0) {};
\node[db] (bn) at (1.5,0) {};
\node[db] (cn) at (0,-1) {};
\node[db] (dn) at (1.5,-1) {};
\node[db] (en) at (0,-2) {};
\node[db] (fn) at (1.5,-2) {};
\coordinate (a) at (an.before bottom);
\coordinate (b) at (bn.after bottom);
\coordinate (c) at (cn.shape center -| cn.east);
\coordinate (d) at (dn.shape center -| dn.west);
\coordinate (e) at (en.after top);
\coordinate (f) at (fn.before top);
\coordinate (ae) at (an.shape center -| an.east);
\coordinate (bw) at (bn.shape center -| bn.west);
\coordinate (ee) at (en.shape center -| en.east);
\coordinate (fw) at (fn.shape center -| fn.west);
\draw (ae) -- (bw);
\draw (an) -- (cn);
\draw (a) -- (d);
\draw (b) -- (c);
\draw (bn) -- (dn);
\draw (c) -- (d);
\draw (cn) -- (en);
\draw (c) -- (f);
\draw (d) -- (e);
\draw (dn) -- (fn);
\draw (ee) -- (fw);
\node[anchor=base] at (0.75,-2.65) {like this?};
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment