This file contains hidden or 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
NEW_PHP_VERSION=$1 | |
if [ -z "$NEW_PHP_VERSION" ]; then | |
echo "Please provide a PHP version to switch to." | |
exit 1 | |
fi | |
CURRENT_PHP_VERSION=$(php -v | tail -r | tail -n 1 | cut -d " " -f 2 | cut -c 1-3) | |
brew unlink php@"$CURRENT_PHP_VERSION" && brew link php@"$NEW_PHP_VERSION" --force --overwrite |
This file contains hidden or 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 | |
/** | |
* Plugin Name: WP Learn Dashboard Widgets | |
* Description: A plugin to add a widget to the dashboard | |
*/ | |
add_action('wp_dashboard_setup', 'wp_learn_dashboard_widget_callback'); | |
function wp_learn_dashboard_widget_callback(){ | |
if (!current_user_can('manage_options')) { |
This file contains hidden or 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
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Learn WordPress</title> | |
</head> | |
<body style="margin: 2em;"> | |
<h1>Learn WordPress</h1> | |
<div> | |
<?php |
This file contains hidden or 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
( function ( blocks, element, blockEditor ) { | |
var el = element.createElement; | |
var RichText = blockEditor.RichText; | |
var useBlockProps = blockEditor.useBlockProps; | |
var BlockControls = blockEditor.BlockControls; | |
var AlignmentControl = blockEditor.AlignmentControl; | |
blocks.registerBlockType( 'wp-learn-javascript/javascript-block', { | |
edit: function ( { attributes, setAttributes } ) { |
This file contains hidden or 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--preset--color--black: #000000; | |
--wp--preset--color--cyan-bluish-gray: #abb8c3; | |
--wp--preset--color--white: #ffffff; | |
--wp--preset--color--pale-pink: #f78da7; | |
--wp--preset--color--vivid-red: #cf2e2e; | |
--wp--preset--color--luminous-vivid-orange: #ff6900; | |
--wp--preset--color--luminous-vivid-amber: #fcb900; | |
--wp--preset--color--light-green-cyan: #7bdcb5; | |
--wp--preset--color--vivid-green-cyan: #00d084; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |