Skip to content

Instantly share code, notes, and snippets.

View wpscholar's full-sized avatar
😀
Happy

Micah Wood wpscholar

😀
Happy
View GitHub Profile
@FrankM1
FrankM1 / provision.sh
Created May 18, 2015 14:06
Faster provisioning for vvv - Removed provisioning for Wordpress Core development. That took a long time to complete
#!/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
@wp-kitten
wp-kitten / gist:2bf444f0cc10bd06bf4e
Created March 31, 2015 09:23
WordPress Theme Activation/Deactivation hooks
<?php
/*
* Add this code to your theme's functions.php file
*/
// Theme activation
add_action("after_switch_theme", "theme_activated");
function theme_activation_hook(){
error_log('theme activated');
}
@codeinthehole
codeinthehole / osx_bootstrap.sh
Last active October 10, 2023 12:21
Script to install stuff I want on a new OSX machine
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# - Twitter (app store)
@thomasgriffin
thomasgriffin / api-helper.php
Last active March 13, 2019 13:46
API Helper to be used during API requests. Should be used as a must-use plugin in WordPress.
<?php
/**
* Plugin Name: TGM API Helper
* Plugin URI: https://thomasgriffin.io
* Description: Whitelists the plugins to be loaded during API requests to reduce overhead.
* Author: Thomas Griffin
* Author URI: https://thomasgriffin.io
* Version: 1.0.0
*/
@GaryJones
GaryJones / js.js
Created January 5, 2015 12:54
Gravity Forms Countries dropdown with country codes
var countryCodes = {
'Afghanistan': '93',
'Albania': '355',
'Algeria': '213',
'American Samoa': '684',
'Andorra': '376',
'Angola': '244',
'Antigua and Barbuda': '1-268',
'Argentina': '54',
'Armenia': '374',
@fversnel
fversnel / SmartSortable.js
Created December 30, 2014 11:36
React SmartSortable
var cloneWithProps = React.addons.cloneWithProps;
var SmartSortable = React.createClass({
getDefaultProps: function() {
return {component: "ul", childComponent: "li"};
},
render: function() {
var props = jQuery.extend({}, this.props);
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@markjaquith
markjaquith / nginx.conf
Last active December 25, 2022 15:55
My WordPress Nginx setup
upstream phpfpm {
server unix:/var/run/php5-fpm.sock;
}
upstream hhvm {
server unix:/var/run/hhvm/hhvm.sock;
}
# SSL
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
@wpscholar
wpscholar / load-views.php
Created July 23, 2014 18:47
Load Ember templates in WordPress
<?php
/**
* Load Ember templates in WordPress
*/
public static function load_views() {
$iterator = new \DirectoryIterator( plugin_dir_path( __FILE__ ) . 'views' );
foreach ( $iterator as $file ) {
/**
* @var \SplFileInfo $file
@RadGH
RadGH / wordpress-tinymce.js
Last active October 21, 2022 01:21
Get/Set content of a TinyMCE visual or text editor with JavaScript
/*
Based on: http://wordpress.stackexchange.com/questions/42652/#answer-42729
These functions provide a simple way to interact with TinyMCE (wp_editor) visual editor.
This is the same thing that WordPress does, but a tad more intuitive.
Additionally, this works for any editor - not just the "content" editor.
Usage: