Skip to content

Instantly share code, notes, and snippets.

View macbookandrew's full-sized avatar

Andrew Minion macbookandrew

View GitHub Profile
@macbookandrew
macbookandrew / backup-to-Glacier.sh
Last active May 4, 2025 23:02
Ubuntu incremental encrypted backups to S3/Glacier
#!/bin/bash
#
# Note, to pull a file from s3 use "s3cmd get s://bucket/file destinationfile"
# You must have the proper .s3cfg file in place to decrypt the file.
# You may also use "gpg encryptedfile" and supply the encryption code if you download
# from the web interface. Good luck.
# The bucket should be set to transfer to Glacier. To retreive, you need to initiate a
@macbookandrew
macbookandrew / findStyles.js
Last active February 16, 2025 03:00
List unique CSS properties for all DOM elements
/**
* List unique CSS properties for all DOM elements
* Initially created to list unique font stacks on a page
* @see {@link http://stackoverflow.com/a/35022690/ Inspired by this StackOverflow answer}
*
* @see {@link https://gist.github.com/macbookandrew/f33dbbc0aa582d0515919dc5fb95c00a/ URL for this file}
*
* @author AndrewRMinion Design (https://andrewrminion.com)
* @version 1.1
*
@macbookandrew
macbookandrew / merge-minify-refresh-async.php
Last active December 26, 2024 16:08
Force merged scripts created by “Merge + Minify + Refresh” to load asynchronously to improve site performance
<?php
/*
* Plugin Name: Merge + Minify + Refresh: Force Async Scripts
* Plugin URL: https://gist.github.com/macbookandrew/0bb0c29b2321c166845cea0b7cdb5d15
* Description: Forces merged scripts created by “Merge + Minify + Refresh” to load asynchronously to improve site performance
* Version: 1.0.0
* Author: AndrewRMinion Design
* Author URI: https://andrewrminion.com
*/
@macbookandrew
macbookandrew / readme.md
Last active September 13, 2024 13:44
Laravel VS Code Workspace Tasks

Runs these tasks automatically when the workspace is opened:

  1. npm run dev: recompiles assets when modified; useful for Tailwind JIT mode, Vite, etc.
  2. php artisan horizon: runs Horizon queue monitor
  3. php artisan schedule:work: runs scheduled tasks
  4. php artisan pulse:check: runs Pulse watcher
  5. Prunes failed queue jobs and telescope logs on open
@macbookandrew
macbookandrew / worker.js
Created August 23, 2023 19:40
Cloudflare worker proxy for signed AWS S3 URLs
addEventListener('fetch', event => {
event.respondWith(handleRequest(event))
})
async function handleRequest(event) {
let url = new URL(event.request.url);
url.hostname = 'my-secure-bucket.s3-us-east-2.amazonaws.com';
let response = await fetch(url);
@macbookandrew
macbookandrew / WP-theme-version-filename.php
Last active June 15, 2022 19:51
WordPress theme stylesheet auto cache-busting
<?php
/**
* Autocalculate and define theme version constant for use in multiple stylesheets/scripts
*/
define( 'MY_THEME_VERSION', wp_get_theme()->get( 'Version' ) );
/**
* Enqueue stylesheet
*
@macbookandrew
macbookandrew / HasRefinements.php
Created September 24, 2021 01:46
MeiliSearch PHP facets
<?php
trait HasRefinements
{
public static function convertFiltersForMeiliSearch(array $filters, mixed $parentKey = null)
{
$return = [];
foreach ($filters as $key => $value) {
if (! is_null($parentKey)) {
@macbookandrew
macbookandrew / readme.md
Last active March 8, 2020 19:31
PHP cURL proxy for Ajax—Infusionsoft

Introduction

This is a PHP proxy to submit Ajax requests to Infusionsoft.

Usage

  1. Set your Infusionsoft app id, thank-you message, and path to the cacert.pem bundle in infusionsoft-proxy-settings.php.
  2. Add the Infusionsoft form IDs in infusionsoft-proxy.php, creating new lines as necessary
  3. Include the functions.js in your javascript, making sure to replace the $form variable with the selector(s) you need.
@macbookandrew
macbookandrew / a-seriously-simple-private-podcasting.php
Last active April 25, 2019 01:35
Addon plugin for Seriously Simple Podcasting; includes private podcasts in feed URL
<?php
/**
* Plugin Name: Seriously Simple Private Podcasting
* Plugin URL: https://gist.github.com/macbookandrew/b3e08a9e35a44526e47ecb35d1113c8f
* Description: Include posts marked “private” in podcast feed. Note: activate this <strong>first</strong>, then the Seriously Simple Podcasting plugin.
* Version: 1.1.5
* Author: AndrewRMinion Design
* Author URI: https://andrewrminion.com
*
* @author AndrewRMinion Design
@macbookandrew
macbookandrew / give-get-goal-fix.php
Created February 25, 2019 18:06
Returns false if goal is disabled
<?php
/**
* Plugin Name: Give - <code>get_goal()</code> fix
* Plugin URI: https://luminfire.com
* Description: Forces <code>get_goal()</code> to return false if goal is disabled for the form.
* Version: 1.0.0
* Author: LuminFire (Andrew Minion)
* Author URI: https://luminfire.com/
*
* @package give-get-goal-fix