Skip to content

Instantly share code, notes, and snippets.

@mcjim
mcjim / br.sh
Created February 28, 2018 14:29
Script to easily jump to recent git branches
#!/bin/bash
PS3="Switch to a recent branch: "
select BRANCH in "exit" $(git for-each-ref --sort=-committerdate --format='%(refname:strip=2)' refs/heads --count=20);
do
case $BRANCH in
exit)
echo "Exiting."
break
;;
@mcjim
mcjim / gist:1414b1e4422f3a532d74
Created December 10, 2014 17:09
List code in feature .module files
find sites/all/modules/features/*/*.module -type f -print -exec cat {} \; > ~/Desktop/custom-code-in-features.txt
@mcjim
mcjim / gist:5669636
Created May 29, 2013 11:32
Add user to the _www group on OSX 10.8 (Mountain Lion).
sudo dseditgroup -o edit -u ADMINISTRATOR -p -a USER -t user _www
(adapted from http://itsallmacademic.com/2012/08/18/add-a-user-to-the-print-operator-group/)
@mcjim
mcjim / gist:5669493
Last active December 17, 2015 20:39
grep for a function and output as a tab-delimited file
grep -nHIR drupal_add_css . | awk '{print $1,"\t",substr($0,index($0,$2));}' > ~/Desktop/drupal_add_css.txt
@mcjim
mcjim / gist:5663925
Created May 28, 2013 16:11
Local configuration settings for Drupal development. Add to your settings.php file.
$conf['error_level'] = '2';
$conf['block_cache'] = 0;
$conf['cache'] = 0;
$conf['page_compression'] = 0;
$conf['preprocess_css'] = 0;
$conf['preprocess_js'] = 0;
@mcjim
mcjim / .bashrc
Last active July 21, 2023 22:16 — forked from henrik/.bashrc
Git branch, dirty and stash state in Bash prompt.
# Quick fork by @mcjim to add stash status and tweak to suit his style.
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# host dir master $ # clean working directory
# host dir master* $ # dirty working directory
# host dir master*^ $ # dirty working directory with stash
# host dir master^ $ # clean working directory with stash
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*"