logoBrett Rawlins

Blog

37 Posts
April 26, 2024

Rotate images in Go

Problem While working on an image upload service, I noticed that sometimes images got saved with the wrong orientation. For example, you…

April 14, 2023

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…

August 22, 2021

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…

June 4, 2020

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…

May 27, 2020

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…

January 21, 2019

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…

July 20, 2018

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…

November 12, 2015

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…

November 11, 2015

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…

August 18, 2015

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…

August 10, 2015

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…

March 27, 2014

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…

February 25, 2014

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…

February 24, 2014

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…

February 14, 2014

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…

February 11, 2014

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…

February 7, 2014

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…

February 6, 2014

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…

December 23, 2013

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…

November 25, 2013

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…

November 16, 2013

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…

November 12, 2013

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…

September 30, 2013

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…

September 16, 2013

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…

September 12, 2013

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…

August 28, 2013

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…

August 28, 2013

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…

August 24, 2013

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…

August 23, 2013

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.…

August 9, 2013

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…

July 30, 2013

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…

June 29, 2013

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…

June 17, 2013

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…

June 12, 2013

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…

May 31, 2013

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…

May 28, 2013

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…

April 2, 2013

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