Archive for August, 2009

Git, Capistrano, SSH, and WordPress

Update: This tutorial has been updated! Several bugs have been fixed, please be sure to read all of the updates (especially if you’ve referenced this tutorial before).

Also, there is now a gem to help with the deployment script. Please visit the new tutorial after reading this one for more information.

I’m not going to lie: lately I’ve been on quite the WordPress-kick. I love being able to create a design, cut it up into HTML-ready chunks, and then use a standard WordPress template to get it into production and on the web ASAP! Generally, my workflow looks like this:

  1. Create the design
  2. Cut it up for a web layout
  3. Create a sample web layout and test across browsers
  4. Cut the HTML up into a standard WordPress template
  5. FTP the design to a WordPress install (into the wp-content/themes directory)

Continue reading…

Sanitizing Phone Numbers With C#

An extension method to remove all but digits from a phone number. This should be useful for sanitizing input to put into your database.

using System.Text.RegularExpressions;

namespace CustomStringMethods
{
	public static class PhoneNumber
	{
		#region Class Methods

		public static string StripAllButDigits(this string s)
		{
			return (s == null) ? string.Empty : Regex.Replace(s, @"\D", string.Empty);
		}

		#endregion
	}
}

Obviously this can be used for more than just phone numbers.