Skip to content

Instantly share code, notes, and snippets.

@tommyip
tommyip / fizzbuzz.erl
Created August 9, 2016 11:16
FizzBuzz test with no conditional statement in Erlang
-module(fizzbuzz).
-export([fizzbuzz/0]).
fizzbuzz() -> N = 1, fizzbuzz({N rem 3, N rem 5, N}).
fizzbuzz({N3, N5, N}) when N =< 100 ->
case {N3, N5, N} of
{0, 0, _} -> io:format("FizzBuzz~n");
{0, _, _} -> io:format("Fizz~n");
{_, 0, _} -> io:format("Buzz~n");
@tommyip
tommyip / in_nD_list.py
Last active November 2, 2016 21:14
Check if element is in a non-uniform N-d Python list [Python]
def in_nD_list(search_list, key):
for element in search_list:
if isinstance(element, str):
if key in element:
break
else:
if in_nD_list(element, key):
break
else:
return False
\usepackage[margin={2cm, 2cm}]{geometry}
@tommyip
tommyip / blog_latex_multicol.tex
Last active September 18, 2017 08:52
Multicol package
\begin{document}
\begin{multicols}{2}
\lipsum[1-5]
\end{multicols}
\end{document}
\begin{document}
\begin{multicols*}{2}
\lipsum[1-5]
\end{multicols*}
\end{document}
@tommyip
tommyip / blog_latex_title.tex
Last active September 18, 2017 08:56
LaTeX title for single page documents
\title{\vspace{-2cm}Writing single page documents in \LaTeX}
\author{Author name}
\begin{document}
\maketitle
\end{document}
% Put this at the top of the document
\pagenumbering{gobble}
\usepackage{siunitx, float, booktabs, caption}
\begin{document}
\maketitle
\begin{multicols*}{2}
\begin{table}[H]
\captionsetup{singlelinecheck = false}
\begin{tabular*}{0.5\textwidth}{@{\extracolsep{\fill}} @{}lll@{}}
\toprule
\usepackage[hyphens]{url}
\begin{document}
\begin{multicols*}{2}
Lorem ipsum\cite{lorem_ipsum} dolor sit amet, consectetur adipiscing
elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi
ut aliquip ex ea commodo consequat.

description: Award-winning tutorials, tips and advice on GCSE French coursework and exams for students, parents and teachers. keywords:

  • GCSE
  • gcse
  • help
  • learning
  • learn
  • French