The “three R’s” of Web Development

I recently found myself rewriting a navigation element for the sixth time. As I did so, I silently cursed my past self. My laziness in the moment was to blame. This quickly shifted, as it often does, to excuses and outside blame.

Blame on my tools for failing to provide me a good way to store my HTML and SASS, blame on the designer for making the navigational elements slightly different between the websites, and excuses like “I’m probably not saving much time, anway”.

Pushing aside my outward facing critical thoughts, I decided to do the grown up thing and establish a method for creating modularity. Already I had a starter Git repo that I cloned whenever beginning work on a website. This provided the loose scaffolding that I needed to hit the ground running. It didn’t seem appropriate, though, to include the navigation in the scaffolding. One version of it, maybe; but I had a good half a dozen variations!

This was a pain point. A real issue that I had run into time and time again. What’s the answer? Code snippets.

Code snippets have been around for ages, used by programmers to store oft reused portions of text. IDE’s usually have a way to manage them, and there are usually a number of desktop applications designed to manage them.

But in order for this to be truly scalable, I needed categories, I needed bundles and I needed it to be accessible from anywhere. This was the kind of thing I wanted my fellow developers to be able to curate and collect from years from now.

So what fulfills all of those lofty requirements?

For me, it was Gists. The concept behind a gist is stupidly simple. You login, you title your document, you give it a file extension, you give it an optional description and you upload it. Just like that.

Simpler than Github. Less verbose. Almost like Pastebin for code.

I was already in the Github evironment, so the move was effortless. Now all I needed was a fast way to access it. I use PHPStorm as my primary IDE, and I discovered a plugin called MAGist. It provided me with a very basic GUI, so that I could grab my code quickly and easily. If you don’t use PHPStorm, there’s one for Visual Studio Code , and even one for your command line.

You can have multiple files in one Gist!

Categorization? Check. Easy access? Check. Accessible from anywhere? Check!

And it’s handily solved my issues. From now on, I write a variation and I save it, then I reuse it. If I make modifications, I save those for later, as well. And with a snap of a finger, I can bring it back into my project.

Back