Skip to content

Instantly share code, notes, and snippets.

View vivianspencer's full-sized avatar

Vivian Spencer vivianspencer

View GitHub Profile
@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 / form_embed.js
Last active January 5, 2025 15:09
Act-On form embed code
var _aoFormLoader = (function(w) {
var stylesLoaded = false;
var captchaLoaded = false;
var gfLoaded = false;
var htmlId = false;
var scheme = document.location.protocol + "//";
var loadForm = function(options) {
@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');
@vivianspencer
vivianspencer / gist:4b774f7150e675c81e4d3423d9c118d6
Created October 23, 2016 06:55
Drupal 8: Move taxonomy terms to another vocabulary
UPDATE taxonomy_term_data SET vid = 'NEW_TAXONOMY' WHERE vid = 'OLD_TAXONOMY';
UPDATE taxonomy_term_field_data SET vid = 'NEW_TAXONOMY' WHERE vid = 'OLD_TAXONOMY';
@vivianspencer
vivianspencer / gist:6c76bed1235de14245fe3c3a60785a12
Created August 4, 2016 09:42
Largest Top 10 Files and Directories on a Linux machine
du -hsx * | sort -rh | head -10
@vivianspencer
vivianspencer / gist:1bf32ef808e7a8863d8e6c461d885278
Created August 1, 2016 20:31
generate SHA512 crypted passwords on OSX
pip install passlib
python -c "from passlib.hash import sha512_crypt; import getpass; print sha512_crypt.encrypt(getpass.getpass())"
@vivianspencer
vivianspencer / gist:3dc942462b1ac10e3210bc4dd486e180
Created June 22, 2016 07:14
Fix block is broken or missing error in Drupal 8 Config
UPDATE block_content SET uuid = 'uuid from block yml file' WHERE id = 'id of another block to match';
@vivianspencer
vivianspencer / functions.php
Created March 5, 2016 17:51
Verbose Beautified Date Range
/**
* Verbose Beautified Date Range
*
* @access public
* @param mixed $start_date
* @param mixed $end_date
* @return string $date_range (beautified date range)
* @license WTFPL
*
* @author Jon Brown <[email protected]>