Skip to content

Instantly share code, notes, and snippets.

\documentclass{my_cv}
\begin{document}
\section{Education}
\subsection{University of Nowhere}
\section{Work}
\subsection{ABC Limited.}
\LoadClass{article}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{my_cv}[2011/03/26 My custom CV class]
\RequirePackage{titlesec}
\titleformat{\section} % Customise the \section command
{\Large\scshape\raggedright} % Make the \section headers large (\Large),
% small capitals (\scshape) and left aligned (\raggedright)
{}{0em} % Can be used to give a prefix to all sections, like 'Section ...'
{} % Can be used to insert code before the heading
[\titlerule] % Inserts a horizontal line after the heading
\titleformat{\subsection}
{\large\scshape\raggedright}
{}{0em}
{}
\newcommand{\datedsection}[2]{%
\section[#1]{#1 \hfill #2}%
}
\newcommand{\datedsubsection}[2]{%
\subsection[#1]{#1 \hfill #2}%
}
\documentclass{my_cv}
\begin{document}
\section{Education}
\datedsubsection{University of Nowhere}{2004--2008}
I attended the University of Nowhere from 2004 to 2008.
\section{Work}
\datedsubsection{ABC Limited.}{2008--Now}
@jpallen
jpallen / gist:2762417
Created May 21, 2012 13:49
Add a .findOrBuild() method to Backbone Models
// Finding and creating models
// ===========================
//
// We might need to get a reference to a model from anywhere in our code
// and we want to make sure that these references all point to the same model.
// Otherwise updates to one copy of the model won't affect another.
//
// The methods here let you get models through a wrapper that will either
// create the model if it doesn't exist anywhere, or return a reference to
// the existing model. E.g.
@jpallen
jpallen / unit-testing.md
Created August 24, 2012 14:02
Unit testing has made me a better programmer

This post is blatant rip-off of the post Backbone has made me a better programmer by Andy Appleton. His message is excellent and I encourage you to read it, but I wanted to show that writing well structured and decoupled code is something that can be learned from unit testing as well as Backbone. Unit testing will force you to write good code and this is a very strong reason why you should be doing it!

I started unit testing about a year ago and have since used it on large and small projects at work and for fun.

These last two months I have been refactoring some JavaScript on ShareLaTeX and I was really surprised at the state of the code I had written not all that long ago. I have been rewriting it to use a number of design patterns that I have necessarily picked up from unit testing.

One object one responsibility

We all write clean encapsulated ob