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
# cloud-config | |
# See https://jonathanbossenger.com/2022/05/25/configuring-ubuntu-in-multipass-for-local-web-development-on-a-macbook/ | |
packages: | |
- software-properties-common | |
- unzip | |
- zip | |
runcmd: | |
# Setting the hostname | |
- echo "Setting the hostname" | |
- echo "wp-local-env" > /etc/hostname |
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 | |
$limit = $_GET['limit'] ?? 10; | |
for ($i = 1; $i <= $limit; $i++) { | |
$numbers[] = $i; | |
} | |
$shuffled = $numbers; | |
shuffle($shuffled); | |
$lines = ''; | |
$line_number = 0; | |
foreach ($numbers as $key => $number) { |
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
#!/bin/bash | |
# Get the PHP version number passed as a variable | |
PHP_VERSION=${1-''} | |
if [[ $PHP_VERSION == '' ]] | |
then | |
echo "Please pass a PHP version number." | |
exit | |
fi |
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
#!/bin/bash | |
# Installation: | |
## Download the script to your home directory | |
# Make sure it has execute permissions (`chmod +x wp-install-core.sh`). | |
# Install the script in one of the folders in your PATH. (`mv wp-install-core /usr/local/bin/wp-install-core-sub-dir`) | |
#Usage: |
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
# Get list of possible audio outputs | |
pactl list short sinks | |
# Will output something like | |
# 1 alsa_output.usb-Samson_Technologies_Samson_Meteor_Mic-00.analog-stereo module-alsa-card.c s16le 2ch 44100Hz IDLE | |
# 2 alsa_output.pci-0000_09_00.4.analog-stereo module-alsa-card.c s16le 2ch 44100Hz SUSPENDED | |
# set the default audio output (taking note of the number) | |
pactl set-default-sink alsa_output.pci-0000_09_00.4.analog-stereo # 2 |
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
wp core download | |
wp config create --dbname=wordpress-clean --dbuser=root --dbpass=password | |
wp core install --url=https://wordpress-clean.test --title="WordPress Clean" --admin_user=admin --admin_password=password --admin_email=jonathanbossenger@gmail.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
// Override the series slug, used by WordPress permalinks | |
// Replace my_ with a custom prefix relevant to your project | |
add_filter( 'ssp_series_slug', 'my_custom_ssp_series_slug' ); | |
function my_custom_ssp_series_slug( $slug ) { | |
return 'podcast_series' | |
} | |
// Override the series taxonomy key, used to create the custom taxonomy | |
// Replace my_ with a custom prefix relevant to your project | |
add_filter( 'ssp_series_taxonomy', 'my_custom_ssp_series_taxonomy' ); |
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
# Set up project to use wp-scripts for asset compilation | |
npm init | |
# Install required packages | |
npm install --save-dev --save-exact @wordpress/scripts | |
# Build assets | |
npm run build | |
# Watch for changes and build | |
npm run start |
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
/** | |
* Register the block in PHP, once wp-scripts has build the assets | |
*/ | |
add_action( 'init', 'register_custom_block' ); | |
function register_custom_block() { | |
// automatically load dependencies and version, from the wp-scripts build | |
$asset_file = include( plugin_dir_path( __FILE__ ) . 'build/index.asset.php' ); | |
// register the main block editor script | |
wp_register_script( |
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
<code_scheme name="PHPStormWordPressJavascriptCodingStandards" version="1"> | |
<JSCodeStyleSettings version="0"> | |
<option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" /> | |
<option name="FORCE_SEMICOLON_STYLE" value="true" /> | |
<option name="SPACE_BEFORE_GENERATOR_MULT" value="true" /> | |
<option name="SPACE_WITHIN_ARRAY_INITIALIZER_BRACKETS" value="true" /> | |
<option name="USE_DOUBLE_QUOTES" value="false" /> | |
<option name="FORCE_QUOTE_STYlE" value="true" /> | |
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" /> | |
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" /> |