This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wcatl2016_api() { | |
if ( !empty( $_GET['wcatl2016'] ) ) { | |
switch( strtolower( $_GET['wcatl2016'] ) ) { | |
case 'get-users': | |
$response = wcatl2016_api_get_users(); | |
break; | |
case 'add-user': | |
$response = wcatl2016_api_create_user(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wcatl2016_transition_post_status( $new_status, $old_status, $post ) { | |
$api_url = 'https://lewayotte.com/?wcatl=1'; | |
if ( 'publish' === $new_status && 'publish' !== $old_status ) { | |
$args = array( | |
'headers' => array( 'content-type' => 'application/json' ), | |
'body' => json_encode( array( 'post-id' => $post->ID ) ), | |
); | |
$response = wp_remote_post( $api_url, $args ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wcatl_api() { | |
if ( !empty( $_GET['wcatl'] ) ) { | |
try { | |
$input = file_get_contents( 'php://input' ); | |
$post = json_decode( $input, TRUE ); | |
if ( !empty( $post['post-id'] ) ) { | |
error_log( sprintf( 'New Post Published %s', $post['post-id'] ) ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Add this file to the wp-content/mu-plugins/ directory | |
*/ | |
function my_leenkme_shortener( $permalink, $post_id) { | |
if ( $existing = get_post_meta( $post_id, '_leenkme_short_url', true ) ) { | |
$permalink = $existing; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <LiquidCrystal.h> | |
LiquidCrystal lcd(12,11,5,4,3,2); | |
const int switchPin = 8; | |
int switchStatus = LOW; | |
const int ledPin = 7; | |
int time = 0; | |
bool startPhase1 = false; | |
int randomStart = 0; | |
bool startPhase2 = false; | |
bool gameComplete = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function default_exclude( $post ) { | |
global $hook_suffix; | |
if ( 'post-new.php' == $hook_suffix ) { | |
update_post_meta( $post->ID, '_twitter_exclude', true ); | |
} | |
} | |
add_action( 'dbx_post_advanced', 'default_exclude' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "musical_notes.h" | |
const int speakerPin = 3; | |
const int resetPin = 5; | |
const int player1 = 12; | |
const int player2 = 10; | |
const int player3 = 9; | |
const int pLight1 = 13; | |
const int pLight2 = 11; | |
const int pLight3 = 8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Aggressive | |
subs_filter //lewayotte.com/wp-content/ //d9ye22nzps5tq.cloudfront.net/wp-content/; | |
subs_filter //lewayotte.com/wp-includes/ //d9ye22nzps5tq.cloudfront.net/wp-includes/; | |
subs_filter \/\/lewayotte.com\/wp-content\/ \/\/d9ye22nzps5tq.cloudfront.net\/wp-content\/; | |
subs_filter \/\/lewayotte.com\/wp-includes\/ \/\/d9ye22nzps5tq.cloudfront.net\/wp-includes\/; | |
#Not So Aggressive (set exactly which extensions you want it to pass to the CDN) | |
subs_filter //lewayotte.com/wp-content/(.*)\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|css|js) //d9ye22nzps5tq.cloudfront.net/wp-content/$1.$2 gir; | |
subs_filter //lewayotte.com/wp-includes/(.*)\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|css|js) //d9ye22nzps5tq.cloudfront.net/wp-includes/$1.$2 gir; | |
subs_filter \/\/lewayotte.com\/wp-content\/(.*)\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|j |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
EC2_INSTANCE_ID="`wget -q -O - http://169.254.169.254/latest/meta-data/instance-id || die \"wget instance-id has failed: $?\"`" | |
test -n "$EC2_INSTANCE_ID" || die 'cannot obtain instance-id' | |
EC2_AVAIL_ZONE="`wget -q -O - http://169.254.169.254/latest/meta-data/placement/availability-zone || die \"wget availability-zone has failed: $?\"`" | |
test -n "$EC2_AVAIL_ZONE" || die 'cannot obtain availability-zone' | |
EC2_REGION="`echo \"$EC2_AVAIL_ZONE\" | sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:'`" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -d /var/backups/wpdb/ ]; then | |
mkdir -p /var/backups/wpdb/ | |
fi | |
for x in `/usr/local/bin/wo site list | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g"`; do | |
cd /var/www/$x/htdocs/ | |
/usr/local/bin/wp --allow-root db export --add-drop-table /var/backups/wpdb/$x.sql | |
done |