Skip to content

Instantly share code, notes, and snippets.

View dingo-d's full-sized avatar
🏠
Working from home

Denis Žoljom dingo-d

🏠
Working from home
View GitHub Profile
@dingo-d
dingo-d / function.sh
Created September 19, 2022 19:21
Scripts to quickly create wp site using wpcli
#!/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 12:29
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
<?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 July 14, 2021 06:34
Color picker meta that adds inline css variable using ACF color palette
// 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 June 12, 2021 12:58
Fixing the valet and DNS resolving in WSL2

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 13:16
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.
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 06:26
My default .zshrc config
# 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 July 21, 2020 08:23
The build log for phpbrew mbstring extension /Users/denis.zoljom/.phpbrew/build/php-7.4.7/ext/mbstring/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 July 20, 2020 18:56
Installing extensions using phpbrew
phpbrew ext install github:php-amqp/php-amqp
@dingo-d
dingo-d / conf.phperrorlog
Last active July 17, 2020 07:38
Config examples for debug, and error logs with grc: https://github.com/garabik/grc
# 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
-
This file has been truncated, but you can view the full file.