Category Archives: Programming

Following Directions (repeatedly)

5pipspuzzleRLLRLRLRLLLRLRLRRLLLLRRRLRRLRLRR

I found a web page containing some JavaScript I made late last year while cleaning the icons off of my desktop. I’m not sure exactly what inspired me to make it. The page I made said it follows the principle of “three rights make a left”. So maybe I got the idea when I missed a turn while driving.

The application is very simple, and in fact reminds me of a very limited type of Turtle Graphics.

Continue reading Following Directions (repeatedly)

Matching braces in a string

I heard recently about an interview problem involving matching braces in a string. Checking to see if all the braces in a string are paired up in the proper order. Seemed like an interesting, and short, challenge.

Examples of strings with proper brace matching: "()", "(){}[]", "([{}])"

Examples of strings without proper brace matching: "(", "[]]", "([)]"

Continue reading Matching braces in a string

Building a reddit bot

It’s spoiler time for the upcoming Magic: the Gathering set. During this time a lot of images get posted to reddit. Unfortunately a lot of people can’t see those images because magic.wizards.com is blocked for them. Imgur however, often is not. I happen to be one of those people. Whenever I would see a post about a new card I would click it only to see that the content is blocked. Then I’d check the comments to see if anybody re-posted it on imgur, most of the time nobody had.

I figured this would be a good opportunity to try to create a bot that does just that!

Continue reading Building a reddit bot

Converting minutes into a readable string

I’d like to start posting some shorter entries. Hopefully that will be more conducive to making posts more often. I’m going to start tagging these as Short Code entries.

For this first one I came across a challenge on reddit about converting a quantity of minutes into a readable string, paraphrasing here:

Write a function that takes in a number of minutes as an integer and returns a string of the format “# years, # months, # days, # hours, #minutes”.

Continue reading Converting minutes into a readable string

Getting Reddit Front Page Links on Android

Recently I got an idea for a mobile app which has sparked my motivation to learn how to make apps for Android. So I headed to the developer page and downloaded Android Studio. It’s been so long since I attempted programming anything for Android, the last time I did it was still done with ADT and Eclipse. So I’m pretty much starting at square one here. Unfortunately I ran into several problems just trying to get a simple “Hello World!” app to build and run. I could probably write a post just about setting that up.

The first test program I wanted to do was to try reading data from a website. The front page of Reddit seemed like a good candidate, so I went for that.

Continue reading Getting Reddit Front Page Links on Android