Here are some code snippets I use often in my work and am happy to share. Code snippets are offered  in LateX, Python, and STATA which are my main daily drivers for research.

  •    Document Preamble

    This is my general preamble I use for all my documents. It loads up every package I might need to use, defines a few new commands to manage to-do lists in the document, and uses biblatex which is more flexible than natibib. See this description to learn more.

  •    Beamer Preamble

    This is what I use for all my presentations. I adapted code from several sources in an attempt to create a clean format that still retains the nice aesthetic look that LaTeX has. See here for some sample slides.

  •    Send Yourself an Email

    This is a simple function definition that enables you to make your code send emails to you letting you know about the progression of the current running script or if an error occurred. I used two very helpful references in writing this (1, 2) and I think I made it modular enough to fit in other projects. Here is an explanation on how to use it. If you wish to skip the explanation just make sure if you a Google App KeyRead a description about this code snippet here

  •    Regression Output

    STATA allows the user to export estimation results in multiple formats. This code snippet uses estout and gives the user quite a bit of freedom in terms of constructing a regression table. Use it as is or use it to get a better sense of the flexibility of estout.

  •    Classify Neighbors 

    This code defines a program which takes inputs produced in ArcGIS and used them to classify the neighboring relationship of different spatial units. The user can choose the maximum neighboring degree, meaning if the program returns only the nearest neighbors, the neighbor of the neighbor, and so on. A full documentation with instructions on how to produce the necessary files in ArcGIS can be found here.