Obey the Fist – the movie

Today I was sitting on my couch after dropping my kids off at their mom's house thinking about how I used to be cool. And, you know, I was never "cool", just now that I'm 46 and past any possibility of having my dreams of coming across as "reluctantly cool once I grow into it…" fulfilled, I started reminiscing on some cool things I've done in the past.

This thing I do, revisiting my cool days which only ever existed in my self-observations, isn't new, just increasingly validating all the choices I've made in life that have been right while never directly benefitting me in any way.

  • First things first
  • Second things second

$8.00 Blog Posts

You can get a domain name pretty cheap, so I do it all the time. I have domains like dysturban.com, plannedparenthood.co, kaitmoon.com, lostinplace.co, bipolar.fun, and johnston.io just to have them.

I’ve done very little with them in general, but I think I’m going to give each of them a purpose. A blog post or some random art.

I dumped facebook a few months ago and it’s been an amazing stress relief. But I miss posting funny, important, or random things. I could do 2 posts a month, each on a unique domain I own that is otherwise unused.


Native macOS app to run PHP scripts

Ok, first

Many, many years ago, as an open source PHP and WordPress developer, I had a system for testing arbitrary PHP as I honed my skills and learned new techniques. I had a file on my web server called test-php.php that did nothing but output the results of my code and would spend hours writing code, upload to server, switch to browser, refresh. This is how I learned the basics of regex, converted base64, tested operators, and refined my database access techniques.

On a bored and underutilized day in 2012, I decided to figure out how to write an app to simplify the process. I had similarly written two apps previously, the first of which was a rip on a crazy flub by the Mitt Romney campaign when they released a campaign app called, “I’m with Mitt!” which would overlay Mitt Romney Oh ’12 campaign slogans on live photos. Hilariously, their developers failed to QC it thoroughly, ending up with a silly typo on the main overlay which draped the photos, meant to be shared socially using the app’s built-in functionality, with the slogans, “A Better Amercia” and “I’m with Mitt”.

That was not typo in my post. I know how to spell America. So, being smart like I am, I built an app that did the exact same thing. Except I misspelled “Mitt” as “Milt”. I called it “I’m with Milt” and overlookably misspelled something in every overlay.

My other app converted dates to other calendar systems (it was mainly a countdown to the end of the Mayan calendar). This app I called, “ΩiStars” (Oh my stars?) I worked on it for months, but it was so dependent on icons and graphics that when I went to replace the placeholders I had relied upon during development, by December 12, 2012, I still had not worked everything out. I questioned the demand for such an app after the Mayan calendar ended.

It took the better part of the day, but I eventually found all the right resources, sample code, and Xcode tutorials to land on a solution. I posted about it on HariKari.com because I had spent so much time figuring this out when, in the end, it was so simple.

Shortly thereafter I saw apps popping up in the Mac App Store with names like “CodeRunner” and “PHP Runner” and “Test PHP”. My code was so basic and these apps were so much better that I quit using my own.

Recently, though, I’ve needed something more specific to my own dev environment. So I pulled up that old Xcode project and, surprise!, it won’t build. I can’t even figure out how to fix it, either. So I went on a Google safari once again to build the whole thing from scratch.

That’s when I found the always impressive and curious-developer-oriented, RayWenderlich.com tutorial for using NSTask in modern Swift. It’s so much simpler than the original app I cobbled together for personal use and I was able to create a new app with far fewer lines of code and a much more sensible and human readable syntax!

So, first visit RayWenderlich.com and follow the excellent tutorial. It lays out basic details and gives a solid description of how and why this works. Their tutorials are written with people like me in mind – someone who codes for a living, but whose day job does not satisfy the most exciting boundaries of his curiosity:

NSTask Tutorial for OS X

The results (copied from the README):

Behold: Swift-phpRunner

Download project files on Github.com

What is it?

Sample code for running PHP scripts inside a macOS app. Has a very simple and basic UI consisting of a split scroll view and a button.


Enter PHP code in the top view and see results in the bottom view.

Uses macOS default PHP

For simple protability, uses default PHP binary included with macOS. However, it is possible to embed a PHP binary, custom php.ini file, and PHP extensions.

Custom PHP binary

Compile php (or just add your existing PHP binary, usually located at /usr/bin/php):

Then set the path to your custom PHP binary’s bundle resource location:

let path = Bundle.main.path(forResource: "php",ofType:nil)

Custom php.ini:

From PHP documentation:

You can specify the php.ini file in command line by using the following syntax:
php -c [Path to php.ini file] [Path to .php file]

For example:

php -c /etc/php-alt/php.ini /var/www/public_html/example.php
Now the example.php file will run with the configuration set in the php.ini file located here: /etc/php-alt/


Add your custom php.ini to your Xcode project.

Add -c to the NSTask arguments list:


Then add the path to php.ini within your bundle to the arguments list (arguments are added to the command in order):

arguments.append( Bundle.main.path(forResource: "php",ofType:"ini" ))

Additional functionality.

You’ll have to figure out how to set the paths used for extenstions in php.ini separately, but send me a note if you have a solution I can include here. Would be interesting to get xdebug output.

Also, php errors go to the Xcode console log. Would be fun to display them in the app.


NSTask functionality cribbed with comments from: https://www.raywenderlich.com/125071/nstask-tutorial-os-x

Syntax highlighting from the super simple and bare bones Macaw (not PHP syntax, but C-like and very easy to understand – a few tweaks and it’s fine for PHP): https://github.com/kuyawa/Macaw

And this is a much simplified version of something I put together in Objective-C many years ago:http://www.harikari.com/technology/how-to-run-php-scripts-in-xcode-mac-os-x-application.html

Daniel Tammet

This guy fascinates me. He seems so self-aware and capable of explaining his understanding of himself to the rest of us. I once read an article written by a neurosurgeon who suffered a stroke and recorded her experience as it was happening. I love it when people can express their own amazing weirdness in a way that makes sense to those of us who haven’t been through the same thing. It’s the definition of genius to me.

I read one of his books a whole bunch of years ago, “Born on a Blue Day”. Afterward I memorized π to 75 digits over the next couple of days. I used telephone area codes I had memorized at one of my first jobs, home phone numbers I remember from my childhood, family members’ birthdays, and ZIP codes to find the most memorable patterns, and then when nothing matched I just thought to myself, “oh yeah, the bunch of numbers that don’t mean anything…” But it only stuck with me for about 2 weeks. I had to recite it every day, several times to hold the numbers but it was almost completely gone a week later and forgotten 2 weeks later. Well, not completely. I still remember it out to about ten digits. 

3.1 easy. 415, San Fransisco area code. 926, kind of like the 976 porn phone numbers from the ’80s. 535, 5 seven times. I don’t remember any of the rest of it, but I learned about finding meaningful patterns in noisy number trails as part of this exercise.