Skip to content

Instantly share code, notes, and snippets.

@dfinnema
dfinnema / acf_set_default.php
Last active February 26, 2024 20:35
Wordpress - ACF - Adds all the fields with default values to the Post Meta for Advanced Custom Fields
/**
* Sets the ACF Fields for the specified post
* @param int $post_id
* @param string $post_type
*/
function set_post_defaults_acf($post_id=0,$post_type='') {
if ($post_id &&
$post_type &&
function_exists('update_field')
) {
@dfinnema
dfinnema / Backupify TimeZone to NZ.user.js
Created March 28, 2021 22:06
UserScript for Backupify to get local DateTime Formatting
// ==UserScript==
// @name Backupify TimeZone to NZ
// @version 0.1
// @description Backupify with local DateTime's with DD/MM formating
// @match https://*.backupify.com/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @require https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.33/moment-timezone.min.js
// @grant GM_addStyle

For those that need this functionality to work after updating to the newer version of LocalWP. You can install https://ngrok.com/. You can use the command:

Replace MYDOMAIN with your .local domain

If Using SSL

ngrok http -host-header=rewrite MYDOMAIN.local:443

If not using SSL

@dfinnema
dfinnema / Parked Domain Email Records.txt
Created November 29, 2020 22:36
SPF and DMARC TXT Records
;; TXT Records
. 1 IN TXT "v=spf1 -all"
_dmarc. 1 IN TXT "v=DMARC1; p=reject; pct=100; sp=reject;"
@dfinnema
dfinnema / unifi_delete_vouchers.js
Created August 24, 2020 09:48
Upload file to server. Then run "mongo --port 27117 < unifi_delete_vouchers.js"
/*
* This will delete all Unifi vouchers which creation date is older then the days set.
*
* WARNING: applies to all sites
*
* Tested on Version 5.13.x
*/
// keep N-day worth of data
@dfinnema
dfinnema / unms_cipher.sh
Created February 16, 2019 07:36
Add weaker ciphers to UNMS to ensure older devices can be managed
# Copy the current NGINX conf file from the docker container
# docker cp unms-nginx:/etc/nginx/conf.d/combined.conf ~/combined.conf
#
# Add the following ciphers to combine.conf
# AES256-SHA256
# AES256-SHA
#
# Find the line looking something like:
# ssl_ciphers EECDH:RSA:HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!3DES:!SEED:!IDEA:!MD5:!PSK:!RC4;
#
@dfinnema
dfinnema / ca-update.txt
Created August 27, 2018 01:55
Local by Flywheel cURL SSL Fix
/**
* 1. Right click on the site and choose "Open Site SSH"
* 2. Run the command below.
*/
apt-get update && apt-get install ca-certificates
@dfinnema
dfinnema / functions.php
Created December 12, 2017 22:59
xt-facebook-events - Extension No Event Text
<?php
/**
* Extension for xt-facebook-events
*
* adds custom text when no events are loaded
*
*/
function dfc_shortcode_fb_events_hook_shortcode( $atts_o ) {
@dfinnema
dfinnema / functions.php
Last active February 18, 2020 11:08
Flatsome UX Builder Addon - Scroll Down
/**
*
* Flatsome UX Builder Addon
*
* adds a scroll to mouse animation to parts of the page
*
* Dependent files (in your child theme):
* /css/scroll.min.css
*
* Parent Theme Supported