Writing a PHP Client for the Ravelry API on January 21, 2016

Ravelry is, in their own words, “a place for knitters, crocheters, designers, spinners, weavers and dyers to keep track of their yarn, tools, project and pattern information, and look to others for ideas and inspiration.” It’s no wonder so many of TLE’s customers are also “Ravelers”. Several years ago Ravelry created an API so developers could write apps and create integrations that users would love. Classifying myself as more a developer than a knitter, the API piqued my interest. Fast-forward a bit and I’ve created and now open-sourced a couple projects for the Ravelry API.


Parsing Microdata in PHP on May 1, 2015

A couple years ago I wrote about how I was adding microdata to The Loopy Ewe website to annotate things like products, brands, and contact details. I later wrote about how the internal search engine depended on that microdata for search results. During development and the initial release I was using some basic XPath queries, but as time passed the implementation became more fragile and incomplete. Since then, the parser has gone through several refactorings and this week I was able to extract it into a separate library that I can open source.

Sending Work from a Web Application to Desktop Applications on February 21, 2015

I prefer working on the web application side of things, but there are frequently tasks that need to be automated outside the context of a browser and server. For TLE, there’s a physical shop where inventory, order, and shipping tasks need to happen, and those tasks revolve around web-based systems of one form or another. To help unify and simplify things for the staff (aka elves), I’ve been connecting scripts on the workstations with internal web applications via queues in the cloud.


ti-debug: For Debugging Server Code in the Browser on May 16, 2013
I find that I am rarely using full IDEs to write code (e.g. Eclipse, Komodo, NetBeans, Zend Studio). They tend to be a bit sluggish when working with larger projects, so I favor simplistic editors like Coda or the always-faithful vim. One thing I miss about using full-featured IDEs is their debugging capabilities. They usually have convenient debugger interfaces that allow stepping through runtime code to investigate bugs. About a year ago I started a project called ti-debug with the goal of being able to debug my server-side code (like PHP) through WebKit’s developer tools interface.

Comparing PHP Application Definitions on March 7, 2013
While working to update a PHP project, I thought it’d be helpful if I could systematically qualify significant code changes between versions. I could weed through a massive line diff, but that’s costly if many changes aren’t ultimately affecting my API dependencies. Typically I only care about how interfaces and classes change in their usage of methods, method arguments, variables, and scope. I did a bit of research on the idea and found several different questions, a few referenced products, and a short article on the idea.

Path-based tmpfile in PHP on March 5, 2013
PHP has the tmpfile function for creating a file handle which will automatically be destroyed when it is closed or when the script ends. PHP also has the tempnam function which takes care of creating the file and returning the path, but doesn’t automatically destroy the file. To get the best of both worlds (temp file + auto-destroy), I have found this useful: <?php function tmpfilepath() { $path = stream_get_meta_data(tmpfile())['uri']; register_shutdown_function( function () use ($path) { unlink($path); } ); return $path; }

A Generic Storage Interface on March 1, 2013
Websites often have a lot of different assets and files for the various areas of a website - content management systems, photo galleries, e-commerce product photos, etc. As a site grows, so does storage demand and backup requirements, and as storage demands grow it typically becomes necessary to distribute those files across multiple servers or services. One method for managing disparate file systems is to use custom PHP stream wrappers and configurable paths; but some extensions don’t yet support custom wrappers for file access.

OpenGrok CLI on January 21, 2013
One tool that makes my life as a software developer easier is OpenGrok - it lets me quickly find application code and it knows more context than a simple grep. It has a built-in web interface, but sometimes I want to work with search results from the command line (particularly for automated tasks). Since I couldn’t find an API, I created a command to load and parse results using symfony/console and xpath.

Terminating Gearman Workers in PHP on January 14, 2013
I use Gearman as a queue/job server. An application gives it a job to do, and Gearman passes the job along to a worker that can finish it. Handling both synchronous and asynchronous tasks, the workers can be running anywhere – the same server as Gearman, a server across the country, or even a workstation at a local office. This makes things a bit complicated when it comes time to push out software or configuration changes to workers.