Todo: Self Host Blog

At some point, I really hope to migrate this blog from WordPress to a fully self hosted, designed and written implementation of this humble blog. My ambition to accomplish this is probably just a manifestation of my OCD and desire to have more control over the content and how it’s presented.

If you’ve ever done this, I would love to hear about the process and method by which you ultimately did it. I have thought about using a static site hosted on S3 or some of the Django packages for CMS / blog hosting, but have so far failed to settle on either.

The front end is often something I shy away from, but I’m hoping when I eventually take on this project, it will hit a critical mass and allow me to break out of my hesitation and into continued progress as a developer.

Advertisement

Ordinary Data Structures: Python3’s deque to Store Recent Emojis

Recent Emojis

if the implementation is simply the most recently used 30 emojis, then some sort of ordered iterable array-like structure would be best suited to the problem. Since 0 index insertions are an important requirement, Python’s built in deque data structure would be a good candidate to use here.

deque is found in the collections library and accepts an array-like input of values along with an optional keyword argument named maxlen which specifies the maximum length of the data structure. This last part is ideal for this application, as Apple’s implementation limits the recently used emojis to 30.

from collections import deque

recent_emojis = deque([], maxlen=30)

def update_recent_emojis(emoji_used, recent_emojis : deque):
    if emoji_used in recent_emojis:
        recent_emojis.remove(emoji_used)

    recent_emojis.appendleft(emoji_used)
    return recent_emojis