Skip to content

Instantly share code, notes, and snippets.

--- public/js/ace-1.2.5/ace.js 2018-10-19 12:19:28.000000000 +0100
+++ public/js/ace-1.2.9/ace.js 2018-11-07 19:12:36.000000000 +0000
@@ -960,7 +960,7 @@
if (!doc)
doc = document;
return doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement;
-}
+};
exports.createElement = function(tag, ns) {
@jpallen
jpallen / gist:91bdfa1fd85d9fb76cead604bdd191ee
Created August 21, 2017 16:08
GPG public key (james.allen@overleaf.com)
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFmbBPgBEACiy0ildAI/GQyC+SpKdswu5RgHCyFytHUK8v2s9nT3jRyHCGhr
zri//dN/m2OJK8vY7SU/QuGVXvfI3if0q3ClULi/0o9BqQH5VKBjU2miSPclSMRG
34fLhkIzz8hc7UhZrJ6CFtD/HKY2sWQSS1LqgC30prf9SIWGKRJPiw5v1nBpUXOt
GZPbxUMAjHD/S853GeZ28gphzRHlio0lI3/X/GSs7ioOrbqgMPXZp1whZfZUZqlc
FFj9EkxbxFV77ZgCKXIQatiFyeJEbUbwT1K5Y2jMLrd74cF6G8luXu96RBB62SNl
hsT/f5Tynzd1T1lgot3PLrc/A5YzCU6zwrVGtN07hqUEyrxndtKULxfs2om+ELNK
NeRNX9fe03kgnKznxahpWiTakBGjsXyfbDhzPmf14yVZL3egO17MhRLwt/i5VFSc
La9NJ1gbeRex5cangy8sWay4Sm3TEm6rCONVUR3s6ac8vKwAlmy1ISLg37Mhbrwi
@jpallen
jpallen / foo.txt
Created June 25, 2015 13:27
Test gist
Hello world 2
@jpallen
jpallen / errorhandling.js
Created October 10, 2012 13:26
errorhandling
function respondWithError(response, namespace, message, status) {
if (!status) {
status = 500;
}
console.log(namespace, message);
response.setHeader('Content-Type','application/json');
response.writeHead(status);
response.end(JSON.stringify("Missing guid"));
}
@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

@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.
\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}
\newcommand{\datedsection}[2]{%
\section[#1]{#1 \hfill #2}%
}
\newcommand{\datedsubsection}[2]{%
\subsection[#1]{#1 \hfill #2}%
}
\titleformat{\subsection}
{\large\scshape\raggedright}
{}{0em}
{}