Default can use this :
document.addEventListener('DOMContentLoaded', function () {
// do something here ...
}, false);
on fully load use this :
window.addEventListener('load', function () {
// do something here ...
}, false);
credit to source :
https://www.codeinwp.com/snippets/jquery-document-ready-in-vanilla-javascript/
Developer snippets : Kliping sana sini
Mencari Sesuatu ?
Jumat, 09 Desember 2022
Vanilla JS like jquery document.ready
Rabu, 07 Desember 2022
Linux Screenshot melalui remote SSH terminal
ssh root@"runuser -l -c 'DISPLAY=:0 import -window root /tmp/screenshot.png'" nama_user that running or use the display / x server for information on running user can use this command : $> loginctl list-sessions
Selasa, 06 Desember 2022
PHP FUNCTION Send document Telegram bot channel
function send_file_telegram($file,$message,$channelid,$token){
$curl = curl_init();
$fh=new CURLFile(realpath($file));
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.telegram.org/bot".urlencode($token)."/sendDocument",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array(
"document"=>$fh,
"caption"=>$message,
"disable_notification"=>true,
"chat_id"=>$channelid,
),
CURLOPT_HTTPHEADER => [
"User-Agent: Telegram Bot SDK",
"Content-Type: multipart/form-data;charset=utf-8"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
}
Label:
bot,
channel,
php,
send document,
telegram
Senin, 05 Desember 2022
perintah hanya untuk directory zip_log dengan umur diatas 60 hari
#perintah hanya untuk directory zip_log dengan umur diatas 60 hari
find /var/www/html/ -type d -regex ".*zip_log.*" -mtime +60 -print -exec rm -rf "{}" \;
Rabu, 16 November 2022
linux command find and gzip file
#perintah find untuk gzip file
find ./ -type f -regex ".*\.sql" -print -exec gzip -9 "{}" \;
Rabu, 09 November 2022
Tar backup exclude directory
tar --exclude='nama_directory' --exclude='prefix_directory' -czvf [backup_file]
Kamis, 20 Oktober 2022
Bash Perintah hapus directory dengan find dan regex
# perintah hapus 10 hari yang lalu
find /mydir -regex ".*/backup.*" -type d -ctime +10 -print -exec rm -rf {} \;
Langganan:
Postingan (Atom)