This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on this answer: https://stackoverflow.com/a/61859561/1956278 | |
# Backup old data | |
Rename-Item -Path "./data" -NewName "./data_old" | |
# Create new data directory | |
Copy-Item -Path "./backup" -Destination "./data" -Recurse | |
Remove-Item "./data/test" -Recurse | |
$dbPaths = Get-ChildItem -Path "./data_old" -Exclude ('mysql', 'performance_schema', 'phpmyadmin') -Recurse -Directory | |
Copy-Item -Path $dbPaths.FullName -Destination "./data" -Recurse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'graphql_PostObjectsConnectionOrderbyEnum_values', function( $values ) { | |
$values['LIKE_COUNT'] = [ | |
'value' => 'like_count', | |
'description' => __( 'The number of likes on the post', 'wp-graphql' ), | |
]; | |
return $values; | |
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// check version | |
node -v || node --version | |
// list locally installed versions of node | |
nvm ls | |
// list remove available versions of node | |
nvm ls-remote | |
// install specific version of node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source: https://www.youtube.com/watch?v=gEceSAJI_3s | |
# create a .env file for db creds | |
version: '3.1' | |
services: | |
database: | |
mem_limit: 2048m | |
image: mariadb:10.6.4-focal | |
restart: unless-stopped |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Don't try to be vi compatible | |
set nocompatible | |
" Helps force plugins to load correctly when it is turned back on below | |
filetype off | |
" TODO: Load plugins here (pathogen or vundle) | |
" Turn on syntax highlighting | |
syntax on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB | |
if (!window.indexedDB) { | |
console.log('Your browser does not support indexedDB!') | |
} | |
const customerData = [ | |
{ ssn: "444-44-4444", name: "Bill", age: 35, email: "bill@company.com" }, | |
{ ssn: "555-55-5555", name: "Donna", age: 32, email: "donna@home.org" }, | |
{ ssn: "344-44-4444", name: "Bill", age: 31, email: "billl@company.com" }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// const savedTimestamp = 1690509844000 // saved over 12 hours ago in localStorage | |
const savedTimestamp = 1690553044000 // saved under 12 hours ago in localStorage | |
const twelveHoursDifference = 43200000 // 12 hours in milliseconds | |
const now = new Date().getTime() // current timestamp | |
const isDataStale = (now, timestamp, difference) => now > timestamp + difference | |
const shouldRefresh = isDataStale(now, savedTimestamp, twelveHoursDifference) | |
console.log(shouldRefresh) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Render fields at the bottom of variations - does not account for field group order or placement. | |
add_action( 'woocommerce_product_after_variable_attributes', function( $loop, $variation_data, $variation ) { | |
global $abcdefgh_i; // Custom global variable to monitor index | |
$abcdefgh_i = $loop; | |
// Add filter to update field name | |
add_filter( 'acf/prepare_field', 'acf_prepare_field_update_field_name' ); | |
// Loop through all field groups | |
$acf_field_groups = acf_get_field_groups(); | |
foreach( $acf_field_groups as $acf_field_group ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
This script will allow you to send a custom email from anywhere within wordpress | |
but using the woocommerce template so that your emails look the same. | |
Created by craig@123marbella.com on 27th of July 2017 | |
Put the script below into a function or anywhere you want to send a custom email | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE wp_users SET user_nicename = "new_username", user_login = "new_username" WHERE user_login = "old_username"; | |
SELECT * FROM wp_users WHERE user_login = "new_username"; |
NewerOlder