Skip to content

Instantly share code, notes, and snippets.

@mattbell87
mattbell87 / gap-webkit.scss
Created March 1, 2022 05:54
iOS / Webkit support for gap
display: flex;
gap: 40px;
@supports not (gap: 40px) {
> div {
margin-left: 40px;
}
> div:first-of-type {
margin-left: 0px;
}
}
@mattbell87
mattbell87 / acf-fields.md
Last active January 30, 2022 12:07
Update ACF field for all posts

Here is a quick hack to update an ACF (Advanced Custom Fields) field in WordPress.

Place this in functions.php:

// Update all post
function update_all_posts() {
    $args = array(
        'post_type' => 'event', //or post, page etc
 'numberposts' => -1
@mattbell87
mattbell87 / vagrant-docker.md
Last active July 9, 2021 01:11
Set up a Vagrant VM for docker-based development

Why use this method?

Use this method when:

  • Docker Desktop doesnt work on your system, or you don't prefer to use it
  • You prefer to keep your development in a VM

Install Vagrant and VirtualBox

Vagrant is a VM (Virtual Machine) management tool that runs on Mac, Windows and Linux. By installing this you'll be up and running much faster.

@mattbell87
mattbell87 / acfpro.md
Created May 4, 2021 07:05
Download ACF Pro

Download ACF Pro with your license key

Set the license key

export acflicense="licensekeyhere"

Download

wget -O ./acf-pro.zip "https://connect.advancedcustomfields.com/index.php?p=pro&a=download&k=$acflicense"
@mattbell87
mattbell87 / checkifinstalled.sh
Created May 3, 2021 00:09
Check if a cli app is installed
#!/bin/bash
isInstalled()
{
command -v "$1" >/dev/null 2>&1
}
if isInstalled $1; then
echo "YES"
else
echo "NO"
@mattbell87
mattbell87 / powershell-docker.md
Last active December 15, 2020 01:11
Use docker for powershell on linux

Powershell on Linux with Docker

This is the method I used to run Powershell on Alpine Linux as there was no official repo available (you can only install manually). So here I'm using Docker to automatically provide the latest version of Powershell.

With this you can run Powershell scripts on your host (without being in a docker container shell), just use the normal pwsh command line paramaters.

pwsh my-script.ps1
@mattbell87
mattbell87 / remote-wsl.md
Last active April 6, 2025 11:03
VSCode Remote: Connect to WSL2 from another machine

VSCode Remote: Connect to WSL2 from another machine

Do you want to do remote development on your WSL2 container in Visual Studio Code? Read this.

Proxy jump method

  1. On the host set up OpenSSH for Windows
  2. Run wsl --update to make sure you are running the latest WSL
  3. Open WSL and install another SSH server inside WSL with sudo apt-get install openssh-server
  4. Now run sudo systemctl enable --now ssh to automatically start ssh when WSL starts.
@mattbell87
mattbell87 / woo-template.sh
Last active August 4, 2021 00:54
List, search, view and copy woocommerce templates inside a docker container
#!/bin/bash
#
# This script helps with browsing and copying over woo templates from the docker container
#
dockerContainer="your-container-name-here"
templateDir="/var/www/html/wp-content/plugins/woocommerce/templates"
if [ "$1" = "list" ]; then
docker exec $dockerContainer bash -c - "cd $templateDir && find ."
@mattbell87
mattbell87 / dev.md
Last active August 3, 2020 07:50
Remote development on Fedora with Docker and Code-Server

Remote development on Fedora with Docker and Code-Server

This guide assumes you have a working Fedora installation with SSH access.

Prepare

Disable CGroups V2 as Docker doesnt support that yet.

sudo dnf install grubby
@mattbell87
mattbell87 / ace-editor-ant.js
Created March 20, 2020 02:59
Ace Editor in Ant Design v4
<Form.Item name="styles" label="Custom CSS Styles">
<AceEditor
ref={this.ace}
mode="css"
theme="tomorrow"
name={this.props.name}
fontSize={14}
showPrintMargin={true}
showGutter={true}
highlightActiveLine={true}