Skip to content

Instantly share code, notes, and snippets.

View c3mdigital's full-sized avatar

Chris Olbekson c3mdigital

  • WebDev Studios
  • Houston, TX
View GitHub Profile
@c3mdigital
c3mdigital / git-post-push.md
Last active May 16, 2016 19:16
Git pseudo post-push hook for updating supermodel when changes are made and pushed to submodule
View git-post-push.md

Git post push hook for updating supermodule when submodule is updated

  • Create file named git-push-wh with the following content and add it to your path
#!/bin/sh

GIT_DIR_="$(git rev-parse --git-dir)"

BRANCH="$(git rev-parse --symbolic --abbrev-ref $(git symbolic-ref HEAD))"
@c3mdigital
c3mdigital / cacheable-ajax.php
Last active February 19, 2023 13:35
Example of how to cache fronted ajax requests in WordPress. This will allow you to use ajax and page caching like varnish or redis. Where ajax requests would normally not be cached using the built in wp_ajax_action method.
View cacheable-ajax.php
<?php
add_filter( 'rewrite_rules_array', 'cache_frontend_ajax_rules' );
/**
* Rewrite rules filter to add rules for front end ajax calls
*
* @param array $rewrite_rules
*
* @return array
*/
View Vagrantfile.diff
diff --git Vagrantfile Vagrantfile
index 65de7b1..40ba133 100644
--- Vagrantfile
+++ Vagrantfile
@@ -33,7 +33,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
v.vm.box_url = "http://files.vagrantup.com/precise64_vmware.box"
end
- if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) == nil
- config.vm.synced_folder ".", "/srv", nfs: true
@c3mdigital
c3mdigital / provision.sh
Created May 1, 2014 20:59
Vagrant Provisioning Script
View provision.sh
#!/bin/bash
#
# provision.sh
#
# This file is specified in Vagrantfile and is loaded by Vagrant as the primary
# provisioning script whenever the commands `vagrant up`, `vagrant provision`,
# or `vagrant reload` are used. It provides all of the default packages and
# configurations included with Varying Vagrant Vagrants.
# By storing the date now, we can calculate the duration of provisioning at the
@c3mdigital
c3mdigital / VagrantFile
Created May 1, 2014 20:29
Vagrantfile
View VagrantFile
# -*- mode: ruby -*-
# vi: set ft=ruby :
dir = Dir.pwd
vagrant_dir = File.expand_path(File.dirname(__FILE__))
Vagrant.configure("2") do |config|
# Store the current version of Vagrant for use in conditionals when dealing
# with possible backward compatible issues.
@c3mdigital
c3mdigital / wp_dequeue_media.php
Last active August 29, 2015 14:00
Dequeue the media javascript libraries loaded with wp_enqueue_media
View wp_dequeue_media.php
/**
* Remove media library javascript files to prevent other plugins from conflicting with yours.
*/
function dequeue_media_conflicts() {
if ( 'your_plugin_hook_name' !== get_current_screen() ) {
return;
}
wp_dequeue_script( 'media-upload' );
wp_enqueue_script( 'media-editor' );
View stream-user-generator.php
<?php
/**
* Plugin Name: Stream User Generator
* Description: Generates X-Team users for testing
* Version: 0.1
* Author: johnregan3
* Author URI: http://johnregan3.me
*
* USE:
* Upload this into your Plugins directory.
@c3mdigital
c3mdigital / Code_Style_WordPress.xml
Last active December 26, 2015 04:48
PHP Storm WordPress Code Style, Code Inspection Settings, Solarized Color Schemes
View Code_Style_WordPress.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Add this file to /Library/Preferences/Webide60/codestyles -->
<code_scheme name="WordPress Code Style">
<option name="USE_SAME_INDENTS" value="true" />
<option name="IGNORE_SAME_INDENTS_FOR_LANGUAGES" value="true" />
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
View wp-chosen-tax-metabox.php
<?php
/**
* WordPress Chosen Taxonomy Metabox
* Author: Helen Hou-Sandi
*
* Use Chosen for a replacement taxonomy metabox in WordPress
* Useful for taxonomies that aren't changed much on the fly and are
* non-hierarchical in nature, as Chosen is for flat selection only.
* You can always use the taxonomy admin screen to add/edit taxonomy terms.
* Categories need slightly different treatment from the rest in order to
@c3mdigital
c3mdigital / plugin.php
Last active October 24, 2021 02:10 — forked from joncave/plugin.php
View plugin.php
<?php
/* Plugin Name: Damn Vulnerable WordPress Plugin
* Description: Intentionally vulnerable plugin for plugin author education
* Version: 0.1
* Plugin URI: http://make.wordpress.org/plugins/2013/04/09/intentionally-vulnerable-plugin/
* Author: Jon Cave
* Author URI: http://joncave.co.uk
* License: GPLv2+
*
* DO NOT RUN THIS PLUGIN ON AN INTERNET ACCESSIBLE SITE