Skip to content

Instantly share code, notes, and snippets.

View mizner's full-sized avatar

Michael Mizner mizner

View GitHub Profile
@mizner
mizner / Simple Ajax Login Form.php
Created May 18, 2016 14:10 — forked from cristianstan/Simple Ajax Login Form.php
Wordpress: Simple Ajax Login Form
<?php
//Simple Ajax Login Form
//Source: http://natko.com/wordpress-ajax-login-without-a-plugin-the-right-way/
//html
<form id="login" action="login" method="post">
<h1>Site Login</h1>
<p class="status"></p>
<label for="username">Username</label>
<input id="username" type="text" name="username">
@mizner
mizner / expecting.md
Created May 26, 2016 20:41 — forked from ksafranski/expecting.md
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect
@mizner
mizner / acf-future-posts.php
Created May 31, 2016 02:28 — forked from aderaaij/acf-future-posts.php
Advanced Custom Fields datepicker: Show only events with a date of today or in the future. Extra comments from Pasnon @ ACF Forums: f you needed to, you could also play with the comparison date, which is the first array in meta_query, currently set to date("Y-m-d") which is today; if you were to make it date("Y-m-d", strtotime("-1 day")) you cou…
<?php
/*
* Display posts only from today and in the future:
* http://old.support.advancedcustomfields.com/discussion/6000/how-to-sort-posts-by-acf-date-and-display-only-future-posts
* by Pasnon
*/
$date_args = array(
'post_type' => 'events',
@mizner
mizner / plugin.php
Created June 26, 2016 19:32 — forked from logoscreative/plugin.php
Friendlier, Safer WordPress Admin Areas
<?php
/**
* "Friendlier, Safer WordPress Admin Areas"
* Presented by Cliff Seal at WordCamp Atlanta 2015 and Asheville 2016
* Slides: http://www.slideshare.net/cliffseal/wp-admin
*
* Plugin Name: A Better Admin Experience
* Plugin URI: http://evermoresites.com
* Description: Cleans up and sanitizes the WordPress admin area
* Version: 1.0
@mizner
mizner / WP-CLI-Commands
Created July 22, 2016 09:02 — forked from lukecav/WP-CLI-Commands
WP-CLI - Handy Commands
Search and Replace
https://wp-cli.org/commands/search-replace/
wp search-replace
wp search-replace 'http://example.dev' 'http://example.com'
Optmize database
https://wp-cli.org/commands/db/optimize/
Repair database
http://wp-cli.org/commands/db/repair/
@mizner
mizner / iterm.scpt
Created August 12, 2016 03:51 — forked from gnachman/iterm.scpt
Fix docker quickstart terminal for iTerm2 version 2.9 and later
on write_to_file(this_data, target_file, append_data)
try
set the target_file to the target_file as string
set the open_target_file to open for access file target_file with write permission
if append_data is false then set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
@mizner
mizner / docker-wordpress.sh
Created August 16, 2016 10:03 — forked from tatemz/docker-wordpress.sh
A quick way to get a WordPress installation up and running with Docker
#!/bin/bash
mkdir wordpress-site && cd wordpress-site
touch docker-compose.yml
cat > docker-compose.yml <<EOL
my-wpdb:
image: mariadb
ports:
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
@mizner
mizner / docker_composeV2_static.yml
Last active August 24, 2016 15:14 — forked from RafPe/docker_composeV2_static.yml
Docker compose V2 static addressing (example?)
services:
haproxy:
image: haproxy:latest
ports:
- "80:80"
- "443:443"
volumes:
- ${PWD}/haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg
restart: always
networks:
@mizner
mizner / webpack.php
Created September 4, 2016 09:59 — forked from raphaelkross/webpack.php
Enqueue our dynamic webpack code
if(false == IVAN_OFFSET_DEBUG) {
// Register main theme styles and enqueue it.
// Hint: you can unregister it and replace by your own compiled version in a child theme.
wp_enqueue_style( 'ivan-theme-styles', get_template_directory_uri() . '/css/theme-styles'.$prefix.'.css', array(), '1' );
} else {
wp_enqueue_script( 'webpack-dev-server', 'http://localhost:3002/webpack-dev-server.js', array(), null, false );
wp_enqueue_script( 'webpack-bundle', 'http://localhost:3002/hmr/bundle.js', array(), null, false );
}