Skip to content

Instantly share code, notes, and snippets.

@TheLastCicada
TheLastCicada / gist:090e51fb4f58da5113da
Last active August 29, 2015 14:17
Nginx ES config
server {
listen 80 default;
server_name search.yourdomain.com;
# Elasticsearch private endpoint
location /private {
# IP of the webserver you want to be able to do everything
allow 24.84.205.111;
deny all;
@trepmal
trepmal / comment-generate-cli.php
Created July 3, 2014 18:15
Can either pop this into a plugin and activate it to make the command available. Or install as a package via these instructions: https://github.com/wp-cli/wp-cli/wiki/Community-Packages
<?php
if ( !defined( 'WP_CLI' ) ) return;
/**
* Comment Generate
*/
class Comment_Generate extends WP_CLI_Command {
/**
@ChromeOrange
ChromeOrange / gist:8287925
Last active February 25, 2020 04:22
Delete all tax rates from WooCommerce
/**
* Delete ALL WooCommerce tax rates
*
* Add to your theme functions.php then go to woocommerce -> system status -> tools and there will be a delete all tax rates button http://cld.wthms.co/tXvp
*/
add_filter( 'woocommerce_debug_tools', 'custom_woocommerce_debug_tools' );
function custom_woocommerce_debug_tools( $tools ) {
$tools['woocommerce_delete_tax_rates'] = array(
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active February 25, 2024 17:35
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@barbwiredmedia
barbwiredmedia / Wordpress - Functions
Last active December 20, 2015 11:59
Wordpress - Functions ACF / WP Ecommerce - Post Priority Fix
/* WP e-commerce core has been edited
* ::root::\wp-content\plugins\wp-e-commerce\wpsc-admin\includes\product-functions.php
*
* Line #221 changed priority 10 save to priority 5 was conflicing with ACF BT - 4.29.2013
* add_action( 'save_post', 'wpsc_admin_submit_product', 5, 2 );
*/
remove_action( 'save_post', 'wpsc_admin_submit_product', 10, 2 );
add_action( 'save_post', 'wpsc_admin_submit_product', 5, 2 );
@luetkemj
luetkemj / wp-query-ref.php
Last active April 25, 2024 09:37
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@Rarst
Rarst / r-debug.php
Last active February 3, 2024 17:30
R Debug (set of dump helpers for debug)
<?php
/*
Plugin Name: R Debug
Description: Set of dump helpers for debug.
Author: Andrey "Rarst" Savchenko
Author URI: https://www.rarst.net/
License: MIT
*/
@mjangda
mjangda / remove-post-term.php
Created December 21, 2011 15:11
Remove a given term from the specified post. This function is missing from core WordPress.
<?php
/**
* Remove a given term from the specified post
*
* Helper function since this functionality doesn't exist in core
*/
function my_remove_post_term( $post_id, $term, $taxonomy ) {
if ( ! is_numeric( $term ) ) {
@jakebellacera
jakebellacera / ICS.php
Last active April 19, 2024 09:06
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*