Skip to content

Instantly share code, notes, and snippets.

View jasontucker's full-sized avatar

Jason Tucker jasontucker

View GitHub Profile
@cdils
cdils / editor-style.php
Last active March 27, 2020 05:49
Apply theme's stylesheet to the visual editor.
add_action( 'init', 'cd_add_editor_styles' );
/**
* Apply theme's stylesheet to the visual editor.
*
* @uses add_editor_style() Links a stylesheet to visual editor
* @uses get_stylesheet_uri() Returns URI of theme stylesheet
*/
function cd_add_editor_styles() {
add_editor_style( get_stylesheet_uri() );
@dylanhthomas
dylanhthomas / excel-remove-trailing-slash.txt
Created June 18, 2013 16:36
Remove the Trailing slash from a cell in Excel. This is especially handy when dealing with lots of urls. Replace "A1" with your cell.
=IF(RIGHT(A1,(LEN(A1)-(LEN(A1)-1)))="/",LEFT(A1,(LEN(A1)-1)),A1)
@jasontucker
jasontucker / gist:3837819
Created October 5, 2012 03:02
Protect a site using a dyndns host and htaccess.
#!/bin/bash
## Crontab Example:
## #*/3 * * * * /bin/sh ~/htaccessdynamic.sh whatevermydyndnsis.dyndns-remote.com ~/domainiwanttoprotect.com/.htaccess > /dev/null 2>&1
dynDomain="$1"
htaccessLoc="$2"
dynIP=$(/usr/bin/dig +short $dynDomain)
@norcross
norcross / image-url-fix
Created August 10, 2012 03:38
create clean attachment URLs
// clean URLs for attachments
// http://domain.com/?attachment_id=173
// http://domain.com/attachment/173
function rkv_attachment_urls($wp_rewrite){
$new_rules = array();
$new_rules['media/(\d*)$'] = 'index.php?attachment_id=$matches[1]';
$wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
}