Skip to content

Instantly share code, notes, and snippets.

@jeffam
jeffam / hook_menu_block_blocks
Last active December 18, 2015 17:19
Default Menu Blocks
<?php
/**
* Implements hook_menu_block_blocks().
*/
function sidebar_menu_menu_block_blocks() {
// The array key is the block delta used by menu block.
return array(
'sidebar_subnav' => array(
'title_link' => TRUE,
'admin_title' => 'Current Menu Children',
@jeffam
jeffam / default.settings.php-local_settings.patch
Created July 1, 2014 19:14
Drupal 7 settings.local.php patch
diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php
index 580cc38..ae5c1ed 100644
--- a/sites/default/default.settings.php
+++ b/sites/default/default.settings.php
@@ -551,3 +551,18 @@ $conf['404_fast_html'] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
* Remove the leading hash signs to disable.
*/
# $conf['allow_authorize_operations'] = FALSE;
+
+/**
<p>This is a simple list:</p>
<ul>
<li>Item one</li>
<li>item two</li>
<li>item three</li>
<li>Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec id elit non mi porta gravida at eget metus.</li>
</ul>
<p>This is an ordered list:</p>
@jeffam
jeffam / branch_snaps_post-checkout.php
Last active September 11, 2023 01:38
Drupal content snapshots for git branches
#!/usr/bin/env php
<?php
/**
* Git post-checkout hook that maintains Drupal db snapshots for each branch.
*
* INSTALLATION:
* cd repo/root/directory
* mkdir snapshots
* echo "snapshots/*.sql" >> .git/info/exclude
* chmod +x /path/to/branch_snaps_post-checkout.php
@jeffam
jeffam / sb_wsysiwyg_install.make
Last active August 29, 2015 14:18
sb_wysiwyg quick install
core = 7.x
api = 2
projects[sb_wysiwyg][type] = "module"
projects[sb_wysiwyg][download][type] = "git"
projects[sb_wysiwyg][download][url] = git://github.com/singlebrook/sb_wysiwyg.git
projects[sb_wysiwyg][download][branch] = "master"
projects[sb_wysiwyg][subdir] = "features"
@jeffam
jeffam / feeds_importer.inc
Last active August 29, 2015 14:19
Drupal Atom Feed w/ Media Importer
// Use with feeds-7.x-2.x-dev
// Tested with http://feeds.feedburner.com/TechCrunch/Greentech?format=xml
$feeds_importer = new stdClass();
$feeds_importer->disabled = FALSE; /* Edit this to true to make a default feeds_importer disabled initially */
$feeds_importer->api_version = 1;
$feeds_importer->id = 'atom_with_media';
$feeds_importer->config = array(
'name' => 'Atom Feed w/ Media',
'description' => '',
@jeffam
jeffam / README.md
Last active August 29, 2015 14:19
Drupal Branch Deployer for Task Train

Sample Per-branch Drupal Deployment Scripts for Task Train

This is some (rough) boilerplate code for automated deployments of feature branches in a Drupal project. It's kind of like a poor man's http://tugboat.qa/

Requirements:

Keybase proof

I hereby claim:

  • I am jeffam on github.
  • I am jeffam (https://keybase.io/jeffam) on keybase.
  • I have a public key ASDyYm86GMAEEPfTAbmErxF3KTBP8ZdHI7TdDPL_v_X2ewo

To claim this, I am signing this object:

@jeffam
jeffam / macos_pip_no-root.md
Created January 5, 2018 17:59
Installing PIP Packages in macOS without Root

I needed mkdocs installed but didn't want to do it as root, and virtualenv is overkill for my current needs. Here's what I did:

$ easy_install --help | grep -A 3 -- --user

This returned:

  --user                     install in user site-package
                             '/Users/jeff/Library/Python/2.7/lib/python/site-
 packages'

macOS + php-fpm + apache

These are the notes for my PHP (mainly Drupal) development setup on macOS. I've tried Vagrant and Docker, and I sure wish they were worth it, but filesystem performace issues are too noticeable.

I prefer this native setup along with a robust development/staging server for catching any glitches from infrastructure differences.

Overview

  • PHP via [Homebrew][]
  • Apache 2.4.x (included with macOS)