Skip to content

Instantly share code, notes, and snippets.

View karlazz's full-sized avatar

Karla Leibowitz karlazz

  • herself
  • Walnut Creek, CA
View GitHub Profile
@karlazz
karlazz / gist:137eac6a1ee591a9562f9f62a2b0957d
Created March 23, 2017 17:05
.bash-profile shell command to open a file with text wrangler
alias tw='open -a /Applications/TextWrangler.app'
export tw
add_filter( 'page_template', 'wpa3396_page_template' );
function wpa3396_page_template( $page_template )
{
if ( is_page( 'talent-matrix-search' ) ) {
$page_template = dirname( __FILE__ ) . '/talentpage.php';
}
return $page_template;
}
# Attempt to load files from production if they're not in our local version
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) http://mydomain.com/wp-content/uploads/$1
</IfModule>
cdsites () { cd ~/Sites/$1 ; WSITE=`pwd`; export WSITE; }
alias cds=cdsites
cdp () { cd "$WSITE"/wp-content/plugins/$1; }
cdthemes () { cd "$WSITE"/wp-content/themes/$1; }
alias cdt=cdthemes
cdm () { cd "$WSITE"; }
cdu () { cd "$WSITE"/wp-content/uploads/$1; }
//* add a trace file
$upload_dir = wp_upload_dir();
define('TRACEFILE', $upload_dir['basedir'] . '/trace.log');
function trace($log) {
$prefix = current_time( 'mysql' ) . ": " ;
$suffix = "\n" ;
if ( is_array( $log ) || is_object( $log ) ) {
error_log( $prefix, 3, TRACEFILE);
error_log( print_r( $log, true ) , 3, TRACEFILE );
<html>
<head>
</head>
<body>
<div id="copy_initiator">Click me to Copy Text!</div>
<script src="ZeroClipboard.min.js" type="text/javascript"></script>
<script type="text/javascript">
var clip = new ZeroClipboard( document.getElementById("copy_initiator"), {
moviePath: "ZeroClipboard.swf"
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename( $file_complete ) );
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize( $file_complete ) );
echo $my_output;
exit;
add_action( 'template_redirect', 'templateRedirect' );
function templateRedirect() {
global $wp;
$requestPieces = explode('/', $wp->request);
if (strtolower($requestPieces[1]) == 'controlpage' ) {
$_GET['sitename']=$requestPieces[2];
if(file_exists(dirname( __FILE__ ) . '/page-controlpage.php')) {
loadWordPressTemplate( dirname( __FILE__ ) . '/page-controlpage.php');
if you want to temporarily go back to it, fool around, then come back to where you are, all you have to do is check out the desired commit:
# This will detach your HEAD, that is, leave you with no branch checked out:
git checkout 0d1d7fc32
Or if you want to make commits while you're there, go ahead and make a new branch while you're at it:
git checkout -b old-state 0d1d7fc32
To go back to where you were, just check out the branch you were on again.
add_action("gform_pre_render_13", "add_form13_js", 10);
function add_form13_js($form) {
$location = site_url("/thanks-for-your-donation");
echo '
<script type="text/javascript">
jQuery(document).bind("gform_post_render", function(){
jQuery(document).on("click", "#gform_submit_button_13", function(e) {
if (document.getElementById("choice_13_18_1").checked) {
//jQuery("#give-modal").hide();
}