thisishardtoread

code, thoughts, and learnings

github.com/arbylee

JavaScript Date, joda-time and Daylight Savings: How our users got a day older

08 May 2016

My team and I recently encountered an issue where several, but not all, of our date fields were being displayed one day off from what was stored in the database. The cause wasn’t immediately obvious and led us down the rabbit hole of dealing with Daylight Savings.

iOS crashing, Android flickering and webkit-backface-visibility

21 Mar 2015

I was recently troubled with a web application crashing on older iOS devices without an obvious cause. We were loading a page with several tiles of content, and it would either crash as the page loaded or if you happen to scroll down the page too quickly.

Logging to both a file and stdout in Python

03 Nov 2014

If you have a set of log messages that you always want sent to both stdout and a log file, you can easily set up a python logger to do exactly that:

Parsing command line options in Python

30 Apr 2014

Despite the prevalence of graphical interfaces and the growing demand for stunning visualizations, sometimes the simplicity of a command line client is all you need. Fortunately with Python’s argparse, you can quickly pull one together with short/long name aliasing, spiffy help text, and other familiar command line features. However, the docs can be a lengthy read, so here’s a quick rundown.

Python Warrior!

12 Feb 2014

Several months ago I was introduced to Ryan Bates’s ruby-warrior project, and I had a blast playing through it. If you haven’t seen it before, it’s a “game designed to teach the Ruby language and artificial intelligence in a fun, interactive way.” You progress through the game by writing Ruby code which determines your warrior’s behavior. If there’s an enemy monster nearby, will you attack it? Will you walk around it? Will you stand there and let it pummel you to death?

Blacklisting websites with /etc/hosts and apache mod_rewrite

20 Jan 2014

I’ve noticed over the past few months that my Reddit consumption has continued to grow, shrinking the time I spend on side projects and other activities. So, I’ve finally decided to cut Reddit out completely.

Packaging and distributing a Python project with setuptools

21 Dec 2013

Scenario: You want to package your Python project for others to retrieve via pip install your_project

Mimicking Ruby yield in Python

12 Dec 2013

Recently, I’ve been working on converting Ryan Bates’s ruby-warrior into python. Most of the conversion into Python is pretty straightforward, but occasionally there’s a piece of code that takes a moment to work out.