Today a new shirt went up for sale on Cotton Bureau. That happens every day, but today was special, because it was my shirt. Well, my idea, helped along by my wife, inspired by an old developer joke- but you get the point.
The shirt features a ship, front and center. That’s all. It’s for folks that ship code, to wear in celebration of a recent conquest. This shirt is for shippers. Did you ship code today? Then wear this damn shirt.
If you don’t want to read the rest of my rambling, here’s a link to buy the shirt. If you’re interested in the process, stick around- I wrote like 500 words just for you.
I work on the Eastside now and I like to eat, so I figured I should keep a quick list of my conquests. Have anything to add?
Salt and Time – A neighboorhood butcher shop with out-of-this-world lunch and dinner service. They’ve got a full bar, real coffee, and realer meats. The lunch menu is short, but changes daily, and every single item is worth having in your belly. Stop what you are doing and go to Salt and Time.
Cafe Mueller (in HEB) – This may seem like sort of a weird one, the HEB up on E 51st just opened a new concept store, including an on-site restaraunt. Cafe Mueller serves BBQ, pizza, Asian bowls, salads- you name it. It’s mad cheap (check out the full menu) and the building is beautiful.
Qui – This place only does dinner service, but it’s so damn tasty that I had to include it in my list. If you don’t recognize the name, it’s the same Paul Qui that owns East Side King and that recently won on Top Chef. Aside from the ridiculous food, they have a killer bar, which means even if you’re not eating, there’s reason to stop (right after work at 5PM or right after dinner somewhere else).
Gourmand’s Neighborhood Pub – Artisan sandwiches served out of an old tejano dance hall. Fat sandwiches (almost 1lb of food) and killer daily specials. They also serve (and sell) Yellowbird Sauce, a kickass habanero condiment made right here in Austin. It’s got carrots and tangerines and lime and makes an already awesome sandwich even awesomer.
John Mueller Meat Co – Ridiculous brisket, sliced extra thick, bark like I’ve never seen before. Really peppery sauce. All sorts of meats, sold by the pound. Trailer and tents. Opens at 10:30, sells out frequently.
Tamale House East – Simple, authentic tacos and tamales, served from an old house. Tasty cochinita pibil (pork cooked in orange juice). Mexican Coke in a bottle.
Takoba – Simple but semi-upscale Mexican food, served on one of the best patios on the eastside. Amazing cocktails & desserts, just remember they won’t split a check for you.
Yoko Ono Miyaki – Japanese pancake. Not breakfasty, more like a salmon cake, made from thrashed meat (pork belly) and veggies (onions, etc). Topped with bonito flakes (dried, cured tuna). One of the weirdest thing I’ve ever put in my mouth.
I like to take pictures. I like the internet. I like things right now. I like to take pictures and put them on the internet right now. These simple facts have somehow led me to buy three Eye-Fi cards over the years. But today they did something that compelled me to write this post to warn others from making the same mistake.
For the uninitiated, an Eye-Fi card is a smart (well, we’ll get to that in a minute) SD card with WiFi baked in, allowing you to quickly off-load pictures from even the dumbest of cameras. As someone who shot photos from the floor of tech conferences for a living, this appealed to me. So much so that I’ve bought THREE of these fucking things, from the first gen model to the latest Pro card.
Did I want to buy three SD cards? Not particularly. But I wanted to quickly put my pictures on the internet, and while my current Eye-Fi card couldn’t do exactly what I needed, the company was quick to add features I desperately needed- to a new, more expensive card.
The first card I purchased simply didn’t work. The problems were so numerous I won’t even bother to list them here. After I gave up on the “smart” features of the card, I figured I could at least use it as a regular SD card. It corrupted itself in the middle of a trip to NYC, making me decide between taking more pictures or keeping the ones I already had (corrupted, locked on the card).
The Eye-Fi card I purchased most recently cost triple what a comparable (or much faster) SD card runs. It’s supposed to be able to transfer directly to my smartphone or tablet. It works about a third of the time (when I’m lucky).
So what happened today?
Today I got a marketing email from Eye-Fi, with the title “Is your Eye-Fi card collecting dust?”
“Yes, three of them, in fact,” I thought. I figured inside I’d find a message about some sort of feature or update that would stop my cards from collecting dust, as that would be the only explanation that should let a human person use a headline like that in a marketing setting.
What do I find inside instead? Eye-Fi is releasing a new card! With new, easier than ever setup. It works easy this time, they promise, if you could just forget the fact that your other three cards are gathering dust, because the company has repeatedly abandoned them.
I’m not sure quite what I’m expecting from a company that’s let me down for years straight now, but I didn’t expect the open-hand slap to the face. I guess tinyass SD cards are really hard to make, and updating them must be even harder, but nothing can excuse the cut-and-run release cycle going on here. Avoid these guys at all costs.
As recently as this year, I was developing WordPress sites in Adobe Dreamweaver. I say that without shame because the tool was actually pretty good. I found myself defending it every few months, but it got the job done and I didn’t feel like learning anything new.
Enter Sublime Text 2, which recently stormed into my life and made a damn fool of me. This little editor is easily one of the biggest improvements I’ve made to my workflow, ever. Not just recently or just with regards to WordPress, but ever.
If you makes websites at a serious level, you should give Sublime Text 2 a chance.
This post is my quick (well, somewhat) explanation at why I’ve so fallen for the editor and what customizations I’ve made to make Sublime Text 2 even better, specifically for creating WordPress sites. If you’re familiar with the editor itself, feel free to skip to the meat (list of my favorite packages) down below…
Arguably the best feature of Sublime Text is the use of packages, an easy (and often free) way to extend functionality of your editor. With a few clicks, you can add new features like full SFTP support, linting for errors, function autocompletes, snippets galore, even a lightweight Twitter client.
Packages makes it possible to turn Sublime into exactly the editor you want it to be. And what’s best? All your packages and settings are simple files and folders which are totally portable, making your perfected dev environment super portable. We’ll get to that later. First, we need some packages!
First, we’ll look at a tool that helps install and manage your packages, then I’ll include a full list of my favorite packages and why I can’t live without them.
Most popular packages are available through an ultra-handy system called Package Control. If you’re running Sublime Text 2, you should be running Package Control. It makes installing, updating, and removing packages a total breeze. Package Control is available free from Will Bond, or wbond, who you’ll see mentioned again later in the countdown.
To install Package Control, you’ll need to run the following command in the Sublime Text 2 console. The console is opened via the Ctrl + ` shortcut, then just paste in the following text (I know it’s long and weird looking- you don’t need to understand it, just paste it):
Once that’s done, restart Sublime Text, and you’ll find the goods under Preferences > Package Control. From there, click Install Packages and you’re on your way to a magical land.
My favorite packages
All the packages I use are available through Package Control, so feel free to just search there to install them yourself. I’ve included plenty of links below for reference, just don’t forget that most of the action is inside Package Control. Here we go:
A full-featured SFTP client from wbond, Sublime SFTP makes working on a remote server almost as easy as editing locally. With full support for FTP, SFTP, SSH, etc, I’ve found this package gets me access to just about any server I’m working on.
To make the most of Sublime SFTP, make sure you’ve opened a folder (usually my root /wp-content folder) and have your Side Bar turned on (View > Side Bar > Show Side Bar). From there, you can right click on your wp-content folder and choose SFTP > Map to remote, which will give you a simple settings file like this one. Fill it out with your credentials, remote path, etc and you’ve just made Sublime Text into a full-featured SFTP client.
One tip: in the settings file, I love to enable Upload on save, which puts my files onto the server the second I save them. It makes working remotely a breeze. Of course, this isn’t the best idea for a full-scale production server, but during development I absolutely love it.
PS: Sublime SFTP is a paid package, but I find it worth every penny. Plus, the license is per user, not per machine, so the package can travel with you just fine. There’s also a free trial if you don’t mind a nag screen, but I recommend just buying the license. wbond rules.
This package is a collection of functions and WordPress snippets that make writing template PHP a great bit quicker. Not only will Sublime Text start auto-completing WordPress function names, the package includes all the default arguments of the function, which is great in times when your memory might otherwise need a trip to the Codex.
Aside from core functions, it’s got complete functionality snippets, like custom post type templates and plugin starter templates. It’s a great tool for anyone still learning the deeper corners of the Codex and a great way to make sure you’re not making up function names (like get_the_permalink()).
When an auto-complete just won’t cut it, this package makes hopping into the Codex a snap. Simply highlight a function, right click, and you’ll find two new options: WordPress Codex Search and WordPress Function Reference. The first will perform a search on your selected text, the second will straight open a function reference URL with your selected text, like so: http://codex.wordpress.org/Function_Reference/get_template_part. It only saves a couple seconds, but when you’re in and out of the Codex all damn day, it starts to add up.
This is a fun one. The package allows you to highlight a class in a source file (like single.php and the like), and with the press of a key shortcut, you’ll be jumped to the CSS declaration in an open CSS file. For instance, say you’re in header.php and need to edit the main navigation, or .main-nav. Simply highlight the class, fire your shortcut (mine is CTRL + .), and you’ll be jumped into the open style.css to the exact line you’re hunting for. Another shortcut press, another jump. It’s a totally handy way to jump through your files without searching or remembering line numbers- things that are totally annoying in my book.
To lint is to check code for errors, and if you’re writing tons of code, it’s nice to have some form of linting built into your editor. Enter SublimeLinter, which adds error detection for just about any language you throw at it (including of course all the WordPress mainstays, like PHP, CSS, JS, etc).
Even better, each language and ruleset is completely customizable, making for insanely tweakable results. For instance, I don’t even use the CSS linter, because I’m fairly confident there. I always check when I go to production so I don’t usually feel a need to check live as I type.
This offers a quick and easy way to submit public and private Gist snippets to your GitHub account. Simply highlight text, right click, and select Create Public Gist. The package will even let you enter a description and filename (defaulting from the file you’re currently inside). Go forth and share code.
I’ll admit this one is pure silliness, but I’ve found it charming and continue to have fun using it. Sublime Tweet is a package that adds full Twitter capability to Sublime Text. Send tweets, view your timeline, reply to users- all from within Sublime Text.
It’s useless, it wastes time, and I love it. There’s something satisfying about quickly checking updates in a text-only format without leaving your text-only environment. Sublime, even.
Make it portable with Dropbox
Because all your packages and settings are just plain ol’ files, it’s pretty easy to take everything into the cloud with a service like Dropbox. I’m primarily a Windows user, so the following steps will be from a PC-viewpoint, but most of this should be easily translatable to OSX, Linux, etc.
Moving your settings and packages
All your personal settings, snippets, etc are stored in your user folder, located at C:\Users\[username]\AppData\Roaming\Sublime Text 2\Packages\User. Our gameplan will be to copy those files into our Dropbox, storing them in the cloud, then pointing the original folder to our newly cloud-hosted files. The result will be instances of Sublime Text on multiple machines that all function exactly the same.
Make a Sublime Text 2 folder in the root of your Dropbox. Inside, make a Packages folder. Inside that, make Users. Once we’ve replicated the tree, simply copy in all the files you found in the original User folder. Once everything is uploaded and safe, clear out your local User folder (and make sure Sublime is closed when you do so).
Our next step will be making a symlink (symbolic link) between the old User folder and our fancy new cloud-based User folder. You do this in the Windows Command Prompt (which you’ll need to launch as Admin), using the command mklink. It’s a pretty simple idea: we’re going to symbolically link these folders together, so that our old folder behaves exactly as if the files were still present there. The command looks like this:
Once completed, the files hosted in Dropbox will be automagically present inside the local User folder. Any time you make a change in the folder (like settings, snippets, new packages), it’ll be automatically mirrored into Dropbox and thus into your other local User folders.
Astute users might notice that the actual packages themselves aren’t stored in the User folder, and that’s just fine. Package Control is smart enough to catch the packages present in the settings and automatically fetch any that aren’t present locally. Doing it this way means fewer files we need to load into Dropbox and manage ourself, and that sounds pretty good to me.
Something I usually do when working with WordPress files on a server is make sure to keep a complete local copy for myself. Using the SFTP module makes that amazingly easy. If I’ve started locally, I use the module to upload my entire folder tree when I’m ready to move to a server. If the build was started remotely, I use the module to grab an entire copy for myself so I can edit files locally. Any time I edit a local file, it’s automatically uploaded when I save.
Keeping two complete sets of files has saved my hide more times than I care to count. Now that I’m moving between multiple computers, I’ve moved my local files under Dropbox control, keeping that same safe set of templates even safer.
If you want to move your actual template files into the cloud, you can mostly repeat the process above (with the exception of the symlink, which you can actually skip if you’re cool with working directly out of your Dropbox folder).
This post started out as a quick list of my favorite packages and quickly grew into the monster you just scrolled past. It’s a nice parallel for the editor itself: it looks simple and is easy to get started with, but the customization rabbit hole goes as deep as you’re willing to dig.
Next up, I’ll probably write a how-to post featuring some of my favorite snippets. Snippets are an awesomely easy way to store bits of code you find yourself using often, and with some rich snippets in place, you’ll find yourself using them even more often.
What are some of your favorite packages? Have I missed any must-haves with this list? How has Sublime Text changed the way you develop WordPress sites?
Trying something new: the following slides are from my #wpatx presentation on September 25, 2012. I’ve created a way to show them directly in a blog post, so hopefully this will let me ditch Google Docs Presentations. The following slides are plain text, with links inside, so feel free to get to copyin’ and pastin’ and a clickin’.
Two things: If you’re not familiar with WP101, shame on you. They offer an ever-growing library of WordPress tutorial videos geared and the beginning (and learning) user. Second, I recently released an ebook called Meta Valuables. These two things have now collided in the following video, which does a great job of quickly explaining meta data and how it works. Check it out:
If you liked that taste, make sure to check out WP101. If you’re already a total WordPress boss, don’t forget about the WP101 Plugin, which allows you to insert these handy videos directly into your client’s dashboard. Both services are run by a dude that’s totally active in the WordPress community and we can never go wrong supporting our own!
This is a quick one, but file it away in your brain and some day you’ll thank me. Have you noticed that when you create a new custom post type that you’ve gotta hit the admin settings and re-save your permalink structure? You don’t have to change anything, just saving it again will do the trick, but it’s an annoying little step.
If you’re creating post types programmatically (inside your plugin, whatever), you might need a way to automatically flush your rewrite rules. Enter the simple function flush_rewrite_rules().
flush_rewrite_rules( $hard );
The function only accepts one parameter, a boolean true/false for $hard, which will decide whether to actually update the rules in the .htaccess file or just soft flush the rewrite_rules transient. The default is true, meaning you’ll get a full flush.
Even if you’re not working with post types, you’ll sometimes run into scenarios when you need to flush. I’ve got a project going right now where I’ve dropped the author prefix in the URL, giving each user a top level page (domain.com/user). I noticed that these rules weren’t being created upon registration and a simple flush_rewrite_rules() in my registration hook fixed things up.
It’s worth noting that this is an “expensive” process, meaning you shouldn’t just run it all willy nilly. Only call this when you absolutely need it. If you’re not sure if you need it, you probably don’t. But six months from now when you can’t figure out why some users are hitting 404s, come back for a high five.
Recently while working on a WordPress project, I decided to start a new theme from scratch. This, of course, meant taking a couple minutes porting some of my functionality from my old theme to my new theme. While it wasn’t back-breaking work, a lot of it can be avoided with some proper setup at the start of a project.
Custom post types were the best example of custom functionality I could think of that might disappear when changing themes. Lots of folks, when not using a plugin, declare their custom post types in functions.php, or somewhere similar. When you change themes, these inits are lost and some things will go wonky.
If you’ve got functionality you want to keep regardless of theme, consider throwing it inside a plugin, then throwing that plugin inside a /wp-content/mu-plugins/ folder. Files placed in the Must Use Plugins folder will automatically be used and never be able to be turned off. For things like custom post types or shortcodes, they’re perfect for making sure our functionality stays in place as we change themes.
Creating the plugin is dang easy. Simply create a new file and declare a new plugin like so:
Plugin Name: Must-use Loader
Plugin URI: http://clarklab.com
Description: A must-use plugin that initiates all our goodies.
Author URI: http://clarklab.com
// include the rest of your neatly sorted functionality here
Save the above file as something like must-use-loader.php and place it inside the /wp-content/mu-plugins/ folder. If this folder doesn't exist, create it. Once you've place the above file, your new functionality will immediately activate and will stay active until the file is removed. Nothing inside /wp-admin can change that. Only the file being physically removed will stop these functions.
In my sample above, once I've established the plugin, I simply include the PHP file containing my custom post type code, just like I used to in functions.php. The only difference is the next time I change themes I won't have to worry about any of this mess.
When working with WordPress, I often need to reference specific columns in the database. I’ve got most of them memorized (ID, post_author, post_date, post_content, etc, etc) but every now and then I’ll need to get at some data and can’t recall where it’s stored. Enter the handy WP DB schema chart!
This is accurate as of WP 3.0, which isn’t exactly cutting edge, but the schema isn’t something they change very often and I’ve yet to find any errors in it. If charts ain’t your thing, check our a full description of the database in the WP Codex.
Learning the columns and tables and the relationships between everything is a great way to pick up speed as a WP developer. Bookmark that chart (or the WP codex page) and check it often. You’ll find yourself making more advanced queries in no time.