logoBrett Rawlins

Blog

36 Posts

Regular expression for international names

Today I learned something new about regular expressions. Credit goes to Matt Montgomery for sharing this with me! Problem: I was using a…

Taking back my data

Recently I finished a big project that took a few months to complete. I decided to migrate all of my family's data away from Google products…

Formatting dates in Gatsby

The problem My blog post dates are stored in this format: "YYYY-MM-DD", but I wanted to display them in a different format. My first…

Trying out Gatsby

Lately I've been feeling like I should start blogging again, but the site needed some love first. As they say, "The cobbler's children have…

Install fonts on ubuntu

The other day I needed to install some fonts on our ubuntu server that were needed for an email script. Not something you do every day, so I…

Clean up local git branches

Branch cleanup is a constant housekeeping item. To make things easier I've been using this script: pruneLocalBranches.sh It checks to see…

React starter project with webpack and PHP

I've been delving into React lately and have started to use it more and more for projects. Previously I was using Gulp to run my builds, but…

React component for SVG icons

A day late and a dollar short I’ve been using React v0.13 which has some trouble handling SVG elements. Last month I decided to create a…

Simple chat application in PHP using Ratchet

In the previous post I made a demo chat app using React and Socket.io. In this post we'll build that same app again, this time in PHP using…

Simple chat application using React and Socket.io

From Angular to React Life has been busy! It’s been a while since I had time to blog about anything. Hopefully I can find time to come back…

Delete files older than N days on Linux

Today I needed to delete a bunch of old log files to clear up some room on our server. Here’s a handy shortcut that I found to delete any…

Import tags from a CSV

Recently I needed to add a large list of tags to a WordPress site. The tags were in a spreadsheet, so I converted it to a CSV file and then…

Apache redirect vs. rewrite

Apache rewrite rules can be very confusing at times. They're very powerful, but not easily understood or mastered. I don't claim to be an…

Restore selected posts from a backup

Recently at work we had a situation where we needed to roll back to the previous day's backup of our WordPress site to undo some changes…

Sorting and filtering on custom columns

This is a 2-part post discussing how to set up custom columns for a custom post type in WordPress. Part 1 focuses on adding custom columns…

Adding custom columns (including the admin links)

This is a 2-part post discussing how to set up custom columns for a custom post type in WordPress. Part 1 focuses on adding custom columns…

Trigger onSelect from today button in Datepicker

The jQuery UI Datepicker widget is a handy way to add a calendar control to a web page. It's pretty easy to implement and offers a lot of…

Demo plugin for using WordPress Settings API

I spent a lot of time recently figuring out the Wordpress Settings API. Although there are still parts of it that remain shrouded in mystery…

Removing unused tags in Wordpress

Sometime you may need to mass delete a bunch of tags that are unused (or maybe only used once). I'm sure there are plugins for this, but…

The right way to do an ajax post in Wordpress

For a long time making ajax calls in Wordpress was very confusing to me. After reading the Codex and several articles about it, I think I…

Fixing "$ is not a function" in Wordpress

I couldn't figure out why I was getting this error on a Wordpress site the other day: Error: $ is not a function After searching a bit I…

Proper-casing names when they are stored in all caps

Reformatting names is generally inadvisable, because no matter what you do you'll be wrong. Names don't follow rules consistently (or at all…

Using Twitter's typeahead.js

I decided to try out Twitter's typeahead.js the other day. It was bit confusing at first because I kept finding examples and tutorials that…

Filtering Kaltura list results

Kaltura is a video platform and content delivery network (CDN). The Kaltura API is powerful but poorly documented, so usually it takes a lot…

Using Google web fonts

Today I tried switching a website to web fonts. It was pretty easy to implement using Google Fonts. 1. Choose a font Go to Google Fonts and…

Git branch workflow

I have three environments: local (development) test production Usually you want to try out a new feature and then test it out on the server…

Simple Database Connections

The other day I had to explain to someone how to connect to a MySQL database in PHP. It was a good reminder. Here's a simple example using…

Display an RSS feed using the Google Feed API

Some time you may want to grab an RSS feed from another site and display it on yours. Here's how you can do it using the Google Feed API.…

Where to put your custom WordPress functions

I found a great WordPress tip while reading some articles today. Often when you're trying to solve a problem you'll find code snippets in a…

Import a database from the command line

Sometimes you need to import a large database that exceeds the size limits imposed by phpMyAdmin. You can change some settings in your php…

Limitations of WP_Query

I ran into one of the limitations of WP_Query recently when I realized it couldn't do a fairly simple query. Problem I wanted to get all the…

MySQL SSH tunnel

If your MySQL server is configured to only accept local connections, then you can't connect remotely by just specifying the hostname in your…

Tools for multiple monitors

I love small focused apps that do one thing, and do it well. Here are a few that I discovered recently that come in handy when working on…

CSS background patterns

CSS is getting more and more awesome all the time. The other day I discovered that you can create background patterns using the property…

Passing checkbox (boolean) values in ajax

Problem: I was reminded today that JavaScript boolean values don't translate well to PHP. Here's an example. Say you have a form with a…

Setting up dynamic virtual hosts on your Mac

In the past I've always had to make two entries for every new site I add to my local development environment: a line in my hosts file (so…

Browse by tag