Skip to content

Instantly share code, notes, and snippets.

View jeremyfelt's full-sized avatar
🍕
Look at that pizza emoji!

Jeremy Felt jeremyfelt

🍕
Look at that pizza emoji!
View GitHub Profile
#!/bin/sh
#
# Post receive deploy script for news.wsu.edu
#
# The master branch of the news.wsu.edu repository should be cloned from the
# origin repository into the /var/repos/news.wsu.edu/ directory on the server.
#
# A bare git repository should be created in /var/repos/news.wsu.edu.git/ with
# `git init --bare`.
#
#!/bin/bash
cd /var/repos/wsu-spine
unset GIT_DIR
git checkout -- .
git checkout develop
git pull origin develop
git fetch --all
git checkout $1
export PATH="/home/www-data/.gem/ruby/1.9.1/bin:/usr/local/rvm/gems/ruby-1.9.3-p547/bin:/usr/local/rvm/gems/ruby-1.9.3-p547@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p547/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/rvm/bin"
<?php
// Some stuff to validate the request from GitHub, see documentation
// on HTTP_X_GITHUB_EVENT and HTTP_X_GITHUB_DELIVERY
$payload = json_decode( $_REQUEST['payload'] );
if ( 'push' === $_SERVER['HTTP_X_GITHUB_EVENT'] && 'refs/heads/develop' === $payload->ref ) {
shell_exec( 'sh /var/repos/deploy/deploy-build.sh develop' );
die( 'Deploy develop branch' );
Jeremys-MacBook-Air-3:vvv jeremyfelt$ vagrant ssh
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-39-generic x86_64)
[...snip...]
  System information as of Wed Jan  7 05:44:54 UTC 2015
[...snip...]
vagrant@vvv:~$ cd /srv/www/wordpress-develop/
vagrant@vvv:/srv/www/wordpress-develop$ wp shell
wp> date( 'Y-m-d H:i:s', time() );
string(19) "2015-01-07 05:48:20"
@jeremyfelt
jeremyfelt / powerful-code-snippets.php
Last active August 29, 2015 14:13
Pullman WordPress Meetup - Powerful Code Snippets
<?php
// Powerful Code Snippets (will there be 10?)
add_action( 'init', 'puwwp_register_post_type' );
/**
* Registering a custom post type provides many out of
* the box defaults new types of content.
*/
function puwwp_register_post_type() {
$labels = array(); // array of labels
@jeremyfelt
jeremyfelt / gist:ded76824cd3382e2a32b
Created April 16, 2015 20:49
Process section backgrounds
(function($,window){
process_section_backgrounds = function() {
var $bg_sections = $('.section-wrapper-has-background');
$bg_sections.each( function() {
var background_image = $(this).data('background');
$(this).css('background-image', 'url(' + background_image + ')' );
});
};
@jeremyfelt
jeremyfelt / gist:3f1e0ed40a71a01bcb5e
Last active August 29, 2015 14:19
Generate ALTER TABLE statements used in the WordPress 4.2 upgrade routine
SELECT CONCAT("ALTER TABLE `", TABLE_NAME,"` DROP INDEX slug, ADD INDEX slug(slug(191));") AS mySQL
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA="wsuwp" AND TABLE_TYPE="BASE TABLE" AND TABLE_NAME LIKE '%_terms'
SELECT CONCAT("ALTER TABLE `", TABLE_NAME,"` DROP INDEX name, ADD INDEX name(name(191));") AS mySQL
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA="wsuwp" AND TABLE_TYPE="BASE TABLE" AND TABLE_NAME LIKE '%_terms'
SELECT CONCAT("ALTER TABLE `", TABLE_NAME,"` DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191));") AS mySQL
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA="wsuwp" AND TABLE_TYPE="BASE TABLE" AND TABLE_NAME LIKE '%_commentmeta'
SELECT CONCAT("ALTER TABLE `", TABLE_NAME,"` DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191));") AS mySQL
<?php
// https://github.com/washingtonstateuniversity/WSUWP-Platform/blob/master/www/wp-content/sunrise.php#L111-L125
// If a row was found, set it in cache for future lookups
if ( $current_blog ) {
// Start with the assumption that SSL is available for this domain.
$current_blog->ssl_enabled = true;
// We're looking for a base option name of foo.bar.com_ssl_disabled
$ssl_domain_check = $requested_domain . '_ssl_disabled';
@jeremyfelt
jeremyfelt / gist:b5d391099c9a712c147c
Created May 12, 2015 04:32
Multisite tickets of interest, 4.3
OCSP response:
======================================
OCSP Response Data:
OCSP Response Status: successful (0x0)
Response Type: Basic OCSP Response
Version: 1 (0x0)
Responder Id: 1E05A3778F6C96E25B874BA6B486AC71000CE738
Produced At: May 14 09:32:38 2015 GMT
Responses:
Certificate ID: