Fixed jscolor.js not work with Vue updated by AJAX color value

For example:

We got some data form AJAX and the valuable is “topBGColor”.

in HTML

<input data-jscolor="">

add ref="topBGColor"

<input data-jscolor="" ref="topBGColor">

in Javascript (After get ajax value)

let topBGColor = "#ff0000";

this.$refs.topBGColor.style = 'background-image: linear-gradient(to right, '+topBGColor+' 0%, '+topBGColor+' 30px, rgba(0, 0, 0, 0) 31px, rgba(0, 0, 0, 0) 100%) !important; background-position: left top, left top !important; background-size: auto, 32px 16px !important; background-repeat: repeat-y, repeat-y !important; background-origin: padding-box, padding-box !important; padding-left: 40px !important;';

PHP_EOL is newline character in a cross-platform-compatible

PHP_EOL = cross-platform-compatible newline character

PHP_EOL is ostensibly used to find the newline character in a cross-platform-compatible way, so it handles DOS/Unix issues.

Note that PHP_EOL represents the endline character for the current system. For instance, it will not find a Windows endline when executed on a unix-like system.

Example (Save the $DataArray to $filename):

file_put_contents($filename, implode(PHP_EOL, $DataArray), LOCK_EX);
Reference:
Adam Bellaire (2008), https://stackoverflow.com/questions/128560/when-do-i-use-the-php-constant-php-eol

Remove empty array elements

// PHP 7.4 and later
print_r(array_filter($linksArray, fn($value) => !is_null($value) && $value !== ''));

// PHP 5.3 and later
print_r(array_filter($linksArray, function($value) { return !is_null($value) && $value !== ''; }));

// PHP < 5.3
print_r(array_filter($linksArray, create_function('$value', 'return $value !== "";')));
Reference:

BoltClock (2020), https://stackoverflow.com/questions/3654295/remove-empty-array-elements

Redirect non-www to www in .htaccess

Change your configuration to this (add a slash):

RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L] 

Or the solution outlined below will work for any domain:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

If you need to support http and https and preserve the protocol choice try the following:

RewriteRule ^login\$ https://www.%{HTTP_HOST}/login [R=301,L]

Source :

Randall Hunt(2021), https://stackoverflow.com/questions/12050590/redirect-non-www-to-www-in-htaccess/36807965

rsync site2site.sh script sample

#!/bin/bash

if pidof -x "rsync" >/dev/null; then
         echo "Process already running"
         exit 0
 fi

rsync -avzhe "ssh -i /root/.ssh/andrew-rsync-key" /volume1/andrew/ andrew@10.1.0.1:/volume1/andrew --delete --exclude=#recycle --chmod=ugo+rw
rsync -avzhe "ssh -i /root/.ssh/andrew-rsync-key" /volume1/peter/ andrew@10.1.0.1:/volume1/peter --delete --exclude=#recycle --chmod=ugo+rw
rsync -avzhe "ssh -i /root/.ssh/andrew-rsync-key" /volume1/may/ andrew@10.1.0.1:/volume1/may --delete --exclude=#recycle --chmod=ugo+rw

Reference

Andreas Koch(2013), Rsync over SSH with key authentication, 
https://andykdocs.de/development/Linux/2013-01-17+Rsync+over+SSH+with+Key+Authentication, Last: 2021-05-31

Rsync over SSH with key authentication

Using rsync and ssh to synchronize folders over the network.

created by Andreas Koch on 2013-01-17

Setup the SSH login with key authentication

Create a new ssh key pair:

ssh-keygen -t rsa -b 2048 -f andy-rsync-key

Move the public(!) key to the remote server:

scp andy-rsync-key.pub andy@example.cloudapp.net:/home/andy/

Append the public key to the “authorized_keys” on your remote server:

ssh -l andy example.cloudapp.net
cat andy-rsync-key.pub >> .ssh/authorized_keys

Test the connection:

ssh -l andy -i ~/.ssh/andy-rsync-key example.cloudapp.net

You should not be prompted for a password.

Setup the folder synchronization

Test the synchronization:

rsync --progress -avz -e "ssh -i /home/dev/.ssh/andy-rsync-key" /home/dev/git-master/ andy@example.cloudapp.net:/home/andy/git-master/

Create a shell script for the synchronization

vi ~/bin/sync-git-master.sh

#!/bin/bash
rsync –progress -avz –delete -e “ssh -i /home/dev/.ssh/andy-rsync-key” /home/dev/git-master/ andy@example.cloudapp.net:/home/andy/git-master/

chmod 700 ~/bin/sync-git-master.sh


Schedule the script execution (every 5 minutes):

```bash
crontab -e
# m h  dom mon dow   command
*/5 * * * * /home/dev/bin/git-master-sync.sh