Author: Gregory Doran
Published: 23rd March 2021
As a software developer I love working with different tools and programming languages. Often you can end up switching between these day-to-day depending on the project and priorities. Programming languages can be different in a lot of ways, including syntax, how they are compiled and how certain technical details like memory management work. Tools such as integrated development environments or text editors can have different keyboard shortcuts and commands.
When switching between projects it is easy to get caught out by these subtle differences and so you might end up Googling simple things, for example, how to iterate over a dict/hashmap in Javascript after having worked on a Golang project for a month. What you're often looking for in these situations is a few pointers or examples of how to do certain things.
I enjoy a cup of tea or coffee. Whenever I'm working there is a mug on my desk. Either awaiting or containing a hot beverage. It is probably fair to say this is common in most office based professions.
In order to solve this problem I have designed a mug crammed with as much quick reference information as possible. It sits on my desk where generally a hot drink is on-hand before 3pm and if I need to look up something it might save me a Google search! It's not an original idea, there were a few around back-in-the-day. However, some searching failed to find one that really crams as much useful information as physically possible and looks good.
For the first mug the subject is the Linux command line. Why? Well...
If you are looking to create merchandise like this there are increasingly more companies able to create products with your designs. For this my initial choice was Red Bubble . I had purchased a gift from them before and the recipient was happy with it. They have good guidelines on what dimensions work best for different products, so all I had to do was create an image of that exact size, upload it to their website and order it.
So that it is possible to make more of these designs with minimal effort I wanted styling to be decoupled from the content. HTML and stylesheets (CSS) is what we typically use for websites. CSS to provides styling, AKA how things look, and HTML contains details about the content. When it comes to making a change to one of the quick reference snippets it is just a matter of changing the HTML. On the other hand, if the background colour was to be changed only the stylesheets would need a small update.
To generate the individual mugs' designs what I actually created was a static "website" that could be rendered into an image as part of a pipeline process.
Although the web-page for each mug would be static there is a need to introduce some dynamic elements. This is to limit repetition in the code and allow templates to define the layout. For this I have used Nanoc a static site generator in Ruby. Nanoc allows for the following:
So whenever I make a change to the design or content of the mugs I run
nanoc compile
and the static content for the site is generated. This is a simpler and cheaper to host than
server-side dynamic websites using, for example, PHP, Ruby on Rails or Java. You can still
create a great website, host it cheaply but with some limitations on interactive elements.
In fact this website is generated using Nanoc and uploaded to an S3 bucket. As a result it's
super cheap to host.
The mug's static content is defined as snippets using specific CSS classes and code examples
using
<code>
elements in HTML. Optionally,
<span>
tags are thrown in to apply semantics, such as emphasis on the
command the snippet is for and values that should be substituted. There are some layout
specific elements to arrange the mug into four columns and to fit two snippets next to one
another. Essentially all the hard work on
the design for this mug can be reused for the next.
In order to get the content right and typo free I printed the design onto paper, cropped and cello-taped it to an old coffee mug. This allowed me to try the snippets as intended as well as write notes and corrections directly on it. What became clear from doing this was that light text on a dark background, standard with old-style terminals, does not work well when printed. I used this prototype for a couple of weeks. Once happy with the design it was uploaded and an order was placed.
After placing the order my new mug arrived a few days later. It has been in regular use ever since and overall I am very happy with it. The intention was to have a link to buy these with this update, however the mug that Red Bubble sent me had some pretty bad smudges at the edges... So before that happens I need to try some other websites.
Even if you know most of it there might be something on there you look at which is new or you might need a refresher on. If you return to the Linux terminal after a long hiatus you can just whip out this mug, fill it with your favourite beverage, and have a quick refresher on how to redirect stderr to stdout.
I hope to find out if it can be used as a learning aid to someone relatively new to the field. It would have helped me when I was 22 straight out of uni get to grasp with some practical examples.
A possible concern is that the sheer amount of snippets and their shorthand nature may overwhelm or be useless. I personally prefer to learn from doing and first-principles. It would be good to get feedback on this aspect.
I plan open some channels for feedback and perhaps do polls on what future mugs should cover as subjects and possibly setup a Pateron page... Buying these mugs would be a fantastic way to support this ongoing work.
There were a few things that crossed my mind whilst doing this:
With that last point in mind the tools for generating the mug designs could be open-source, ideally with a license that wouldn't prohibit them from being sold in order to support the designers/developers working on it. They would be much better with the combined wisdom of a community of developers. Other people working on these designs would open them to corrections including when they become out of date.
Once the initial mug is available to buy I would like to make another one. Here are some ideas for which subjects to do next, but I'm open to suggestions so please get in contact if you have some ideas:
Please contact me here or on Twitter if you have any thoughts or ideas on this.