Skip to content

Instantly share code, notes, and snippets.

View LeEnno's full-sized avatar

Enrico Herrmann LeEnno

View GitHub Profile
@LeEnno
LeEnno / chromefari.scpt
Created July 8, 2014 17:32
Chromefari – Open Chrome's current tab in Safari or vice versa
tell application "System Events"
set myFrontMost to name of first item of (processes whose frontmost is true)
end tell
property theURL : ""
if myFrontMost is "Google Chrome" then
tell application "Google Chrome"
@LeEnno
LeEnno / functions.php
Last active August 29, 2015 14:01
Wordpress: wrap first image with `div`
<?php
function supergeil_wrap_first_img_with_div($content) {
$pattern = '/<img ([^>]+) \/>/';
$replacement = '<div class="supergeil"><img $1 /></div>';
return preg_replace( $pattern, $replacement, $content, 1 );
}
add_filter( 'the_content', 'supergeil_wrap_first_img_with_div' );
?>