DrupalDork.com was shut down on September 18, 2013. This is just a snapshot of the site as it appeared then.

Alfred Shortcuts for Drupal Developers

During the BarCamp-style afternoon session at DrupalCamp MD last weekend, some people got talking about the tools they use on a daily basis, including one of my favorites: Alfred, a launcher app that's comparable to Quicksilver or LaunchBar. I have several Drupal-specific custom searches setup in Alfred, and I've been meaning to write about them for the benefit of other Drupal devs on Macs.

To add custom searches, open the Alfred preferences and go to the Features tab, then select Custom Searches in the list at left. Click the plus icon at the bottom of the window to add a new one. You'll be asked to provide some info for the search, including the keyword to use—the command you'll type into the Alfred window—and the URL that the search should go to. You'll put {query} in the URL where the search string should go.

Category:

Responsive Design Test Bookmarklet

Benjamin Keen has created a fantastic, customizable bookmarklet that, when clicked, will show the page you're viewing in multiple screen sizes. This makes it easy to check a responsive design in multiple screen sizes as a glance. Very handy, and very simple execution.

Category:

Follow-up: Local Settings Template

Quick follow-up on my post about local settings file template: colleague Ben Clark forked my gist and added all sorts of good stuff that I hadn't considered. Thanks Ben!

Category:

Local Settings Template

A couple months ago, I wrote about our strategy of using local settings files here at Jackson River.

I was setting up a new development site on my machine the other day, and realized that I've been consulting that blog post a couple times a week to copy over bits of code that were missing from various dev sites. It seemed like a good idea to move it into a gist:

DOPE #2: Node Subpages

Today was my second Day of Personal Enrichment at Jackson River. DOPE days are sort of like Google's 20% time, where employees are encouraged to work on projects that interest them. We don't have the luxury of doing it one day a week, but we do spend a solid day on these projects when we can fit it in the schedule. I wrote about the first one back in May, when I did some work on the Simplenews Threaded Send module.

Module Release Announcement: Node Subpages 6.x-1.0-beta1

I've been meaning to clean up and release this module for a long time.

I built Node Subpages for Drug Policy Alliance, to display subpages on nodes. They have a few node types that have a common set of subpages. For example, State nodes have subpages like Contact, Laws, Campaigns, etc (example: New York). Issue nodes have subpages like Our Priorities, Resources, and Activist Toolkit (example: Medical Marijuana).

Module Release Announcement: Page Not Found Reports 7.x-1.2

Tonight, I released 7.x-1.2 and 6.x-1.3 of Page Not Found Reports. Both include some minor tweaks I had been meaning to make, and some small bug fixes.

Release notes for 7.x-1.2

Release notes for 6.x-1.3

Local Settings for Development Sites

Today I'd like to share a technique that we use on every site at Jackson River.

For most projects, we have multiple developers working on different aspects of the site, and each of us has our own local development setup and checkout of the git repository. The problem we ran into, as any Drupal shop will, is the site configuration details included in settings.php, and the way that those need to differ on our various development, staging, and production sites.

On some early sites, we used a switch statement in settings.php that would check the requested URL, and set variables like $db_url depending on that. When a new developer joined the project, they would add a new condition to the settings for whatever URL they were using (we each had our own local naming scheme, whether it was jacksonriver.com, jacksonriver.local, jr.dev, jrdev.local, and so on).

This was a terrible solution, and we stopped using it a long time ago. Instead, on every site we build, the settings file ends with an include:

Category:

Module Release Announcement: QuickPost Bookmarklet 7.x-1.1

Fixed a Firefox bug, added a couple news options, and cleaned up some helper text. More usable than ever before!

Module Release Announcement: Webform A/B Testing 6.x-1.2

I've made several bug fixes to this module recently, for use on a client site. This release rolls those fixes to the project on drupal.org.

Module Release Announcement: QuickPost Bookmarklet 7.x-1.0

After building a bookmarklet to mimic the one offered by WordPress, I thought it would be handy to have a front-end to configure the options for the bookmarklet, and to make it easier to add to new sites.

Thus was born the QuickPost Bookmarklet module. It's nothing fancy: it just adds an admin config page that allows you to choose the content type that should be created by the bookmarklet, and set the template for the title and body fields.

Mimicking the WordPress "Press This" Bookmarklet in Drupal 7

Updated January 6, 2012: Since writing this post, I have wrapped this functionality up into the QuickPost Bookmarklet module for Drupal 7.


There was only one thing I missed after switching from WordPress to Drupal: the "Press This" bookmarklet that's available on every WordPress site. I find that I post a lot less without it, just because it made it so simple to make a quick blog post about someting I had seen online: highlight some text, click the bookmarklet, add some comments, and post.

I've finally got around to replicating this in Drupal 7, using the Prepopulate module, and I'm posting this so that others can make use of it. I'll start with the most basic version, then show you how I customized mine, and explain some gotchas to watch out for.

Category:

Module Review: Context Layouts 6.x-3.0

Update: I've manually uploaded a higher-quality version. You can now enable the HD version in YouTube so that you'll be able to read the code. Unfortunately, I can't boost the volume any further.
Update #2: The code for this simple theme is now on GitHub: https://github.com/brockboland/coltest

The Context Layouts module is one of those modules I wish I had known about six months ago, because it would have saved me a lot of headaches.

Module Release Announcement: Page Not Found Reports 7.x-1.0

The Page Not Found Reports module adds a couple of admin reports about 404 errors. The Drupal core comes with a report of the top 404s, but this only gives the path and number of requests. The reports added by this module include information about referring pages, and the number and frequency of 404 errors. The referrer information is especially helpful in finding what other sites may be linking to images that were missed during a site migration.

Module Release Announcement: RSS On All Pages 7.x-1.0

I always find it irritating when I want to add a blog to Google Reader, but the page I'm on doesn't have the little RSS icon in the address bar. The solution to this is to include the RSS feed in the head of the page, but Drupal only puts this on the front page by default. This tiny module fixes this by adding the feed on every page of the site.

Module Release Announcement: Google Reader Shared Items 7.x-1.0

I started this project a couple days ago for use on my personal site. Google Reader has an option to embed some Javascript in your own website to show a list of the items that you've shared, but I didn't like that it had to run a script in the user's browser on every page load.

How I Manage My Generic Drupal Dev Sites

On my machine, I have two local sites I use for developing and testing modules and patches: http://d6.local and http://d7.local. After manually wiping and re-creating these sites several times in between some tests, I realized I was doing it wrong and wrote bash scripts to do it for me.

Now, I have templates for each of these sites. Whenever I want to start with a fresh dev site with some basic modules installed (like Admin Menu, Admin Role, and Devel), I run a quick bash script that drops and re-creates the database, imports a SQL file, and replaces the entire webroot directory with the contents of a tarball. I did have to manually setup the site, create my admin user, and enable the modules when I first set all this up. Now, I can easily update that template when I need to - for example, when there's a new versions of the Drupal core released.

Here's my setup:

Category:

New Module: Page Not Found Reports

tl;dr: Page Not Found Reports module released.

A couple weeks ago, I launched a client site that was dealing with a lot of 404 errors. This put unnecessary load on the server: Boost will serve up cached versions of most pages, but for paths that haven't been cached yet, Drupal needs to process it and determine if there's a page available to serve up. In this case, the client overlooked a couple directories of images and other static files that should have been migrated from their old site, so they were getting a lot of 404s from off-site uses of those images. Some were other sites that were hot-linking to the client's images (impolite, but not verboten), but others were being used in their own mailing lists and other sites that they maintained.

To make it easier to identify what files and pages may have missed out on the migration, I built Page Not Found Reports. This adds three new reports:

Category:

Insanely Useful Tips for Git on the Command Line

I've been meaning to write something up about these for a while, because they have made my development flow so much better.

Tab completion

Arguably, the best thing about git is lightweight branches. But, I had been resisting using them, because it was a pain in the neck to keep track of them and re-type or copy-pasta the name for every checkout or merge. I rely heavily on tab completion in the command line, because I know I'll mistype things otherwise, and spend way too much time trying to figure out why something is broke later on - for example, after mistyping the target of a symlink.

As it turns out, git ships with a script to handle tab completion: you just need to find and enable it.

Since I use Homebrew to install and update packages (Mac users: you should too), my git executable is in /usr/local/Cellar/git/1.7.3.4/bin. You need to find git-completion.bash. In my case, it's in a sibling directory: /usr/local/Cellar/git/1.7.3.4/etc/bash_completion.d/git-completion.bash.

Pages

Subscribe to Drupal Dork RSS