Skip to content

Instantly share code, notes, and snippets.

@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 / nbsp.txt
Created April 10, 2014 00:56
Non-breaking spaces
Copy any space below this line for a non-breaking space.
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
@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 / quit-and-relaunch.applescript
Created March 4, 2014 22:21
Quit and relaunch an application in AppleScript, e.g., Google Chrome—to finish installing updates.
set appName to "Google Chrome"
tell application appName to quit
repeat
tell application "System Events"
if appName is not in (name of application processes) then exit repeat
end tell
do shell script "sleep 0.5"
end repeat
tell application appName to launch
@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)

Pulse background color

A simple jQuery plugin that uses CSS3 animation to pulse the background color of any element

A Pen by Joel on CodePen.

License.