Skip to content

Instantly share code, notes, and snippets.

View lstellway's full-sized avatar

Logan Stellway lstellway

View GitHub Profile
@lstellway
lstellway / distribute
Last active February 22, 2022 22:39
Distribute files in a directory to subfolders based on URL's in a specified file.
#!/bin/bash
# Loop through links
while IFS="" read -r LINE || [ -n "$LINE" ]; do
# Replace domain (everything before "/media")
PATH=${LINE//**\/media/media}
# Get file file name (everything after the last "/")
FILE_NAME=${PATH//*\//}
@lstellway
lstellway / operator.yml
Created February 4, 2022 21:17
PlanetScale.com - Vitess Operator for Kubernetes `v1.21.1`
# Version: 20200918: 25ca1bc881f433d2a42c3b5f59da416f4ef6dc44
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.4
creationTimestamp: null
name: etcdlockservers.planetscale.com
spec:
group: planetscale.com
@lstellway
lstellway / wordpress-json-postmeta-search.php
Created September 12, 2018 17:18
WordPress include wp_postdata meta fields in search query
<?php
/**
* Reference: https://websmartdesign.nz/searching-structured-post-data-with-wordpress/
* Make meta data searchable
*/
// Join wp_postmeta
add_filter('posts_join', function($join) {
global $wpdb;
@lstellway
lstellway / photoshop-save-for-web-jpg.jsx
Last active December 22, 2020 16:51
Photoshop Save for Web Script
/**
* Add array indexOf() method
*
* @param {object} Object
* @param {int} max
* @param {int} min)
* @return {mixed}
*/
if (!Array.prototype.indexOf) Array.prototype.indexOf = (function(Object, max, min){
"use strict";
<?php
/*
Plugin Name: GraphQL Meta Queries
Plugin URI: https://loganstellway.com
Description: Extends WPGraphQL to allow meta queries on post connections
Version: 0.0.1
Author: Logan Stellway
Author URI: https://loganstellway.com
*/
<?php
/*
Plugin Name: GraphQL Meta Queries
Plugin URI: https://loganstellway.com
Description: Extends WPGraphQL to allow meta queries on post connections
Version: 0.0.1
Author: Logan Stellway
Author URI: https://loganstellway.com
*/
@lstellway
lstellway / Google Spreadsheet Post
Created June 25, 2020 05:19
Post data to a Google Spreadsheet
/**
* @see http://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/
* @see https://gist.github.com/willpatera/ee41ae374d3c9839c2d6
*/
// Sheet name
const SHEET_NAME = "Submissions";
// Property service
const ScriptProps = PropertiesService.getScriptProperties();
@lstellway
lstellway / GIF-Screencast-OSX.md
Created May 30, 2020 00:36 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

# Aliases
alias c="clear"
alias ll="ls -lah"
alias lz="ls -laZ" # include (selinux) security context in listing
alias cl="c && ll"
alias ..="cd .."
# Empty contents of files
empty() {
for arg in "$@"
<?php
/**
* Force Login
*/
function force_login() {
if (!is_user_logged_in()) {
$url = home_url($_SERVER['REQUEST_URI']);
$whitelist = [];