Skip to content

Instantly share code, notes, and snippets.

View ambercouch's full-sized avatar

Richard Arnold ambercouch

View GitHub Profile
@ambercouch
ambercouch / plugin.php
Created July 18, 2023 14:22
WP AFC - include acf if not already active
<?php
add_action('init', 'acsab_init', 0);
function acsab_init(){
if((! is_plugin_active('advanced-custom-fields/acf.php'))&& ( ! is_plugin_active('advanced-custom-fields-pro/acf.php')))
{
// Define path and URL to the ACF plugin.
define( 'ACSAB_ACF_PATH', 'inc/acf/' );
define( 'ACSAB_ACF_URL', plugin_dir_url( __FILE__ ) . 'inc/acf/' );
<?php
/**
*******************************************************************************
* MAL: Maintenance Auto-Login.
*******************************************************************************
* Automatically logs you in as the first admin user found in the WordPress
* database.
*
* How to use it:
*
df -hT
sudo resize2fs /dev/nvme0n1p1
sudo chmod -R 777 .env composer.* config storage vendor public/cpresources
#From the root of your wordpress install
#cd in to the theme folder
cd wp-content/themes/
#download ac timber
git clone git@github.com:ambercouch/ac_timber.git ac_timber
#Swich to the master branch or whatever branch you want to use
cd ac_timber
@ambercouch
ambercouch / copy-database.sh
Last active May 25, 2021 10:45
Mysql copy database
sudo mysqldump -u root --password=<pwd> <original db> | sudo mysql -u root --password=<pwd> <new db>
sudo chown -R bitnami:daemon public
sudo find public -type d -exec chmod 775 {} \;
sudo find public -type f -exec chmod 664 {} \;
sudo chmod 640 public/wp-config.php
cp -a /source/. /dest/
@ambercouch
ambercouch / axio-snippet.js
Last active February 18, 2020 12:21
Fix Shopify slate and browsersync issue and axio issue
return axios('https://v.shopify.com/slate/track', axiosConfig).catch(() => {});
@ambercouch
ambercouch / bbd-geo-ip.html
Created October 28, 2019 09:13
BBD Geo ip
<script type="text/javascript">
$(document).ready(function(){
$('a[href^="#"]').on('click',function (e) {
e.preventDefault();
var target = this.hash;
var $target = $(target);
$('html, body').stop().animate({
'scrollTop': $target.offset().top
}, 900, 'swing', function () {
window.location.hash = target;