Skip to content

Instantly share code, notes, and snippets.

View benjifisher's full-sized avatar

Benji Fisher benjifisher

View GitHub Profile
@benjifisher
benjifisher / find_commit.php
Created November 6, 2013 14:44
This php command-line script will do a binary search to find the first git commit that breaks your patch. It will give simple usage instructions if you invoke it without arguments. I wrote this script to help in re-rolling patches for Drupal. I posted the original version as a comment on https://drupal.org/patch/reroll . The script makes a reaso…
#!/usr/bin/env php
<?php
// Get the arguments. If there are not two, then print usage info.
if (count($argv) != 3) {
$scriptname = basename($argv[0]);
print("Usage: $scriptname <date> <patchfile>" . PHP_EOL);
print('where <date> is any date understood by git' . PHP_EOL);
print('and <patchfile> applied cleanly on <date>, not today.' . PHP_EOL);
print("Example: $scriptname 2013/05/17 foo.patch" . PHP_EOL);
@benjifisher
benjifisher / ansible.snippets
Created November 16, 2014 18:09
Work in progress: Ansible snippets for use with vim SnipMate or Ultisnips plugins.
snippet azure
azure:
name=${1}
location=${2}
subscription_id=${3}
management_cert_path=${4}
storage_account=${5}
image=${6}
role_size=${7}
endpoints=${8}
@benjifisher
benjifisher / vdebug.vim
Created May 15, 2015 23:14
A bit of Vdebug configuration.
" Configuration for the Vdebug interface to Xdebug (and DBGp) debugger.
" See :help Vdebug and https://github.com/joonty/vdebug.
if !exists('g:vdebug_options')
let g:vdebug_options = {}
endif
if !exists('g:vdebug_options.path_maps')
let g:vdebug_options.path_maps = {}
endif
let g:vdebug_options['path_maps']['/var/www/drupal'] = '/Users/bfisher/Sites/drupal-7.32/'
@benjifisher
benjifisher / updateandcommit.sh
Created December 17, 2015 15:27
Update a Drupal extension (module or theme) and commit to git with this shell script.
#!/bin/bash
echo Update a Drupal extension and commit the result to git.
echo Warning: alpha version. Assumes you are in sites/all/modules/contrib or similar.
read -e -p 'Which extension? ' EXT
if [ -z "$DRUSH_ALIAS" ]; then
read -e -p 'Site alias (include "@"): ' ALIAS
else
ALIAS=$DRUSH_ALIAS
echo "Site alias: $ALIAS"
@benjifisher
benjifisher / lando status one-liner with jq
Last active October 29, 2019 16:39
Get status information from `lando list` and `jq`
lando list --format json | jq 'map_values(.[0].status)'