Be a More Efficient Programmer with Lepton

Improve Programming Efficiency Using Open-Source Snippet Manager Lepton

This post was originally published 2-May 2020.

Do any of these pain points ring a bell?

  • I know I’ve written this code before but I can never remember the syntax
  • I’ve visited the same Stack Overflow page 10 times this week
  • What project did I use that code on? Where did I save that again?

Lepton, an open-source snippet manager powered by GitHub Gist, addresses these pain points and more!

As someone relatively new to coding, these pain points come up all the time for me. This wasn’t something I’d really considered when I started my coding path. I was surprised to find that, outside of actual coding skills and knowledge, a huge part of programming is organization. More specifically, organizing past work and the work of others in such a way that you can easily access and reference it (of course, assuming you haven’t already internalized it).

For example, I’m currently working on a project with the aim of predicting a prospect’s likelihood of signing up for a demo. To do this, I’m analyzing CRM data for a private healthcare company. As any data scientist knows, the vast majority of project time is spent cleaning and prepping the data for modeling and analysis. This project is no different.

My challenge thus far has been implementing what I already know how to do when it comes to explore the data. Questions like the following occur far more often than I’d like to admit: what’s the syntax to create a boxplot? How do I key into dictionaries nested in lists nested in dictionaries? How do I impute null values based on a condition?

It’s all relatively basic stuff that I’ve done before. And it’s not like finding the answer to these takes too long. At this point, I’ve become skilled at Googling solutions. But it’s a pain. For me, having 100 tabs open in 5 different Chrome windows is cumbersome. Or, when it comes to referencing my past work, I often know where the project is saved. But it takes a good 20 seconds to track down the specific code snippet I’m looking for. Again, cumbersome and distracting from the task at hand. Not to mention interrupting a train of thought.

This problem isn’t totally new to me. It comes up in one form or another any time I’m working on a project or lab. A good 15–25% of my time is spent Googling or tracking down my old work.

To address it, I’ve tried a number of things from saving code snippets in Google docs to TextEdit to Atom to creating HTML file cheat sheets. None of it stuck though.

That’s when I learned about code snippet managers. The idea is so intuitive to a programmer’s workflow that I kind of felt like a dunce for not having Googled it before and trying to solve the problem from scratch. So it goes I guess. Chalk it up to being a newbie.

Anyway, it comes as no surprise that there are TONS of code snippet managers out there. What I was looking for was simple. My criteria included:

  • Desktop application (to easily access using CMD + tab)
  • Able to access from both web and locally (with syncing)
  • Lightweight
  • Intuitive

After a bit of research, I came across GitHub’s Gists, a built-in feature that allows you to add gists (or snippets) of code directly to your GitHub profile. If you have a GitHub profile, this feature is automatically available to you — simply click here to access your gist home page.

Gists appealed to me for a few reasons. First, It’s already linked to my GitHub profile. This makes it easy to copy code from existing projects on GitHub to my gist repository and vice versa. Second, since every gist is a Git repository I can seamlessly fork and clone other public GitHub repos into it. This saves me the trouble of having to copy + paste code and/or bookmark repos that I want to reference in the future. Third, gists can be both public or secret. Public gists are browsable. This means I can copy someone else’s gist into my profile without having to recreate the wheel. A secret gist means it’s only visible to me and those I share the gist URL with. This is a great way to maintain privacy if the code contains sensitive material.

I still had one problem though. GitHub gist is web-based. Though its functionality and simplicity were exactly what I was looking for, it didn’t address the challenge of tab management. I needed an application that could access locally.

Enter Lepton.

As described on its GitHub repo page, “Lepton is a lean code snippet manager based on GitHub Gist”. It’s free and includes all the basic functionality I needed. It’s a desktop application that syncs with the web-based GitHub Gist repo. It’s lightweight but not overly simple. It supports multiple languages and file formats (including .txt and .md). It supports custom tags, which allows for easy searchability. This checked all the boxes and more.

The way Lepton is organized is super straightforward. You create notes, which are composed of any number of files. You can think of notes like the topic and files as the actual code snippets.

For example, I have a simple “pre-processing” note that is composed of multiple .py files names according to activity, such as “” and “”. In this note, I’ve aggregated all of the code I use during pre-processing. Files come from different sources such as past projects, documentation, and Stack Overflow. Now they’re all in a centralized place. No more opening up new tabs or multiple applications.

This is just scratching the surface though. The way you organize your notes and files is really a choose your own adventure exercise. You can organize them by process (e.g., train/test split for linear regression), general reference (e.g., master reference for library imports), cheat sheets (e.g., SQL 101), … and the list goes on.

I’m excited to dive deeper into Lepton and use it as an integral part of my workflow. It’s already been worth the time investment of organizing my code so I know the return will only be more in the future. As I continue to develop and build out my GitHub Gist library in Lepton, I’ll share tips and tricks along the way!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store