Skip to content

Instantly share code, notes, and snippets.

View afragen's full-sized avatar

Andy Fragen afragen

View GitHub Profile
marcoarment / S3.php
Last active June 18, 2024 14:15
A simple PHP class to perform basic operations against Amazon S3 and compatible services.
A simple PHP class to perform basic operations against Amazon S3 and compatible
services. Requires modern PHP (7+, probably) with curl, dom, and iconv modules.
Copyright 2022 Marco Arment. Released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
petertwise / git-updater-upgrade
Last active May 27, 2021 19:26
Upgrade from github-updater 9.x to git-updater 10.x and git-updater-pro
# Upgrade from github-updater 9.x to git-updater 10.x and git-updater-pro
# Instructions:
# 1. make sure you have WP CLI installed
# 2. install this file in /usr/local/bin or the executable path of your choice and make sure it has execute permissions
# 3. make a file called .gitupdater-download-link with the your personal download link and save it to /user/local/bin
# 4. make a file called .gitupdater-license-key with the your pro license key and save it to /user/local/bin
# 5. cd into your website's root dir and run `git-updater-upgrade`
name: Version checks
- master
# Compares the header information in the readme.txt and the main plugin file
westonruter / shutdown-handler.php
Last active March 22, 2019 18:48
Disable WSOD detection on WordPress 5.1 so that fatal errors during development don't constantly cause plugins to suspend
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName
* Plugin Name: Non-Handling Shutdown Handler
* Description: Disable WSOD protection so that plugins will not auto-suspend during development while errors often occur.
* Plugin URI:
* Plugin Author: Weston Ruter
Rarst / github-release-download.php
Last active May 13, 2019 02:27
Quick and dirty WP endpoint to redirect to a download of attached file for a latest GitHub release.
declare( strict_types=1 );
new class( 'Rarst', [ 'laps' ] ) {
private $owner, $repos;
private $endpoint = 'download';
public function __construct( string $owner, array $repos ) {
nickcernis /
Last active June 2, 2024 18:31
Exclude node_modules and .git from Backblaze backups on Mac

Exclude node_modules and .git from Backblaze backups on Mac

  1. Edit the file at /Library/Backblaze.bzpkg/bzdata/bzexcluderules_editable.xml.
  2. Add these rules inside the bzexclusions tag:
<!-- Exclude node_modules. -->
<excludefname_rule plat="mac" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/node_modules/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="mac" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/.git/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
mirhec /
Created September 20, 2017 07:14
Installing Gitea on Raspberry Pi with nginx, SSL and automatic backups

Setup Gitea on Raspberry Pi (3)

These instructions are based on this article:

Setup Raspberry Pi with minimal Raspbian image. You need to connect to the HDMI port and set the following:

sudo raspi-config

There you need to enable the SSH server and you should change the hostname.

keesiemeijer /
Last active December 8, 2023 11:02
Setup PHPUnit for use in the Local by Flywheel app
#!/usr/bin/env bash
# ===============================================================================
# Script to install PHPUnit in the Local by Flywheel Mac app
# These packages are installed
# PHPUnit, curl wget, rsync, git, subversion and composer.
# WordPress is installed in the `/tmp/wordpress` directory for use by PHPUnit.
# The WordPress test suite is installed in the `/tmp/wordpress-tests-lib` directory.
schlessera / Autoloader.php
Last active August 23, 2020 13:39
Generic Autoloader
<?php namespace Generic;
use RuntimeException;
* Class Autoloader.
* This is a custom autoloader to replace the functionality that we would
* normally get through the autoloader generated by Composer.
GaryJones / PluginTest.php
Last active August 2, 2016 18:12
Test that plugin called `load_plugin_textdomain()` correctly.
namespace GAA\CorpManager;
use WP_UnitTestCase;
class PluginTest extends WP_UnitTestCase {
private $domain;
private $mofile;