Skip to content

Instantly share code, notes, and snippets.

View Lovor01's full-sized avatar
💭
I may be slow to respond.

Lovro Hrust Lovor01

💭
I may be slow to respond.
  • makeITeasy
  • Zagreb
View GitHub Profile
@Lovor01
Lovor01 / docker-compose.yml
Created September 14, 2023 18:11
Create WordPress environment in Docker
services:
db:
# We use a mariadb image which supports both amd64 & arm64 architecture
image: mariadb:latest
# If you really want to use MySQL, uncomment the following line
#image: mysql:8.0.27
command: '--default-authentication-plugin=mysql_native_password'
volumes:
- db_data:/var/lib/mysql
restart: always
@Lovor01
Lovor01 / Remove-remote.md
Last active October 3, 2023 21:28
Remove file/directory from remote repository

Remove remote file or directory

// file
git rm package-lock.json --cached
// directory
git rm -r directory --cached

then commit changes

@Lovor01
Lovor01 / regex.md
Created July 8, 2023 09:11
WP CLI search replace regex

Use regex to replace (windows, powershell)

wp search-replace '(<!-- wp:image\s{[^}]*)' '$1,"sizeSlug":"full"' wp_posts --regex --regex-delimiter='/' --dry-run
@Lovor01
Lovor01 / i18n.md
Last active May 22, 2023 10:56
WordPress i18n

for block plugins

 wp i18n make-pot ./ languages/makeiteasy-back-to-top.pot
@Lovor01
Lovor01 / Database_cmd.md
Last active April 30, 2024 11:31
Database mysql/mariadb command line

Export database

mysqldump <database> --password=<password> --user=<user> --default-character-set=utf8 > <file>

on windows, use --result-file=<file> as default export is in UTF16

(or mariadb-dump)

Import database

@Lovor01
Lovor01 / Debug react HMR.md
Created February 5, 2023 22:33
Debugging react hot reload

Check server

Open: server url/webpack-dev-server to check if it is working

@Lovor01
Lovor01 / disable CORS.md
Created February 4, 2023 22:46
Disable CORS

Chrome

Start chrome with --disable-web-security option.

Firefox

Install "Allow CORS" extension

@Lovor01
Lovor01 / PHP_parent.md
Created February 2, 2023 10:41
PHP parent path bug

include, require and parent folder (..)

At least on windows with Apache, include and require don't work when path starts with ... To fix this, use

require __DIR__ . '../directory/file.php';
@Lovor01
Lovor01 / terms.md
Last active January 23, 2023 18:31
Select all terms of custom taxonomy

Terms of custom taxonomy impression-category

wp.data.select('core').getEntityRecords('taxonomy', 'impression-category', {_fields: 'id,name', per_page: -1, orderby: 'name', order: 'asc'})

@Lovor01
Lovor01 / FSE.md
Last active January 20, 2023 11:29
Full site editing essential docs