Skip to content

Instantly share code, notes, and snippets.

Avatar

Denis Žoljom dingo-d

View GitHub Profile
@dingo-d
dingo-d / function.sh
Created Sep 19, 2022
Scripts to quickly create wp site using wpcli
View function.sh
#!/bin/zsh
# WP-CLI site setup for Windows
# Usage create-site {folder name} {database name} {site title}
create-site () {
if [ $1 ]
then
mkdir $1 && cd $1
wp core download --skip-content;
wp config create --dbname=$2 --dbuser=root;
@dingo-d
dingo-d / BookCptOOPTest.php
Last active May 16, 2022
Example of WP unit tests with Pest. Doesn't include the entire setup, for that you can check https://github.com/dingo-d/wp-pest-integration-test-setup
View BookCptOOPTest.php
<?php
use TestPlugin\Cpt;
// Unit test with OOP code.
it('checks that the hook is registered for custom post type registration', function() {
$this->stubTranslationFunctions();
(new RegisterBookCpt())->register();
@dingo-d
dingo-d / application-blocks-editor.js
Created Jul 14, 2021
Color picker meta that adds inline css variable using ACF color palette
View application-blocks-editor.js
// Only run if ACF is active.
if (typeof acf !== 'undefined') {
acf.add_filter('color_picker_args', function (args, $field) {
// Add predefined color palette.
args.palettes = ['#5D2BFF', '#FFE194', '#E45353', '#96DFFF', '#FFBDA7', '#8CEAB7', '#ECA7C8'];
return args;
});
}
@dingo-d
dingo-d / wsl2-dns-fix.md
Created Jun 12, 2021
Fixing the valet and DNS resolving in WSL2
View wsl2-dns-fix.md

If the local sites aren't working, or some services, these are possible fixes.

Check the /etc/resolv.conf file, it should look like this

# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
generateResolvConf = false
nameserver 172.17.48.1
@dingo-d
dingo-d / docker-composer.yaml
Created May 22, 2021
Example of docker compose file with WP and WP-CLI (allowed root). Note to self: when specifying command parameter in the compose file you'll need to add the default entrypoint and commands that are running on the default image you're pulling info from.
View docker-composer.yaml
version: "3.9"
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
@dingo-d
dingo-d / .zshrc
Created May 22, 2021
My default .zshrc config
View .zshrc
# If you come from bash you might have to change your $PATH.
ZSH_DISABLE_COMPFIX=true
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="agnoster"
@dingo-d
dingo-d / build.log
Created Jul 21, 2020
The build log for phpbrew mbstring extension /Users/denis.zoljom/.phpbrew/build/php-7.4.7/ext/mbstring/build.log
View build.log
Configuring for:
PHP Api Version: 20190902
Zend Module Api No: 20190902
Zend Extension Api No: 320190902
checking for grep that handles long lines and -e... /usr/local/bin/ggrep
checking for egrep... /usr/local/bin/ggrep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... cc
@dingo-d
dingo-d / gist:d72fd01e69b73be99fad267796c03410
Created Jul 20, 2020
Installing extensions using phpbrew
View gist:d72fd01e69b73be99fad267796c03410
phpbrew ext install github:php-amqp/php-amqp
@dingo-d
dingo-d / conf.phperrorlog
Last active Jul 17, 2020
Config examples for debug, and error logs with grc: https://github.com/garabik/grc
View conf.phperrorlog
# Highlight time
regexp=^\[\d\d-[A-Z][a-z][a-z]-\d\d\d\d \d\d:\d\d:\d\d [A-Z]{3}\]
colour=dark
count=once
-
# Highlight file paths with lines at end
regexp=(/[A-z0-9-]+)+.php:[\d]+
colour=green
count=more
-
View index.html
This file has been truncated, but you can view the full file.