The PayPal sandbox is a self-contained, virtual testing environment that simulates the live PayPal production environment. The sandbox provides a shielded space where you can initiate and watch while your apps process PayPal API requests without touching any live PayPal accounts.
Author: Jorge Saldivar
-
iOS 17 is out and a couple of things stick out
The first thing, the battery life took a hit (hopefully, there’s a fix for this asap). The second is the announcement of the upcoming Journal app. I’m curious if this can be synced to WordPress… hopefully there will be an app for that.
-
Update WordPress MySQL tables from old domain name to new domain name
This code is typically used when migrating a WordPress site from one domain to another, ensuring that all references to the old domain are updated to the new domain.
/* This SQL code block updates various tables in a WordPress database to replace occurrences of the 'Old_Domain_Name' with the 'New_Domain_Name'. The specific tables being updated are: - wp_options: Updates the option_value column for rows where the option_name is 'home' or 'siteurl'. - wp_posts: Updates the post_content column. - wp_postmeta: Updates the meta_value column. - wp_usermeta: Updates the meta_value column. - wp_links: Updates the link_url column. - wp_comments: Updates the comment_content column. */ UPDATE wp_options SET option_value = replace(option_value, 'Old_Domain_Name','New_Domain_Name') WHERE option_name = 'home' OR option_name = 'siteurl'; UPDATE wp_posts SET post_content = replace(post_content, 'Old_Domain_Name','New_Domain_Name'); UPDATE wp_postmeta SET meta_value = replace(meta_value,'Old_Domain_Name','New_Domain_Name'); UPDATE wp_usermeta SET meta_value = replace(meta_value, 'Old_Domain_Name','New_Domain_Name'); UPDATE wp_links SET link_url = replace(link_url, 'Old_Domain_Name','New_Domain_Name'); UPDATE wp_comments SET comment_content = replace(comment_content , 'Old_Domain_Name','New_Domain_Name');
-
Image Tag Cheat Sheet
Basic Usage
<img src="path/to/image.jpg" alt="Image description" />
Attributes
Attribute Description src
The path to the image file. alt
The text to display if the image fails to load. width
The width of the image in pixels. height
The height of the image in pixels. title
The text to display when the user hovers over the image. Example
<img src="path/to/image.jpg" alt="Image description" width="200" height="200" title="Image title" />
Notes
- The
alt
attribute is required for accessibility. It is used by screen readers to describe the image to visually impaired users. - The
width
andheight
attributes are optional. If you do not specify them, the image will be displayed at its original size. - The
title
attribute is optional. It is used to provide additional information about the image when the user hovers over it.
- The
-
Updated website to TT4
I’m vibing on the updated default theme, Twenty Twenty-Four. Great job to the contributors!
Photo by Johannes Plenio on Pexels.com -
Regex Cheat Sheet
Simple Examples
hello
: Matches the string “hello” exactly.123
: Matches the string “123” exactly..
: Matches any single character.\d
: Matches any digit character (0-9).\w
: Matches any word character (a-z, A-Z, 0-9, _).\s
: Matches any whitespace character (space, tab, newline).
Examples
hello world
: Matches the string “hello world” exactly.hello|world
: Matches either “hello” or “world”.hello.*
: Matches “hello” followed by zero or more characters.hello\s
: Matches “hello” followed by a whitespace character.hello\d
: Matches “hello” followed by a digit character.hello\w
: Matches “hello” followed by a word character.hello\s\d
: Matches “hello” followed by a whitespace character and a digit character.
Quantifiers
a+
: Matches one or more “a” characters.a*
: Matches zero or more “a” characters.a?
: Matches zero or one “a” character.a{3}
: Matches exactly three “a” characters.a{3,}
: Matches three or more “a” characters.a{3,5}
: Matches between three and five “a” characters.
Character Classes
[abc]
: Matches any of the characters “a”, “b”, or “c”.[^abc]
: Matches any character that is not “a”, “b”, or “c”.[a-z]
: Matches any lowercase letter.[A-Z]
: Matches any uppercase letter.[0-9]
: Matches any digit character.[\w]
: Matches any word character.[\W]
: Matches any non-word character.[\s]
: Matches any whitespace character.[\S]
: Matches any non-whitespace character.
Anchors
^hello
: Matches “hello” at the beginning of a line.world$
: Matches “world” at the end of a line.\bhello\b
: Matches “hello” as a whole word.\Bhello\B
: Matches “hello” not as a whole word.
Groups
(hello)
: Matches “hello” and captures it as a group.(hello|world)
: Matches either “hello” or “world”.(?:hello)
: Matches “hello” but does not capture it as a group.(?=hello)
: Matches any string that is followed by “hello”.(?!hello)
: Matches any string that is not followed by “hello”.
Flags
/hello/i
: Matches “hello” case-insensitively./hello/g
: Matches all occurrences of “hello”./hello/m
: Matches “hello” across multiple lines./hello/s
: Matches “hello” across multiple lines and allows “.” to match newline characters.
Special Characters
\
: Escapes a special character..
: Matches any single character except newline characters.^
: Matches the beginning of a line.$
: Matches the end of a line.*
: Matches zero or more of the preceding character.+
: Matches one or more of the preceding character.?
: Matches zero or one of the preceding character.(
: Begins a capturing group.)
: Ends a capturing group.[
: Begins a character class.]
: Ends a character class.{
: Begins a quantifier.}
: Ends a quantifier.|
: Matches either the expression before or after the operator./
: Begins and ends a regular expression.i
: Makes the regex case-insensitive.g
: Matches all occurrences of the pattern.m
: Makes the^
and$
anchors match the beginning and end of lines.s
: Allows.
to match newline characters.\n
: Matches a newline character.\r
: Matches a carriage return character.\t
: Matches a tab character.\v
: Matches a vertical tab character.\0
: Matches a null character (U+0000 NULL).\xhh
: Matches a character with the given hex code (e.g.\x0A
matches a newline character).\uhhhh
: Matches a character with the given Unicode code point (e.g.\u0009
matches a tab character).\cX
: Matches a control character using caret notation (e.g.\cJ
matches a newline character).\u{hhhh}
: Matches a character with the given Unicode code point (e.g.\u{0009}
matches a tab character).
Lookarounds
(?=hello)
: Positive lookahead. Matches any string that is followed by “hello”.(?!hello)
: Negative lookahead. Matches any string that is not followed by “hello”.(?<=hello)
: Positive lookbehind. Matches any string that is preceded by “hello”.(?<!hello)
: Negative lookbehind. Matches any string that is not preceded by “hello”.
Unicode Categories
\p{L}
: Matches any letter character.\p{M}
: Matches any combining mark character.\p{Z}
: Matches any separator character.\p{S}
: Matches any symbol character.\p{N}
: Matches any number character.\p{P}
: Matches any punctuation character.\p{C}
: Matches any control character.\p{Ll}
: Matches any lowercase letter.\p{Lu}
: Matches any uppercase letter.\p{Lt}
: Matches any titlecase letter.\p{L&}
: Matches any letter character.\p{Lm}
: Matches any modifier letter.\p{Lo}
: Matches any other letter character.\p{Mn}
: Matches any non-spacing mark character.\p{Mc}
: Matches any spacing combining mark character.\p{Me}
: Matches any enclosing mark character.\p{Zs}
: Matches any space separator character.\p{Zl}
: Matches any line separator character.\p{Zp}
: Matches any paragraph separator character.\p{Sm}
: Matches any mathematical symbol character.\p{Sc}
: Matches any currency symbol character.\p{Sk}
: Matches any modifier symbol character.\p{So}
: Matches any other symbol character.\p{Nd}
: Matches any decimal digit character.\p{Nl}
: Matches any letter number character.\p{No}
: Matches any other number character.\p{Pc}
: Matches any connector punctuation character.\p{Pd}
: Matches any dash punctuation character.\p{Ps}
: Matches any open punctuation character.\p{Pe}
: Matches any close punctuation character.\p{Pi}
: Matches any initial punctuation character.\p{Pf}
: Matches any final punctuation character.\p{Po}
: Matches any other punctuation character.\p{Cc}
: Matches any control character.\p{Cf}
: Matches any format character.\p{Cs}
: Matches any surrogate character.\p{Co}
: Matches any private-use character.\p{Cn}
: Matches any unassigned code point.
POSIX Classes
[:alnum:]
: Matches any alphanumeric character.[:alpha:]
: Matches any alphabetic character.[:ascii:]
: Matches any ASCII character.[:blank:]
: Matches any whitespace character.[:cntrl:]
: Matches any control character.[:digit:]
: Matches any digit character.[:graph:]
: Matches any visible character.[:lower:]
: Matches any lowercase character.[:print:]
: Matches any printable character.[:punct:]
: Matches any punctuation character.[:space:]
: Matches any whitespace character.[:upper:]
: Matches any uppercase character.[:word:]
: Matches any word character.[:xdigit:]
: Matches any hexadecimal digit character.
-
Trex with feathers
I asked GPT-4 to generate an image of a tyrannosaurus rex with feathers like a chicken… it did not disappoint on the first image it created. Subsequent photos weren’t as impressive.
-
LAMP Stack Setup
Setup for Ubuntu 20.04 LTS or 22.04 LTS. Lifted from this resource on AWS.
Linux
WSL, Ubuntu Multipass, or equivalant.
Apache
Version: distribution
sudo apt update -y sudo apt install apache2 -y
PHP FPM
Version: 8.2
Run the following commands to install PHP:
sudo apt-get install software-properties-common sudo add-apt-repository ppa:ondrej/php sudo apt-get update -y sudo apt install php8.2 php8.2-{fpm,mysql,curl,gd,mbstring,mysql,xml,mcrypt,zip,ldap} libapache2-mod-php8.2 -y
Install PHP-FPM
sudo a2enmod proxy_fcgi setenvif sudo a2enconf php8.2-fpm sudo a2dismod php8.2 sudo systemctl enable php8.2-fpm sudo service apache2 restart;sudo service php8.2-fpm restart
MariaDB
Version: 11.1.2
Run the following command to add the MariaDB yum repository (For all Linux distributions):
curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version="mariadb-11.1.2"
Install MariaDB Package
sudo apt install mariadb-server -y
MariaDB Secure Installation
sudo mysql_secure_installation
When prompted, set a password for the root account:
- Enter the current root password. By default, the root account doesn’t have a password set.
- Press
Enter
. - Press
N
to switch to unix_socket authentication. - Press
Y
to set a password, and then enter a secure password twice. Make sure to store this password in a safe place. - Press
Y
to remove the anonymous user accounts. - Press
Y
to disable the remote root login. - Press
Y
to remove the test database. - Press
Y
to reload the privilege tables and save your changes.
Permissions
The following command will add the
ubuntu
user to thewww-data
group:sudo usermod -a -G www-data ubuntu
The following commands will set the correct permissions for the
/var/www
directory:sudo chown -R ubuntu:www-data /var/www sudo chmod 2775 /var/www find /var/www -type d -exec sudo chmod 2775 {} \; find /var/www -type f -exec sudo chmod 0664 {} \;
Your site is ready!
Visit your website by entering your instance’s public IP address in your browser. You should see the default Apache page.