% !TEX TS-program = xelatex
% !TEX encoding = UTF-8 Unicode

\documentclass[9pt]{article}

% force US English hyphenation 
\usepackage[USenglish]{babel}

% more advanced expressions in \setlength
\usepackage{calc}

% more advanced command declaration
\usepackage{xparse}

% provides some extra warnings regarding deprecated practices
\usepackage[l2tabu,orthodox]{nag}

% define margin
\newlength\cvMargin
\setlength\cvMargin{0.2in}

% set defined margin as paper margin
\usepackage[margin=\cvMargin,noheadfoot]{geometry}

% set the other lengths based on the margin
\newlength\cvSideWidth
\setlength\cvSideWidth{0.3\paperwidth-\cvMargin}
\newlength\cvMainWidth
\setlength\cvMainWidth{\paperwidth-4\cvMargin-\cvSideWidth}

\newlength\cvPictureWidth
\setlength\cvPictureWidth{1.5in}

% defining some lengths for the language bar
\newlength\cvLanguageBarWidth
\setlength\cvLanguageBarWidth{3em}

\newlength\cvLanguageBarHeight
\setlength\cvLanguageBarHeight{0.75em}

% defines spacing between a section and its icon
\newlength\cvTimeDotSep
\setlength\cvTimeDotSep{0.1in}

% spacing between two items in a section
\newlength{\cvSectionSep}
\setlength{\cvSectionSep}{0.1in}

% we will define this length later, based on the widest icon
\newlength\cvHeaderIconWidth

% Determines font styles
\newcommand{\cvSection}[1]{\Large\textbf{#1}}
\newcommand{\cvEducation}[3]{{\firaMedium #1}\\ #2\\ \emph{#3}}
\newcommand{\cvExperience}[5]{{\firaMedium #1}\\ \textsc{\selectfont #2}, #3. #4\\ \emph{#5}}

% allow for links
\usepackage{hyperref}

% advanced drawing
\usepackage{tikz}
\usetikzlibrary{calc,positioning,backgrounds,matrix,node-families} %requires node-families file

% pictures
\usepackage{graphicx}

% define four main colours
\definecolor{cvColor}{HTML}{5F9CA8}
\definecolor{cvColorLight}{HTML}{99D0DA}
\definecolor{cvDark}{HTML}{2F3142}
\definecolor{cvAccent}{HTML}{474A65}

% load external fonts
\usepackage{fontspec}    

% icon font
\usepackage{fontawesome}   
   
% load external fonts
\setmainfont[Numbers={OldStyle,Monospaced}]{Open Sans}
\setsansfont{Open Sans}
\setmonofont{Open Sans}
\newfontfamily\firaMedium{Open Sans}

\pagestyle{empty}

% update default paragraph indent, and header space
\setlength{\topskip}{0pt}      % between header and text (0 needed for vertical centring)
\usepackage{parskip}           % remove paragraph indents

% setting variable from before based on widest icon
\setlength{\cvHeaderIconWidth}{\maxof{\widthof{\faBriefcase}}{\widthof{\faGraduationCap}}}

% set TikZ styles
\tikzset{%
  contactIcon/.style={%
    minimum height=\baselineskip,
  },
  contactText/.style={%
    minimum height=\baselineskip,
    text depth=0pt,
  },
  headerIcon/.style={%
    minimum width=\cvHeaderIconWidth,
    anchor=center,
  },
  languageText/.style={%
    font=\footnotesize,
    minimum width=4em,
  },
  languageText2/.style={%
    font=\footnotesize,
    minimum width=5em,
  },
  progressArea/.style={%
    draw,
    rectangle,
    minimum width=\cvLanguageBarWidth,
    minimum height=\cvLanguageBarHeight,
    cvColor},
  progressBar/.style={%
    minimum height=\cvLanguageBarHeight,
    rectangle,
    draw,
    fill,
    cvColor,
    anchor=west},
  sectionTitle/.style={%
    anchor=north west,
    align=left},
  eventdottext/.style = {%
    text width=\cvMainWidth-\cvTimeDotSep,
    black,
    %text depth=0pt,
    anchor=north west,
  },
  sectionedutext/.style={%
    eventdottext,
    anchor=north west
  },
  invisibletimedot/.style = {%
    circle,
    minimum width=3pt,
    anchor=center
  },
  timedot/.style = {%
    invisibletimedot,
    draw,
    minimum width=3pt,
    fill,
    black,
  },
  }

% based on https://tex.stackexchange.com/questions/65731
\makeatletter
\def\cv@hrulefill{{\color{cvColor}\leavevmode\leaders\hrule height 1pt\hfill\kern\z@}}

% line before and after text (some tweaking is required here)
% based on https://tex.stackexchange.com/questions/15119
\NewDocumentCommand{\ruleline}{m}{\par\noindent\raisebox{\baselineskip/4}{\makebox[\linewidth]{\cv@hrulefill\hspace{1ex}\raisebox{-\baselineskip/4}{#1}\hspace{1ex}\cv@hrulefill}}}
\makeatother

% update global colour
\makeatletter
\NewDocumentCommand{\globalcolor}{m}{%
  \color{#1}\global\let\default@color\current@color
}
\makeatother
\AtBeginDocument{\globalcolor{cvDark}}

\NewDocumentCommand{\cvLanguage}{mm}{%
  {\globaldefs=1\relax\pgfkeys{/cv/languages/lang\the\value{languages} = #2}}
  
  \stepcounter{languages}
}

\makeatletter
\newcount\my@repeat@count
\newcommand{\cvSkill}[1]{%
  \begingroup
  \my@repeat@count=\z@
  \@whilenum\my@repeat@count<#1\do{\faCircle\advance\my@repeat@count\@ne}%
  \my@repeat@count=\numexpr5-\z@\relax
  \@whilenum\my@repeat@count>#1\do{\faCircleO\advance\my@repeat@count\m@ne}%
  \endgroup
}
\makeatother
  
\begin{document}

  \vspace*{\fill}
  % fill in sidebar
  \begin{tikzpicture}[remember picture,overlay]
    \fill[cvColorLight] (current page.north west) rectangle ++(\cvSideWidth+2\cvMargin,-\paperheight);
  \end{tikzpicture}

  % sidebar formatted as a minipage
  \begin{minipage}{\cvSideWidth}
    \begin{center}
  
      % profile photo
      \begin{tikzpicture}
        \node[
          rectangle,
          minimum size=\cvPictureWidth,
          path picture={%
            \node at (path picture bounding box.center){%
            \includegraphics[width=\cvPictureWidth]{img/profile_picture}
            };
          }]{};
      \end{tikzpicture}

      {\LARGE
      Richard Connor

      \vspace{10pt}

      Johnstone}
      
      \vspace{0.1in}
      
      {\color{cvAccent} Aerospace Engineer}
      
      \vspace{0.1in}

      \ruleline{Profile}
      
      \small
      Currently pursuing employment as an Aerospace Software Engineer while
      earning a Masters in Aerospace Engineering (focus in Astrodynamics) at the
      University of Colorado -- Boulder.
      
      \vspace{4pt}
      
      \ruleline{Contact}
      
      \vspace{8pt}
      
      \begin{tikzpicture}[every node/.style={inner sep=0pt, outer sep=0pt}]
        \matrix [
          column 1/.style={anchor=center,contactIcon},
          column 2/.style={anchor=west,align=left,contactIcon},
          column sep=5pt,
          row sep=5pt] (contact) {%
          \node{\faEnvelope}; 
            & \node{\href{mailto:connor@richardconnorjohnstone.com}{%
              {\small connor@richardconnorjohnstone.com}}};\\
          \node{\faMapMarker}; 
            & \node{690 Inca Parkway\\Boulder, CO 80303};\\
          \node{\faPhone}; 
            & \node{+1 (502) 414-1242};\\
          \node{\faGlobe}; 
            &
            \node{\href{https://richardconnorjohnstone.com}{%
              richardconnorjohnstone.com}};\\
          \node{\faGithub}; 
            & \node{\href{https://github.com/rconnorjohnstone}{rconnorjohnstone}};\\
          \node{\faLinkedinSquare}; 
            & \node{\href{https://www.linkedin.com/rconnorjohnstone}{%
              rconnorjohnstone}};\\
      };
      \end{tikzpicture}
      
      \vspace{4pt}
      
      \ruleline{Languages}
      
      \vspace{4pt}
      
      \begin{tikzpicture}[every node/.style={text depth=0pt,inner sep=0pt,outer sep=0pt}]
        \matrix [column sep=5pt,row sep=3pt] (contact) {%
          \node[languageText]{Python}; & 
          \node[progressArea](language 1) {}; &
          \node[languageText2]{Julia}; & 
          \node[progressArea] (language 2) {}; \\

          \node[languageText]{C++};  & 
          \node[progressArea] (language 3) {}; &
          \node[languageText2]{MATLAB}; & 
          \node[progressArea] (language 4) {}; \\

          \node[languageText]{\LaTeX}; & 
          \node[progressArea] (language 5) {}; &
          \node[languageText2]{Mathematica}; & 
          \node[progressArea] (language 6) {}; \\

          \node[languageText]{Rust}; & 
          \node[progressArea] (language 7) {}; \\
        };
        \draw (language 1.west) 
        node[progressBar,minimum width=5/5*\cvLanguageBarWidth] {};
        \draw (language 2.west) 
        node[progressBar,minimum width=5/5*\cvLanguageBarWidth] {};
        \draw (language 3.west) 
        node[progressBar,minimum width=4/5*\cvLanguageBarWidth] {};
        \draw (language 4.west) 
        node[progressBar,minimum width=4/5*\cvLanguageBarWidth] {};
        \draw (language 5.west) 
        node[progressBar,minimum width=4/5*\cvLanguageBarWidth] {};
        \draw (language 6.west) 
        node[progressBar,minimum width=3/5*\cvLanguageBarWidth] {};
        \draw (language 7.west) 
        node[progressBar,minimum width=1/5*\cvLanguageBarWidth] {};
      \end{tikzpicture}

      \vspace{4pt}
      
      \ruleline{Guidance Software}
      
      \vspace{4pt}
      
      \begin{tikzpicture}[every node/.style={text depth=0pt,inner sep=0pt,outer sep=0pt}]
        \matrix [column sep=5pt,row sep=3pt] (contact) {%
          \node[languageText]{GMAT}; & 
          \node[progressArea](guidance 1) {}; &
          \node[languageText2]{STK}; & 
          \node[progressArea] (guidance 2) {}; \\
        };
        \draw (guidance 1.west) 
        node[progressBar,minimum width=5/5*\cvLanguageBarWidth] {};
        \draw (guidance 2.west) 
        node[progressBar,minimum width=3/5*\cvLanguageBarWidth] {};
      \end{tikzpicture}

      \vspace{4pt}
      
      \ruleline{CAD Software}
      
      \vspace{4pt}
      
      \begin{tikzpicture}[every node/.style={text depth=0pt,inner sep=0pt,outer sep=0pt}]
        \matrix [column sep=5pt,row sep=3pt] (contact) {%
          \node[languageText]{PTC Creo}; & 
          \node[progressArea](cad 1) {}; &
          \node[languageText2]{AutoCAD}; & 
          \node[progressArea] (cad 2) {}; \\

          \node[languageText]{Solidworks}; & 
          \node[progressArea](cad 3) {}; &
          \node[languageText2]{CATIA v5}; & 
          \node[progressArea] (cad 4) {}; \\
        };
        \draw (cad 1.west) 
        node[progressBar,minimum width=5/5*\cvLanguageBarWidth] {};
        \draw (cad 2.west) 
        node[progressBar,minimum width=4/5*\cvLanguageBarWidth] {};
        \draw (cad 3.west) 
        node[progressBar,minimum width=3/5*\cvLanguageBarWidth] {};
        \draw (cad 4.west) 
        node[progressBar,minimum width=3/5*\cvLanguageBarWidth] {};
      \end{tikzpicture}

      \vspace{4pt}
      
      \ruleline{Operating Systems}
      
      \vspace{4pt}
      
      \begin{tikzpicture}[every node/.style={text depth=0pt,inner sep=0pt,outer sep=0pt}]
        \matrix [column sep=5pt,row sep=3pt] (contact) {%
          \node[languageText]{Linux}; & 
          \node[progressArea](os 1) {}; &
          \node[languageText2]{Windows}; & 
          \node[progressArea] (os 2) {}; \\
        };
        \draw (os 1.west) 
        node[progressBar,minimum width=5/5*\cvLanguageBarWidth] {};
        \draw (os 2.west) 
        node[progressBar,minimum width=4/5*\cvLanguageBarWidth] {};
      \end{tikzpicture}

      \vspace{4pt}
      
      \ruleline{Other}
      
      \vspace{4pt}
      
      \begin{tikzpicture}[every node/.style={text depth=0pt,inner sep=0pt,outer sep=0pt}]
        \matrix [column sep=5pt,row sep=3pt] (contact) {%
          \node[languageText]{Git}; & 
          \node[progressArea](other 1) {}; &
          \node[languageText2]{Office}; & 
          \node[progressArea] (other 2) {}; \\

          \node[languageText]{Vim}; & 
          \node[progressArea](other 3) {}; &
          \node[languageText2]{LabVIEW}; & 
          \node[progressArea] (other 4) {}; \\
        };
        \draw (other 1.west) 
        node[progressBar,minimum width=4/5*\cvLanguageBarWidth] {};
        \draw (other 2.west) 
        node[progressBar,minimum width=4/5*\cvLanguageBarWidth] {};
        \draw (other 3.west) 
        node[progressBar,minimum width=4/5*\cvLanguageBarWidth] {};
        \draw (other 4.west) 
        node[progressBar,minimum width=1/5*\cvLanguageBarWidth] {};
      \end{tikzpicture}

      \vspace{4pt}

      \ruleline{Skills}

      \vspace{4pt}

    \end{center}
      \footnotesize
      Experience in programming in both low and high level languages for a wide
      variety of aerospace engineering applications: Kalman Filtering,
      trajectory design of Earth-based and interplanetary missions,
      control theory for low-thrust mission design, control of attitude systems 
      using quaternions and Modified Rodriguez Parameters, and orbit 
      determination and proximity/rendesvous operations leveraging computer 
      vision. Some experience in containerizing platforms (Docker) for web-based 
      server deployment. Also some experience in Linux bash scripting.

  \end{minipage}
  \vspace*{\fill}
  
\begin{tikzpicture}[
  every node/.style={
    inner sep=0pt,
    outer sep=0pt
  },
  remember picture,
  overlay,
  shift={($(current page.north west)%
           +(\cvSideWidth+3\cvMargin+\cvTimeDotSep,-\cvMargin)$)}]
  % main content  
  
  \node[sectionTitle] at (0,0) (title 1) {\cvSection{Education}};
  \node[left=\cvTimeDotSep of title 1,headerIcon] {\faGraduationCap};
  \begin{scope}[on background layer]
    \draw[line width=2pt,cvColor] 
      let \p1=(title 1.south west), 
          \p2=(current page.east) in 
      (\x1,\y1-0.1cm) to (\x2,\y1-0.1cm);
  \end{scope}
  
  % University of Colorado -- Boulder
  \node[
      below=\cvSectionSep of title 1.south west,
      eventdottext] 
      (item 1 header) 
      {\phantom{Evening}};
  \node[
    below=\cvSectionSep of title 1.south west,
    sectionedutext] 
    (item 1) 
    {\cvEducation{
      Masters of Aerospace Engineering}%
      {University of Colorado -- Boulder, Boulder, CO, August 2018 -- Current}%
      {Currently pursuing a Masters degree with a focus in astrodynamics.
      GPA: 3.5/4.0}};
  \node[
    left=\cvTimeDotSep of item 1 header,
    timedot] 
    (start) 
    {};
    
  % University of Kentucky
  \node[
      below=\cvSectionSep of item 1.south west,
      eventdottext] 
      (item 2 header) 
      {\phantom{Evening}};
  \node[
    below=\cvSectionSep of item 1.south west,
    sectionedutext] 
    (item 2) 
    {\cvEducation{Bachelor of Science in Mechanical Engineering}%
                 {University of Kentucky, Lexington, KY. August 2011 -- May 2016}%
                 {General training in Mechanical Engineering practices including
                 product design, with an emphasis on orbital mechanics. GPA: 3.6/4.0}};
  \node[
    left=\cvTimeDotSep of item 2 header,
    timedot] 
    {};
    
  % University of Kentucky 2
  \node[
      below=\cvSectionSep of item 2.south west,
      eventdottext] 
      (item 3 header) 
      {\phantom{Evening}};
  \node[
    below=\cvSectionSep of item 2.south west,
    sectionedutext] 
    (item 3) 
    {\cvEducation{Bachelor of Science in Physics}%
                 {University of Kentucky, Lexington. August 2011 -- May 2016}%
                 {General training in all types of physical sciences, including
                 general and special relativity, electromagnetism, and quantum
                 mechanics. GPA: 3.6/4.0}};
  \node[
    left=\cvTimeDotSep of item 3 header,
    timedot] 
    {};
  \node[
    left=\cvTimeDotSep of item 3.south west,
    invisibletimedot] 
    (end) 
    {};
  \draw (start) to (end.center);
  
  %%%%%%%%%%%%%%
  % Experience %
  %%%%%%%%%%%%%%
  
  \node[below=0.6cm of item 3.south west,sectionTitle] (title 2)
  {\cvSection{Recent Experience}};
  \node[left=\cvTimeDotSep of title 2,headerIcon] {\faBriefcase};
  \node[below=0.6cm of item 3.south west,sectionTitle] (title 2 dummy) {\phantom{\cvSection{Education}}};
  \begin{scope}[on background layer]
    \draw[line width=2pt,cvColor] 
      let \p1=(title 2 dummy.south west), 
          \p2=(current page.east) in 
      (\x1,\y1-0.1cm) to (\x2,\y1-0.1cm);
  \end{scope}
  
\node[
      below=\cvSectionSep of title 2.south west,
      eventdottext] 
      (item 1 header) 
      {\phantom{Evening}};
  \node[
    below=\cvSectionSep of title 2.south west,
    sectionedutext] 
    (item 1) 
    {\cvExperience%
      {Internship}%
      {Palski And Associates}%
      {Colorado Springs, CO}%
      {Summer 2019}%
      {Organized an effort to automate telescope observations to perform
      satellite orbit state determination using purely visual information.
      Developed a program to determine range, azimuth, and elevation information
      from the observations and solve for state elements using Gooding's
      approach to Lambert's problem.\\
      Also developed flight-ready software for a variety of proximity/rendesvous
      operations for a secondary observational cubesat during critical missions,
      leveraging feature detection and recognition in point cloud, LIDAR, and
      RGB image data.}};
  \node[
    left=\cvTimeDotSep of item 1 header,
    timedot] 
    (start) 
    {};
    
  % item 2
  \node[
      below=\cvSectionSep of item 1.south west,
      eventdottext] 
      (item 2 header) 
      {\phantom{Evening}};
  \node[
    below=\cvSectionSep of item 1.south west,
    sectionedutext] 
    (item 2) 
    {\cvExperience%
      {Mechanical Design Engineer 2}%
      {Lockheed Martin Missile and Fire Control}%
      {Lexington, KY}%
      {February 2018 -- August 2018}%
      {Performed product design and redesign for several important armoring
      subsystems of the GMV 1.1 military vehicle, including cost reduction,
      weight reduction, and armor performance improvements on the vehicle
      chassis and outer shell. Typically performed rapid brainstorming and
      turn-around time to provide support for Special Operations in the US 
      Army.}};
  \node[
    left=\cvTimeDotSep of item 2 header,
    timedot] 
    {};
    
  % item 3
  \node[
      below=\cvSectionSep of item 2.south west,
      eventdottext] 
      (item 3 header) 
      {\phantom{Evening}};
  \node[
    below=\cvSectionSep of item 2.south west,
    sectionedutext] 
    (item 3) 
    {\cvExperience%
       {Lead Design Engineer}%
       {Rhodes Systems International}%
       {Louisville, KY}%
       {August 2016 -- February 2018}%
       {Completely redesigned the kickout/crossover box subsystems for
       industrial tow-line conveyor systems in heavy equipment finishing and
       manufacturing. Responsible for system-level design of several projects
       with sale prices over \$1 Million. Also responsible for oversight of
       machining and project fabrication shop operations.}};
  \node[
    left=\cvTimeDotSep of item 3 header,
    timedot] 
    {};
  \node[
    left=\cvTimeDotSep of item 3.south west,
    invisibletimedot] 
    (end) 
    {};
  \draw (start) to (end.center);

  %%%%%%%%%%
  % Skills %
  %%%%%%%%%%
  
  \node[below=0.6cm of item 3.south west,sectionTitle] (title 3) {\cvSection{Skills}};
  \node[left=\cvTimeDotSep of title 3,headerIcon] {\faStar};
  \node[below=0.6cm of item 3.south west,sectionTitle] (title 3 dummy) {\phantom{\cvSection{Education}}};
  \begin{scope}[on background layer]
    \draw[line width=2pt,cvColor] 
      let \p1=(title 3 dummy.south west), 
          \p2=(current page.east) in 
      (\x1,\y1-0.1cm) to (\x2,\y1-0.1cm);
  \end{scope}
  
\matrix[matrix of nodes,
        below=0.6cm of title 3.south west,
        anchor=north west,
        column sep=6pt,
        row sep=6pt,
        every node/.style={Text Depth=tdSkills},
        column 1/.style={anchor=east,align=left},
        column 2/.style={anchor=west},
        column 3/.style={anchor=east,align=left},
        column 4/.style={anchor=west}] (skills) {
        \cvSkill{5} & MATLAB           & \cvSkill{5} & \LaTeX \\
        \cvSkill{4} & Python           & \cvSkill{4} & VHDL \\
        \cvSkill{4} & Microsoft Office & \cvSkill{4} & macOS \\
        \cvSkill{3} & C, C++           & \cvSkill{3} & Electrical Engineering \\};


\node[below=0.6cm of skills.south west,sectionTitle] (title 4) {\cvSection{References}};
\node[left=\cvTimeDotSep of title 4,headerIcon] {\faLink};
\node[below=0.6cm of skills.south west,sectionTitle] (title 4 dummy) {\phantom{\cvSection{Education}}};
\begin{scope}[on background layer]
  \draw[line width=2pt,cvColor] 
    let \p1=(title 4 dummy.south west), 
        \p2=(current page.east) in 
    (\x1,\y1-0.1cm) to (\x2,\y1-0.1cm);
\end{scope}


\matrix[matrix of nodes,
      below=0.6cm of title 4.south west,
      anchor=north west,
      column sep=6pt,
      row sep=6pt,
      every node/.style={Text Depth=tdRefs,anchor=west}] {
      Jane Smith           & \\
      Company ABC Co. Ltd. & \\
      Job title            & \\
      Street lane 2        & \\
      B-1150 Brussels      & \\
      +1 781 555 1212      & \\};

\end{tikzpicture}

\end{document}
