1088chmod recursive needs capital -R

Changing permissions recursively with chmod:

chmod -R 755 path_to_folder
Works

chmod --recursive 755 path_to_folder
Works

chmod -r 755 path_to_folder
DOES NOT WORK chmod: cannot access '755': No such file or directory

From man chmod:

The perm symbols represent the portions of the mode bits as follows:
r The read bits.

The op symbols represent the operation performed, as follows: - If no value is supplied for perm, the ``-'' operation has no effect. If no value is supplied for who, each permission bit specified in perm, for which the corresponding bit in the file mode creation mask is set, is cleared. Otherwise, the mode bits represented by the specified who and perm values are cleared.

Therefore -r tries to remove the read bits from directory 755, which obviously does not exist and therefore throws an error.

1087screen – Quick Overview

The screen terminal utility allows for the continous running of terminal jobs - even when the user is logged out:

  1. Start a new session with screen.
  2. Dettach screen: control-a, d
  3. List all screens: screen -list
  4. Re-attach screen: screen -r
  • Remove dead screen: screen -wipe

Use case: WP-CLI

1085Tailwind Utility Scripts

Instead of yyping the whole Tailwind command, here are some small scripts:

tailwind_watch

npx tailwindcss -i ./styles/input.css -o ./styles/output.css --watch

tailwind_build

npx tailwindcss -i ./styles/input.css -o ./styles/output.css --build

tailwind_minify

npx tailwindcss -i ./styles/input.css -o ./styles/output.css --minify

Make scripts exectuable with chmod +x scriptname.

Calling the scripts:

./tailwind_watch
./tailwind_build
./tailwind_minify

1082array_merge behaves differently in PHP 7 and PHP 8

The array_merge function produces unexpected results on a PHP 8 server, as compared to a PHP 7 server.

$output = array_merge($array1, $array2);

In PHP 8, if array2 is empty, the $output array is also empty.

In PHP 7, if array2 is empty, the $output array is $array1.

TODO

  • [ ] Make test page.

1080Running Different Versions of XAMPP on OSX

XAMPP is an open-source bundle of Apache + MariaDB + PHP + Perl and most popular PHP development environment. It bundles different versions of PHP and allows for local development of Apache/PHP server setups.

After installing a PHP 8 version of XAMPP - and renaming the XAMPP folders - I got the following error message:

Apparently, XAMPP does not like being renamed.

Workaround: Rename the version you want to work with to XAMPP, then the manager-osx will start.

1077GitHub Desktop not pushing to server?

Increase the http.postBuffer:

git config http.postBuffer 524288000

1075Generating a Random Password with pseudo-random bytes

openssl rand -base64 12

rand
Generate pseudo-random bytes.

base64
Base64 Encoding

1073Javascript Images Sliders and Lightboxes

An evolving list of JS Image Sliders and Lightboxes.

Image Sliders

Slick - "the last carousel you'll ever need"

Swiper - "The Most Modern Mobile Touch Slider"

  • v11.1.12, September 1, 2024
  • 39.5k Github stars

Lightbox

Slick + Lightbox

  • Building upong Slick
  • no longer in development

Gallery/Slider AND Lightbox

PhotoSwipe

  • v5.4.4
  • 23.9k Github stars

TODO:

  • make examples and test

1072WordPress Multisite and Switching Subdirectories

Notes for changing Wordpress Multisite Subdirectories:

Step 1

Update siteurl & home in wp_X_options Don’t forget the trailing slash

Step 2

Change corresponding paths in wp_blogs

Step 3 (Optional)

Clear Caches

Step 4

Check Image upload folders

Step 5

define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );

1068NVM – Node Version Manager

The Node Version Manager allows for the installation and use of different versions of node and npm.

nvm install v18.20.4
Downloading and installing node v18.20.4...
Downloading https://nodejs.org/dist/v18.20.4/node-v18.20.4-darwin-x64.tar.xz...
######################################################################### 100.0%
Computing checksum with shasum -a 256
Checksums matched!
Now using node v18.20.4 (npm v10.7.0)
nvm use v18.20.4
Now using node v18.20.4 (npm v10.7.0)
npm -v
10.7.0
node -v # v18.20.4