Skip to content

Instantly share code, notes, and snippets.

View vivianspencer's full-sized avatar

Vivian Spencer vivianspencer

View GitHub Profile
@vivianspencer
vivianspencer / setup.md
Last active January 16, 2024 14:59
Debian 11 LEMP

Debian 11 (bullseye) LEMP setup

Installs

  • MariaDB (latest stable version)
  • PHP 8.3
  • Nginx

  1. Install necessary components to begin this setup
@vivianspencer
vivianspencer / db_backup.sh
Created January 9, 2024 16:34
MariaDB automated backup script
#!/bin/bash
# Adapted from https://www.spacerex.co/how-to-automatically-backup-a-mysql-or-mariadb-server-with-mysqldump/
# Backup storage directory
backupfolder=/var/backups/db
logfile=/var/backups/db-bkp.log
# MySQL user
user=USER
password=PASSWORD
@vivianspencer
vivianspencer / disable-gutenberg-on-post-type.php
Last active September 29, 2021 09:48
Remove gutenberg editor from custom post types #wordpress
<?php
// Remove gutenberg editor from custom post types
function prefix_disable_gutenberg($current_status, $post_type)
{
if (in_array($post_type, ['client'])) {
return false;
}
return $current_status;
}
@vivianspencer
vivianspencer / featured-image.php
Last active September 29, 2021 09:33
Require featured Images
@vivianspencer
vivianspencer / gist:bee32daa7aa2e719f1d9285543e96e31
Created September 2, 2021 06:41
Mailgun API Template Send
curl -s --user 'api:API_KEY' \
https://api.mailgun.net/v3/DOMAIN/messages \
-F from='FROM NAME <FROM EMAIL>' \
-F h:Reply-To='REPLY TO' \
-F subject='SUBJECT LINE' \
-F template='TEMPLATE ID' \
-F o:deliverytime='DELIVERY TIME' \
-F to='RECIPIENT EMAIL' \
-F v:fname='RECIPIENT NAME'
@vivianspencer
vivianspencer / keybase.md
Created November 24, 2020 12:07
keybase.md

vivianspencer Vivian Reuel Spencer UK

Keybase proof

I hereby claim:

  • I am vivianspencer on github.
  • I am vivianspencer (https://keybase.io/vivianspencer) on keybase.
  • I have a public key ASCPOgl2nk3EovYxKsUWIUpMy6zr4hvg8pNJmdyLmbJcOgo
@vivianspencer
vivianspencer / caching.conf
Last active March 23, 2023 03:31
Wordpress PHP7 Nginx LetsEncrypt Config
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
}
# Uncomment one of the lines below for the appropriate caching plugin (if used).
#include snippets/wordpress-wp-super-cache.conf;
#include snippets/wordpress-w3-total-cache.conf;
@vivianspencer
vivianspencer / setup.md
Last active November 14, 2019 11:29
Debian 9 (Stretch) LEMP Setup

Debian 9 LEMP

  1. Set the hostname of the server

    hostnamectl set-hostname johnsmith
    
  2. Make the hostname resolvable. Open the file /etc/hosts in your favourite editor and assign the IPv4 & IPv6 records of the server to your chosen hostname & FQDN.

    127.0.0.1       localhost.localdomain   localhost
    
@vivianspencer
vivianspencer / 0_reuse_code.js
Created January 2, 2017 08:37
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@vivianspencer
vivianspencer / gist:656c8eee367f44e4742192c7e56e39f8
Last active December 21, 2018 09:07
Drupal 8 Get allowed values of field
$values = FieldConfig::loadByName('node', 'BUNDLE', 'FIELD')->getSetting('allowed_values');