Skip to content

Instantly share code, notes, and snippets.

@jtwalters
jtwalters / gist:8995023
Created February 14, 2014 02:55
Diff modules on two Drupal sites
diff -u \
<(drush @site1 pm-list --no-core --type=module --pipe --status=enabled | sort) \
<(drush @site2 pm-list --no-core --type=module --pipe --status=enabled | sort)
@jtwalters
jtwalters / mymodule.php
Created April 9, 2014 01:59
A really deep Drupal conditional to hide Manage Display (display suite)
<?php
/**
* Selectively hide the "Manage Display" local task added by Display Suite
* @see hook_menu_local_tasks_alter
*/
function HOOK_sitewide_tweaks_menu_local_tasks_alter(&$data, $router_item, $root_path) {
// If we're on a node page
if (isset($router_item['path']) && $router_item['path'] == 'node/%') {
// If page_arguments exists
if (isset($router_item['page_arguments']) && is_array($router_item['page_arguments'])) {
@jtwalters
jtwalters / nbsp.txt
Created April 10, 2014 00:56
Non-breaking spaces
Copy any space below this line for a non-breaking space.
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
@jtwalters
jtwalters / ensure-eof.sh
Created April 22, 2014 01:13
Ensure newline at EOF for all tracked files in a Git repository.
for file in `git ls-files`; do; file $file | grep ASCII > /dev/null && sed -i '' -e '$a\' $file; done
@jtwalters
jtwalters / gist:11189634
Created April 22, 2014 18:32
Delete remote GitHub pull branches
git for-each-ref --format="%(refname:short)" refs/remotes/origin/pr/\* | xargs git branch -d -r
Hi there,
Sorry to hear you’re having trouble with our form. From what you are describing, it sounds like you might have cookies disabled in your web browser. Our registration form requires cookies to be enabled for our site in order for us to “remember” that you have filled out the form and can access premium content such as our free training videos. Would you mind trying to enable cookies for our website and then fill out the form just one more time?
Apologies for the inconvenience and let me know if you have any further questions or issues.
@jtwalters
jtwalters / gist:68e36077218b3b5e25b4
Last active August 29, 2015 14:01
GitHub Release Notes Print Bookmarklet
javascript:(function($) { $('.header, .pagehead, .repository-sidebar, .release-authorship, .release-meta, .section-heading, .release-downloads, .site-footer').hide(); $('.release-show, .release-body').css('border', 'none'); window.print(); })(jQuery);
@jtwalters
jtwalters / say.txt
Last active August 29, 2015 14:01
Caboose sayings
-v hysterical caboose is the best thing since sliced bread
@jtwalters
jtwalters / install.sh
Last active August 29, 2015 14:02
Download and install Drupal 7 (MAMP on OS X)
drush dl drupal \
--destination=/Applications/MAMP/htdocs \
--drupal-project-rename=d7
cd /Applications/MAMP/htdocs/d7
drush site-install standard \
--db-url="mysql://root:root@localhost/d7"\
--site-name="d7"
@jtwalters
jtwalters / JOKES.md
Last active August 29, 2015 14:02
Programming Jokes

Comment your jokes below in the following format:

Question?

Answer