Software Engineering in WordPress, PHP, and Backend Development

Category: Notes (Page 49 of 50)

Notes on programming-related problems that I’ve encountered while working on various projects.

Helper Function For Registering JavaScript and Stylesheets with WordPress

If you wish to register WordPress JavaScript and/or stylesheet dependencies, the API provides functions that make this easy – it’s straightforward both for JavaScript and for stylesheets.

Whenever you’re doing any kind of work in which you find yourself making frequent calls to these functions, it may help to include a helper function to make it a bit easier.

Here’s an example function that I’ve used in a few of my projects:

Continue reading

Moving a git repository with git bundle

For the most part, I’ve been doing all of my development on SlideNote out of a git repository located in an arbitrary directory on my hard drive.

Recently, I needed to move several projects to another location and since I had several changes that I’d yet to commit, I wanted to move the repository while keeping all of the changes intact.

Here’s how to do it using git’s bundle command:

Continue reading

Uncle Bob Martin on Software Craftsmanship

For sometime now, I’ve been a big fan of Bob Martin. I’ve found a number of his ideas and approach to software development interesting and actually practical so much so that I wish they’d present some of his ideas in modern computer science programs.

I recently had the opportunity to hear him speak about agile software development, clean code, and apprenticeship. I really enjoyed it.

Here’s a short excerpt from his talk specifically on apprenticeship:

Continue reading

Use The Flickr API To Retrieve a User ID

I’ve been working on a small application that interfaces with the Flickr API in order to dynamically retrieve a stream of photos from a user’s Flickr feed.

In order to retrieve the stream, the user’s ID is required; however, most users are familiar with their Flickr username, not their ID. Services such as IDGettr can be a big help in looking up a user’s ID, but I wanted to roll something into the application that eliminated the need for a third-party service.

Assuming that you have a Flickr API Key, retrieving the user ID based on the username is easy enough.
Continue reading

Local Variables with JavaScript’s Replace

Sometime ago, I was working on a piece of client-side code that needed to encode some data before invoking an Ajax request. Next, it needed to decode the response data.

While doing this, I experienced a nuance in JavaScript’s replace() function that required a little bit of effort in order for it to work with the degree of flexibility I needed.
Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑