you do what you do

git branch —delete doug/*

I branch a lot under my own namespace: image And I wanted to delete all the merged branchs. This helps:
gitdoug () {
    # cleanup the doug/branches
    echo "Prune origin..."
    git remote prune origin;
    echo "Deleting local merged branches ..."
    git branch -a --merged | egrep "^\s*doug" | xargs -n1 git branch -d;
    echo "Deleting merged branches on origin ..."
    git branch -a --merged | grep "remotes/origin/doug" | 
        cut -d"/" -f4 | xargs -I BRANCH git push origin ":doug/BRANCH";

Oh python, go to hell

>>> import module
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named module

Battery Charger Cable Clutter

Unlike my other chargers (where the plug prongs fold into the charger) the Pentax battery charger uses an extension cord

This sucks when you’re trying to be compact. Looking for an alternative, I tried the Apple AC duchead, it works perfectly. The charger can also handle 100-240V input so with the travel kit the charger is now internationalized.

1. Stop buying stuff you don’t need
2. Pay off all your credit cards
3. Get rid of all the stuff that doesn’t fit in your house/apartment (storage lockers, etc.)
4. Get rid of all the stuff that doesn’t fit on the first floor of your house (attic, garage, etc.)
5. Get rid of all the stuff that doesn’t fit in one room of your house
6. Get rid of all the stuff that doesn’t fit in a suitcase
7. Get rid of all the stuff that doesn’t fit in a backpack
8. Get rid of the backpack

I’m working on step 4.

Mark Pilgrim
Those are zombie processes and the dash nine is a headshot
Asking Jared what the -9 does in kill -9 ID

Copy/Paste in Adium without formatting

Whenever I copy/paste something into Adium, I generally want plain text. By default it looks like:

I recently discovered the menu item “Paste and Match Style”.

To make this the default action for cmd+v open System Preferences > Keyboard Add two new shortcuts:

Paste                ⌥⇧⌘V
Paste and Match Style  ⌘V

Note, want to specify for just Adium, if you do this under “All Applications” and the app doesn’t have “Paste and Match Style” then cmd+v does nothing.

and now copy/pasting the same text, I get:

What do I think about schemas and DTDs? I don’t care.
Thomas: [Chris' turtle] repeatedly plummeted to the ground from our balcony
Justin: sounds like that turtle sucks at committing suicide
Justin: i imagine most turtles do
Doug: idk, have you driven on the highway lately?
Doug: the ones that know where 408 is do a pretty good job of squishing themselves.
Justin: i like to think of those as turtle murders. not suicides
Dan: Turders.
Justin: exactly

Permissions with Wordpress Custom Post Types

To create custom permissions on custom post types, easy way to do so is with the members plugin.

Step 1 - Install Plugin

  1. Install members plugin
  2. Enable roles: Settings > Members Components > Edit Roles
  3. Familiarlize yourself with Users > Roles

Step 2 - Create a Custom Post Type

A simple custom post type (example “Projects”):

add_action( 'init', 'create_post_type' );
function create_post_type() {
  register_post_type( 'project',
      'labels' => array(
        'name' => __( 'Projects' ),
        'singular_name' => __( 'Project' )
      'public' => true,
      'capability_type' => 'project',
        'public' => true,
        'capability_type' => 'project'

Step 3 - Set Permissions

My goal was to make it so users could create and edit only their own projects. They key is knowing the difference between meta capabilities and primitive capabilities.

Primitive capabilities are flags, always set to yes or no. Meta capabilities require some context, like “Is the user the author of this post?”.

Primitive caps are set within the role editor. In my case, the primitive capabilities needed for contributors are edit_projects and edit_published_projects. roles in wordpress
Reference of other primitive capabilities.

Meta capabilities need to be defined with the map_meta_cap filter. I found the best place to start is by looking at the wordpress source.

In my functions.php I added:

add_filter( 'map_meta_cap', 'my_map_meta_cap', 10, 4 );
function my_map_meta_cap( $caps, $cap, $user_id, $args ) {

  // almost identical to 'edit page' from
  if ( $cap == 'edit_project'){

    // remove meta cap
    $key = array_search('edit_project', $caps);
    if($key !== false) unset($caps[$key]);

    $author_data = get_userdata( $user_id );
    //echo "post ID: {$args[0]}<br />";
    $page = get_page( $args[0] );
    $page_author_data = get_userdata( $page->post_author );
    //echo "current user id : $user_id, page author id: " . $page_author_data->ID . "<br />";
    // If the user is the author...
    if ( is_object( $page_author_data ) && $user_id == $page_author_data->ID ) {
      // If the page is published...
      if ( 'publish' == $page->post_status ) {
        $caps[] = 'edit_published_projects';
      } elseif ( 'trash' == $page->post_status ) {
        if ('publish' == get_post_meta($page->ID, '_wp_trash_meta_status', true) )
          $caps[] = 'edit_published_projects';
      } else {
        // If the page is draft...
        $caps[] = 'edit_projects';
    } else {
      // The user is trying to edit someone else's page.
      $caps[] = 'edit_others_projects';
      // The page is published, extra cap required.
      if ( 'publish' == $page->post_status )
        $caps[] = 'edit_published_projects';
      elseif ( 'private' == $page->post_status )
        $caps[] = 'edit_private_projects';


  /* Return the capabilities required by the user. */
  return $caps;


Users can now create new projects, post them to pending, but are not able to edit anyone else’s projects: CMS result

Final Notes

Some permissions you may want to add to to the administrator include: edit_projects, edit_others_projects, publish_projects, read_private_projects, delete_project, edit_published_projects.

If you add a meta capability through role editor, you will get some unexpected behavior. For example, if you add ‘delete_project’ (a meta capability) to the admin roll, an admin will be able to delete any project, thus ignoring the prim caps delete_published_posts, delete_published_posts, and delete_others_posts.


Cap'n Crunch
Doug: [some mention about Cap'n Crunch being a hacker]
Bank: cap'n crunch is the cereal right?
Bank: he is master and commander but i don't think he hacks
Doug: why else would he give away a whistle that uses the exact same frequency that was used by AT&T long lines if he DIDNT hack?
Bank: because it is also the same frequency that summons the kraken. pure coincidence.