Skip to content

Instantly share code, notes, and snippets.

View doitlikejustin's full-sized avatar

Justin Scarpetti doitlikejustin

View GitHub Profile
@doitlikejustin
doitlikejustin / simple_shortcode.php
Created August 1, 2013 22:54
Simple WordPress shortcode
// goes in functions.php
// [simple]
function sc_simple($atts) {
return "this is some text";
}
add_shortcode('simple', 'sc_simple');
@doitlikejustin
doitlikejustin / redirect.htaccess
Created August 1, 2013 23:54
Simple 301 Redirect
Redirect 301 /oldpage/ /newpage/
@doitlikejustin
doitlikejustin / disable_core_updates.php
Created August 1, 2013 23:51
Disable WordPress updates (functions.php)
//Diasable Core Updates # 3.0+
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );
wp_clear_scheduled_hook( 'wp_version_check' );
@doitlikejustin
doitlikejustin / triangles.html
Created August 1, 2013 23:56
HTML Triangle Entities
◄ = ◄
► = ►
▼ = ▼
▲ = ▲
▾ = ▾
@doitlikejustin
doitlikejustin / no_www.htaccess
Created August 1, 2013 23:58
To WWW or not to WWW in .htaccess
#Force the no-www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
@doitlikejustin
doitlikejustin / remove_feeds.php
Created August 1, 2013 23:59
Remove Feeds in WordPress
remove_action( 'wp_head', 'feed_links', 2);
remove_action( 'wp_head', 'wlwmanifest_link');
remove_action( 'wp_head', 'wp_generator');
@doitlikejustin
doitlikejustin / sleep_display.txt
Created August 4, 2013 20:54
Turn off Mac display (hot keys)
ctrl + shift + eject
@doitlikejustin
doitlikejustin / add_dock_space.sh
Created August 4, 2013 20:55
Add invisible Mac dock spacer
defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}'; killall Dock
@doitlikejustin
doitlikejustin / email_shortcode.php
Created August 4, 2013 20:57
WordPress email shortcode with encoding
// add in functions.php
// [email]
function sc_email($atts) {
$email = 'ENCODED_EMAIL_ADDRESS';
return "<a href='mailto:$email'>$email</a>";
}
add_shortcode('email', 'sc_email');
@doitlikejustin
doitlikejustin / clear_open_with.sh
Created August 4, 2013 21:01
Fix Duplicate or Old Items on "Open With..." List in Mac OS X
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/\
LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local\
-domain system -domain user