Skip to content

Instantly share code, notes, and snippets.

View brettsmason's full-sized avatar

Brett Mason brettsmason

  • Orphans
  • Hereford, UK
View GitHub Profile
@brettsmason
brettsmason / block.json
Last active November 30, 2023 12:49
Registering a variation of the Pulsar carousel block
// block.json example for our custom child block.
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "pulsar/posts",
"parent": ["pulsar/carousel"],
"version": "0.1.0",
"title": "Posts",
"category": "text",
@brettsmason
brettsmason / blocks.php
Last active June 16, 2023 10:39
Link option for group block
<?php
add_action( 'render_block', [ $this, 'render_link_toolbar' ], 5, 2 );
/**
* Block link.
*
* @param mixed $block_content The block content.
* @param array $block The block data.
*
* @return mixed Returns the new block content.
@brettsmason
brettsmason / input.scss
Created December 16, 2022 11:04
Generated by SassMeister.com.
/// Check if a string contains a number.
@function string-is-number($string) {
// Matrices
$numbers: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';
@for $i from 1 through str-length($string) {
$character: str-slice($string, $i, $i);
$index: index($numbers, $character);
@brettsmason
brettsmason / vscode-setup-guide.md
Last active July 1, 2024 09:13
VS Code Setup Guide

VS Code Setup Guide

This guide is focused around WordPress development and the requirements of using that day-to-day.

Install extensions

These can be installed in VS Code: Launch VS Code, Quick Open (CMD+P), paste the following command, and press enter.

ext install esbenp.prettier-vscode stylelint.vscode-stylelint dbaeumer.vscode-eslint
@brettsmason
brettsmason / Product.php
Created September 8, 2022 08:12
Adding a sidebar section to Gutenberg
<?php
/**
* Product post type
*
* @package Pulsar
*/
namespace Pulsar\PostTypes;
use Pulsar\Contracts\Bootable;
@brettsmason
brettsmason / mac-setup.md
Last active May 9, 2023 08:07
Mac Setup

Mac Setup

Homebrew

Install Homebrew as package manager for macOS:

/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
@brettsmason
brettsmason / imagick3.4.4-PHP7.4-forge.sh
Created March 28, 2021 15:43 — forked from danielstgt/imagick3.4.4-PHP7.4-forge.sh
Install ImageMagick / Imagick 3.4.4 on PHP 7.4 server (Laravel Forge)
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
apt-get install pkg-config libmagickwand-dev -y
cd /tmp
wget https://pecl.php.net/get/imagick-3.4.4.tgz
tar xvzf imagick-3.4.4.tgz
@brettsmason
brettsmason / wsl-setup.md
Last active December 23, 2021 08:19
WSL Setup
@brettsmason
brettsmason / woocommerce-admin-hooks.md
Last active March 16, 2021 14:12
WooCommerce Admin Hooks

General Tab

woocommerce_product_options_pricing
woocommerce_product_options_downloads
woocommerce_product_options_tax
woocommerce_product_options_general_product_page

Inventory Tab

@brettsmason
brettsmason / .lando.yml
Created November 12, 2020 07:17
Lando base config
name: example
recipe: wordpress
proxy:
appserver_nginx:
- example.lndo.site
mailhog:
- mail.example.lndo.site
theme:
- localhost:3000