Skip to content

Instantly share code, notes, and snippets.

@scribu
scribu / package-setup.sh
Created December 24, 2013 01:05
Set up the package index for WP-CLI
#!/usr/bin/env bash
if [ -z "$INSTALL_DIR" ]; then
INSTALL_DIR=$HOME/.wp-cli
fi
mkdir -p "$INSTALL_DIR"
cd "$INSTALL_DIR"
if [ ! -x composer.phar ]; then
<?php
/**
* Database emtpying and file removing class.
*
* Truncates all necessary tables in the defined database and removes
* any files uploaded by the demo user.
*
* @since 1.0.0
*
* @author Thomas Griffin
@jakubp
jakubp / gist:2881585
Created June 6, 2012 12:31
jQuery plugin to remove classes with given prefix
// Remove classes that have given prefix
// Example:
// You have an element with classes "apple juiceSmall juiceBig banana"
// You run:
// $elem.removeClassPrefix('juice');
// The resulting classes are "apple banana"
// NOTE: discussion of implementation techniques for this, including why simple RegExp with word boundaries isn't correct:
// http://stackoverflow.com/questions/57812/jquery-remove-all-classes-that-begin-with-a-certain-string#comment14232343_58533
/*********************************************
* Automated Creative Testing With Statistical Significance
* Version 2.1
* Changelog v2.1
*   - Fixed INVALID_PREDICATE_ENUM_VALUE
* Changelog v2.0
*   - Fixed bug in setting the correct date
*   - Script now uses a minimum visitors threshold
*        per Ad instead of AdGroup
*   - Added the ability to add the start date as a label to AdGroups
@zackkatz
zackkatz / EDD Admin-Only Test Payments
Last active July 24, 2018 04:51
Allow admins to use test payments in Easy Digital Downloads for a live store.
<?php
/*
Plugin Name: EDD Test Payments
Plugin URI: https://gist.github.com/zackkatz/7418620
Description: Allow admins to use Test Payment even when it's not enabled.
Author: Katz Web Services, Inc.
Version: 1.0
Author URI: http://katz.co
*/
@da-n
da-n / gist:9999330
Last active January 5, 2019 15:00
Standard phpDocumentor Tags
/*
@abstract Documents an abstract class, class variable or method.
@access [public, private or protected] Documents access control for an element. @access private indicates that documentation of element be prevented.
@author [author name <author@email>] Documents the author of the current element.
@copyright [name date] Documents copyright information.
@deprecated [version] Documents a method as deprecated.
@deprec Same as @deprecated
@example [/path/to/example] Documents the location of an external saved example file.
@exception Documents an exception thrown by a method — also see @throws.
@global [type $globalvarname] Documents a global variable or its use in a function or method.
@revolunet
revolunet / .htaccess
Last active January 31, 2019 11:09
global enable CORS without touching code
# with AJAX withCredentials=false (cookies NOT sent)
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, GET, PUT, OPTIONS, PATCH, DELETE"
Header always set Access-Control-Allow-Headers "X-Accept-Charset,X-Accept,Content-Type"
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L,E=HTTP_ORIGIN:%{HTTP:ORIGIN}]]
# with AJAX withCredentials=true (cookies sent, SSL allowed...)
SetEnvIfNoCase ORIGIN (.*) ORIGIN=$1
@daniel-c05
daniel-c05 / perform-basic-bid-management.js
Last active April 9, 2019 16:19
AdWords Scripts - Perform Basic Bid Management
var workingDateRange = "LAST_14_DAYS";
function main() {
lowerBidsToTopKeywords();
raiseBidsToMidPositionKeywords();
raiseBidsToLowPositionKeywords();
}
@daniel-c05
daniel-c05 / evaluate-ad-text-line-performance.js
Last active April 9, 2019 16:19
AdWords Scripts - Evaluate Ad Text Line Performance
// Comma-separated list of recipients. Comment out to not send any emails.
var RECIPIENT_EMAIL = 'YOUR_EMAIL';
// URL of the default spreadsheet template. This should be a copy of http://goo.gl/pxaZio
var SPREADSHEET_URL = 'SPREADSHEET_URL';
/**
* This script computes an Ad performance report
* and outputs it to a Google spreadsheet
*/
@luetkemj
luetkemj / style.css
Created March 9, 2012 16:32
WP-CSS: Wordpress classes
/* =============================================================================
WordPress WYSIWYG Editor Styles
========================================================================== */
.entry-content img {
margin: 0 0 1.5em 0;
max-width: 100%;
height: auto;
}
.alignleft, img.alignleft {