Skip to content

Instantly share code, notes, and snippets.

View chrisdavidmiles's full-sized avatar
💙

Chris David Miles chrisdavidmiles

💙
View GitHub Profile
@chrisdavidmiles
chrisdavidmiles / cdm-disable-emojis.php
Created August 25, 2022 14:14
WordPress Plugin: Disable Emojis
<?php
/**
* Plugin Name: Disable Emojis
* Plugin URI: https://gist.github.com/chrisdavidmiles/7727d3c4b8b8967f87e6ff0338b8297c
* Description: Disable the automatic emoji replacement in post content and prevent the use of the s.w.org emoji cdn on the site.
* Author: Chris David Miles
* Version: 0.1
*/
@chrisdavidmiles
chrisdavidmiles / auto-rename-uploads-to-match-post-slug.php
Last active August 25, 2022 01:41 — forked from filipecsweb/functions.php
WordPress Plugin: Auto Rename Uploads to Match Post Slug
<?php
/**
* Plugin Name: Auto Rename Uploads to Match Post Slug
* Plugin URI: https://gist.github.com/chrisdavidmiles/770ffbfe428b440fd007bcb6b08e94d7
* Description: Uploads will be automatically renamed to match the post slug
* Author: Chris David Miles
* Version: 0.1
*/
function auto_rename_uploads_to_post_slug( $filename ) {
@chrisdavidmiles
chrisdavidmiles / cdm-require-auth.php
Last active August 24, 2022 02:20
WordPress Plugin: Require Auth
<?php
/**
* Plugin Name: Require Auth
* Plugin URI: https://gist.github.com/chrisdavidmiles/01ad21767394d6b3770197667c32526a
* Description: Users must be logged in to WordPress to see site content. If a user is not authenticated, they will be redirected to the login screen.
* Author: Chris David Miles
* Version: 0.1
*/
if ( ! defined( 'ABSPATH' ) ) die;
@chrisdavidmiles
chrisdavidmiles / cdm-custom-uploads-directory-by-file-type.php
Last active August 24, 2022 00:49 — forked from blainerobison/gist:e802658da007e6e806b1
WordPress Plugin: Custom Uploads Directory By File Type
<?php
/**
* Plugin Name: Custom Uploads Directory By File Type
* Plugin URI: https://gist.github.com/chrisdavidmiles/a7f3fbf09616b4c445a45310c0f88e05
* Description: This plugin automatically sorts uploads into a folder corresponding to their file type. Images go into <code>/img</code>, documents go into <code>/docs</code>, video goes into <code>/img</code>, and the rest goes into <code>/misc</code>. Note: This code doesn't work with 'browser uploader'.
* Author: Forked from Blaine Robison
* Author URI: https://gist.github.com/blainerobison/e802658da007e6e806b1
* Version: 0.2
*/
@chrisdavidmiles
chrisdavidmiles / cdm-automatically-set-featured-image.php
Last active August 24, 2022 00:39 — forked from mestrewp/gist:2820465
WordPress Plugin: Automatically Set the Featured Image
@chrisdavidmiles
chrisdavidmiles / cdm-remove-admin-email-verification.php
Last active June 23, 2023 18:46
WordPress Plugin: Remove Admin Email Verification
<?php
/**
* Plugin Name: Remove Admin Email Verification
* Plugin URI: https://gist.github.com/chrisdavidmiles/94f58cc60fdb34d06a13f946f8ffd155
* Description: Removes the step in /wp-login.php that occasionally asks to confirm if the email on file for a site is still correct.
* Version: 1.0
* Requires at least: 5.3
*/
@chrisdavidmiles
chrisdavidmiles / url-shorteners.txt
Last active April 22, 2023 06:03
URL shorteners and redirect sites
onelink.me/
app.link/
preview-domain.com/
//1click.im/
//1dl.us/
//1o2.ir/
//2tag.nl/
//7.ly/
//9en.us/
//ad7.biz/
@chrisdavidmiles
chrisdavidmiles / 404.html
Created April 30, 2022 03:06
Internet Explorer 4 - Default 404 Page
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>404 - Page Not Found</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="ROBOTS" content="NOINDEX,NOFOLLOW,NOARCHIVE" />
<style type="text/css">
<!--
body { background-color: white; color: black; }
#container { width: 400px; }
@chrisdavidmiles
chrisdavidmiles / 720p.sh
Last active January 19, 2022 01:41
A utility for resizing windows from the command line on OSX.
#!/usr/bin/env bash
#
# 720p
# A utility for resizing windows from the command line on OSX.
# Taken from: https://lostechies.com/derickbailey/2012/09/08/screencasting-tip-resize-your-app-to-720p-1280x720-in-osx/
# Archived copy: https://archive.is/5kr9m
# Archived code: https://gist.github.com/chrisdavidmiles/1b786c4ea62e1883ba31117ca357a838
#
echo "Setting $1 bounds to 720p"
@chrisdavidmiles
chrisdavidmiles / cloudflare-ddns-update.sh
Last active November 29, 2021 18:45 — forked from Tras2/cloudflare-ddns-update.sh
A bash script to update a Cloudflare DNS A record with the external IP of the source machine
#!/usr/bin/env bash
#
# A bash script to update a Cloudflare DNS A record with the external IP of the source machine
#
# Proxy - uncomment and provide details if using a proxy
#export https_proxy=http://<proxyuser>:<proxypassword>@<proxyip>:<proxyport>
# Cloudflare zone is the zone which holds the record
zone=example.com