$birthDate = "1970-01-05";
$currentDate = date("d-m-Y");
$age = date_diff(date_create($birthDate), date_create($currentDate));
echo "Current age is ".$age->format("%y");
// Current age is 52
八字大運交運時間計算方法
例子: 1984年4月29日 06:28 女性
陽男陰女 -> 順行下一節令 陽女陰男 -> 逆行上一節令
陽女 1984年4月29日 06:28 逆行上一個節令 1984年4月4日 22:22
節令與出生時間相差 1984年4月4日 22:22 ~ 1984年4月29日 06:28 相差 24.34444日
3日為1年計算 24.34444日 / 3 = 8.1148148年
8.1148148年 = 8年 零 0.1148148年 0.1148148年 x 365.25 = 41.936日 41.936日 / 30日 = 1月 11日 交運時間為 8年 1月 11日
1984年4月29日 06:28 + 8年 1月 11日 = 1992年6月9日 06:28
1992年6月9日 壬丁年
acme.sh renew
Install Let’s encrypt SSL cert
Apache example:
acme.sh --install-cert \
--domain example.com \
--cert-file /path/to/cert/cert.pem \
--key-file /path/to/keyfile/key.pem \
--fullchain-file /path/to/fullchain/fullchain.pem \
--reloadcmd "sudo systemctl reload apache2.service"
Renew the Let’s Encrypt SSL certs
acme.sh --renew -d example.com --force
Filter input text only accept number and dot vue.js
Source : Mengseng Oeng (2018), https://stackoverflow.com/questions/39782176/filter-input-text-only-accept-number-and-dot-vue-js
HTML
<input @keypress="onlyNumber" type="text">
VUE JS
onlyNumber ($event) {
//console.log($event.keyCode); //keyCodes value
let keyCode = ($event.keyCode ? $event.keyCode : $event.which);
if ((keyCode < 48 || keyCode > 57) && keyCode !== 46) { // 46 is dot
$event.preventDefault();
}
}
ISPConfig increment php File upload size
site > Select Domain > Options > Custom php.ini settings
upload_max_filesize = 30M
post_max_size = 30M
MySQL ORDER BY Sorting alphanumeric on correct order
source: (user9385340)(2022), https://stackoverflow.com/questions/8557172/mysql-order-by-sorting-alphanumeric-correctly
example:
SELECT `alphanumericCol` FROM `tableName` ORDER BY
SUBSTR(`alphanumericCol` FROM 1 FOR 1),
LPAD(lower(`alphanumericCol`), 10,0) ASC
output:
1
2
11
21
100
101
102
104
S-104A
S-105
S-107
S-111
Automatically set text box to Uppercase, Support alphabet and Number only?
<input type="text" oninput="this.value=this.value.replace(/[^A-Z0-9]/gi,'').toUpperCase()">
Windows 10 God Mode
Create a folder
Rename folder to:
.{ED7BA470-8E54-465E-825C-99712043E01C}
自己實作js array prototype unique function
自己寫一個js array prototype unique function
Array.prototype.unique = function()
{
var n = [];
for(var i = 0; i < this.length; i++)
{
if (n.indexOf(this[i]) == -1) n.push(this[i]);
}
return n;
}
var arr = ["a","b","c","b","d","a","c","c"];
console.log(arr.unique());
//輸出["a", "b", "c", "d"]
WYSIWYG js Editor
Editor.js https://editorjs.io/
CKEditor https://ckeditor.com/
Quilljs https://quilljs.com/
Prosemirror https://prosemirror.net/
Tiptap https://tiptap.dev/