escaping pd.set_option hell

How I broke free from pd.set_option (and probably some best practices, too) in my python pandas code.

Read More »

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.

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


Summarize Text Feature High Sierra OSX

Usually I disdain doing the Software Updates on my Mac / iPhone (although, the experience is far better than the process on Windows), but after updating to High Sierra 10.13.4, I was really impressed with a niche new feature: text selection summary.

Here’s a quick walkthrough of where to find it and how to use it:

  1. Select multiple sentences / paragraphs of text (from a website, a document, email, etc). Then right click and enter the submenu for “Services” at the bottom.

Screen Shot 2018-05-24 at 10.16.36 AM.png

2. After selecting “Summarize”, a program called “Summary Service” will pop up in a new window. When it first pops up, it will show the entire selection, but you can toggle the controls below.

Screen Shot 2018-05-24 at 10.29.09 AM.png

3. Summary Size slider

 

Screen Shot 2018-05-24 at 10.51.25 AM.png

Now if only Apple would release a text expand slider so that students can make it to the word count on their essays.