Skip to content

Instantly share code, notes, and snippets.

View leepeterson's full-sized avatar
:octocat:

Lee Peterson leepeterson

:octocat:
View GitHub Profile
@leepeterson
leepeterson / ajax-endpoint.js
Created February 21, 2020 06:33 — forked from jtsternberg/ajax-endpoint.js
Proof of concept for avoiding admin-ajax for ajax callback requests. Also see Thomas Griffin's excellent post: https://thomasgriffin.io/a-creative-approach-to-efficient-and-scalable-wordpress-api-endpoints/ AND Josh Pollock's excellent post: http://torquemag.io/improved-wordpress-front-end-ajax-processing/
jQuery(document).ready(function($){
$('body').on( 'click', '.some-button', function(){
$.ajax( ajax_endpoint_data.api_url, {
type : 'POST',
dataType : 'json',
data : {
action: 'ajax_action',
some_data: 'some_value'
}
BEGIN MESSAGE.
DmYpv22sDKnrQCF sHm3k0xkRdy3kCg ucRrQkeHRJdwAnE ynbE3eZIbvRplW5
2uupd39gpwrbRcT XaIYghyWfhWTCKq 6Xr2MZHgg6ScDAZ 6VbSGcpm1gY1fwx
NGtBhC3uXSVRAFv Mmdkxr7m1or4wss 6SejbS5SjuDwgRM 9XVxTmNRYOqogYU
j68YmUVyxVVhOsA QkQ05RMla02cfW5 eh0p70aLMzWSiL.
END MESSAGE.
@leepeterson
leepeterson / acf-disable-frontend.php
Last active September 17, 2020 07:27 — forked from billerickson/be-disable-acf-frontend.php
Disable ACF functions on the front-end of WordPress in order to provide a performance boost.
<?php
/**
* Plugin Name: Disable ACF on Frontend
* Description: Disable ACF functions on the front-end of WordPress in order to provide a performance boost.
* Version: 2.0
* Author: Lee Peterson
* Author URI: http://www.leepeterson.me
* License: MIT
* License URI: http://www.opensource.org/licenses/mit-license.php
*/
@leepeterson
leepeterson / AdminPage.php
Created August 27, 2020 17:33 — forked from carlalexander/AdminPage.php
WordPress and the single responsibility principle
<?php
namespace WPMemeShortcode;
/**
* The WordPress Meme Shortcode admin page.
*
* @author Carl Alexander
*/
class AdminPage
@leepeterson
leepeterson / class-processor.php
Created August 18, 2020 01:13 — forked from carlalexander/class-processor.php
WordPress routing system
<?php
/**
* The Processor is in charge of the interaction between the routing system and
* the rest of WordPress.
*
* @author Carl Alexander <contact@carlalexander.ca>
*/
class Processor
{
# HTTPS Server
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
root /var/www/html;
index index.html index.htm index.php;
server_name example.com;
ssl_certificate /etc/nginx/ssl/example.com.crt;
ssl_certificate_key /etc/nginx/ssl/example.com.key;

Keybase proof

I hereby claim:

  • I am leepeterson on github.
  • I am lee_ (https://keybase.io/lee_) on keybase.
  • I have a public key ASBqoE2LA3QwrdQNfxhtGnVIeOy4XzTlxHUD0Y6CHoZpOgo

To claim this, I am signing this object:

@leepeterson
leepeterson / gist:2a00685bf9ffa0d7d2a421ad841f2598
Created February 21, 2020 06:35 — forked from tomjn/gist:6140909
If you're thinking of using WP_Query, try using this iterator instead, cleaner boilerplate, auto-cleans up after itself
<?php
$pages = new query_loop( array(
'post_type' => 'page'
));
foreach( $pages as $id => $post ) {
the_title();
// etc...
}
@leepeterson
leepeterson / rm-video-formats.md
Last active February 19, 2020 16:55 — forked from Vestride/encoding-video.md
Rawle Murdy's Web Video Requirements

Rawle Murdy's Web Video Requirements

As of July 2018:

  1. 4K WebM video encoded with VP9

2a. 1080p MP4 video encoded with HEVC/H.265

2b. Optional: 1080p MP4 encoded with MPEG-4/H.264 (if Windows Mobile and IE8-11 support is required)

@leepeterson
leepeterson / 000-my-supplement.md
Created September 28, 2019 16:07 — forked from aramoudi/000-my-supplement.md
[React snippets] from Udacity Nanodegree #React

Udacity HTML, CSS, JS Style Guide

  • A good function should follow the "DOT" rule:

    • Do One Thing
  • Composition is to combine simple functions to build more complicated ones

    • React builds up pieces of a UI using components.
      • كل فنكشن ترجع UI
  • Declarative code vs imperative code