Skip to content

Instantly share code, notes, and snippets.

View amityweb's full-sized avatar

Laurence Cope amityweb

View GitHub Profile
@amityweb
amityweb / ee_update.sh
Last active October 15, 2015 16:36
Bash Script to Update Expression Engine from Source Zip
#!/bin/bash
# Save in public folder
# run with "sh ee_update.sh"
# Variables
database=your_db_name
username=your_useraccountname_name
now=$(date +'%Y-%d-%m-%H%M')
@amityweb
amityweb / email-test.php
Last active October 23, 2015 10:18
Simple script to test sending an email to an email address using PHP
<?php
/* DO NOT LEAVE THIS LIVE ON A SERVER */
$sendemail = true; // Simple switch to enable or disable sending to be safe
if (isset($_POST['email']) && $sendemail)
{
$to = $_POST['email'];
@amityweb
amityweb / gist:5419600
Created April 19, 2013 10:47
AppleScript to Move/Archive Mail Emails After Certain Number of Days
on run
tell application "System Events"
set isMailRunning to (count of (every process whose bundle identifier is "com.apple.mail")) > 0
end tell
if isMailRunning then
# Set Date the Mail is Old
set oldemaildate to ((current date) - (71 * days))
@amityweb
amityweb / receive-gmail-at-specified-time.js
Last active December 17, 2015 14:48
Receive GMail Email at a Specified Time
/*
The problem with email is it arrives at the time it arrives, and not when you you want it to arrive,
and it's a common habit to press the Send and Receive button all the time. So this script and technique
will prevent any email that has arrived in Gmail from in fact being downloaded to your mail client apart
from the specified times. Good for productivity, email management and less distractions
This script is best used when a third party mail application is used to read mail, and not the Gmail
interface itself.
GMail Requirements:
@amityweb
amityweb / acf.php
Created January 15, 2017 11:42
Work in progress of using PHP to create ACF fields in Wordpress. Posting here in an effort to improve and make more efficient and easier to manage
<?php
if( function_exists('acf_add_local_field_group') ):
// Main Content Group
acf_add_local_field_group(array
(
'key' => 'content_1',
'title' => 'Content',
'fields' => array (
@amityweb
amityweb / update_pmpro_members_expiry_dates
Created December 22, 2017 16:07
Paid Memberships Pro SQL to Update Expiry Dates for Member Groups
UPDATE wp_pmpro_memberships_users
SET enddate = '2018-01-30 23:59:59'
WHERE (membership_id = 10 OR membership_id = 11)
AND enddate = '0000-00-00 00:00:00'
AND status = 'active';
@amityweb
amityweb / Change Wordpress User Password
Created January 15, 2018 15:59
Show All Wprdpress Users
/***********************
CHANGE USER PASS
Function to programmatically change the users password if you know the ID, and do not have access to the admin interface
***********************/
wp_set_password( 'yourpassword', id ); //
@amityweb
amityweb / instagantt-improvements.js
Created April 18, 2018 09:45
Tampermonkey Instagantt Improvements
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
@amityweb
amityweb / Mail_to_Things.scpt
Last active September 17, 2018 09:43
AppleScript to Add Things task from Mail in Apple Mail Folder
on run
tell application "System Events"
set isThingsRunning to (count of (every process whose bundle identifier is "com.culturedcode.things")) > 0
set isMailRunning to (count of (every process whose bundle identifier is "com.apple.mail")) > 0
end tell
if isThingsRunning and isMailRunning then
tell application "Mail"
@amityweb
amityweb / .htaccess
Last active November 2, 2018 20:02
My .htaccess redirects for with or without www and with HTTPS
# REDIRECT TO WWW and HTTPS
#RewriteEngine On
#RewriteCond %{HTTP_HOST} !^www.domainname.co.uk$ [OR]
#RewriteCond %{SERVER_PORT} 80
#RewriteRule (.*) https://www.domainname.co.uk/$1 [R=301,L]
# REDIRECT TO WITHOUT WWW and HTTPS
#RewriteEngine On
#RewriteCond %{HTTP_HOST} !^domainname.co.uk$ [OR]
#RewriteCond %{SERVER_PORT} 80