Skip to content

Instantly share code, notes, and snippets.

@aditagusta
aditagusta / gist:bb2be6928732aa4156a9eeb2154355e9
Created August 31, 2023 02:43
Chat Bot Telegram : Feature ( SendMessage , SendPhoto , SendDoc , SendPDF ) reff : gist.github.com/fahrezi-ux
// SendMessages
public function sendTelegramMessage()
{
$message_text ="Sent Message successfuly";
$chat_id = "receiver_id";
$botTelegram = 'https://api.telegram.org/bot"your_bot_token"/sendMessage';
$url = $botTelegram."?parse_mode=markdown&chat_id=".$chat_id. "&text=" . $message_text;
$ch = curl_init();
$optArray = array(
CURLOPT_URL => $url,
@aditagusta
aditagusta / gist:e5e76814ed090a03287bd86f9d7e257d
Created January 25, 2022 12:37
Menghitung Jarak Antara 1 Titik Dengan Titik Lainnya
// Lokasi Awal
$my_latitude = $request->get('latitude');
$my_longitude = $request->get('longitude');
// Lokasi Tujuan
$my_latitude = $request->get('latitude');
$my_longitude = $request->get('longitude');
$distance = round((((acos(sin(($my_latitude*pi()/180)) * sin(($toko_latitude*pi()/180))+cos(($my_latitude*pi()/180)) * cos(($toko_latitude*pi()/180)) * cos((($my_longitude- $toko_longitude)*pi()/180))))*180/pi())*60*1.1515*1.609344), 2);
@aditagusta
aditagusta / gist:1439eb6c136490b1dd1bd52a3976fcb3
Last active January 7, 2022 11:34
Notifikasi FCM Google
// FCM API Url
$url = 'https://fcm.googleapis.com/fcm/send';
// Put your Server Response Key here
$apiKey = "AAAAVX7ftjo:APA91bEtmlrwt7oeUvIJU6G0_cef2vLXnMpZvqBhnb65dTjgfiSv-jlTvFnXPkHbUHlgMKby3EdOLNquBgkIu2xG_686VIb_Ni2seWeVpPg7g5x_w4boZSoXw5Y48RnFS_qCeWT0VGYZ";
// Compile headers in one variable
$headers = array (
'Authorization:key=' . $apiKey,
'Content-Type:application/json'
@aditagusta
aditagusta / AES CHIPER
Created July 24, 2021 06:42
PHP_AES_CHIPER
class PHP_AES_Cipher {
private static $OPENSSL_CIPHER_NAME = "aes-128-cbc"; //Name of OpenSSL Cipher
private static $CIPHER_KEY_LEN = 16; //128 bits
/**
* Encrypt data using AES Cipher (CBC) with 128 bit key
*
* @param type $key - key to use should be 16 bytes long (128 bits)
* @param type $iv - initialization vector
@aditagusta
aditagusta / callback
Last active July 22, 2021 04:53
Callback Mutasibank
public function callBack(Request $request)
{
$data = $request->all();
if($data['api_key'] === env('API_MUTASI_KEY'))
{
$toStorage = [
'hostname' => $_SERVER,
'header' => getallheaders(),
'body' => $request->all()
];
@aditagusta
aditagusta / .htaccess
Created April 29, 2021 18:02
.htaccess Laravel
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
@aditagusta
aditagusta / FungsiAkses
Created February 3, 2021 04:23
Hak Akses Web dibatasi Oleh Waktu
function my_Clock() {
this.cur_date = new Date();
this.hours = this.cur_date.getHours();
this.minutes = this.cur_date.getMinutes();
this.seconds = this.cur_date.getSeconds();
}
my_Clock.prototype.run = function () {
setInterval(this.update.bind(this), 1000);
};
@aditagusta
aditagusta / Fungsi Terbilang Rupiah
Created November 20, 2020 11:03
Mengubah dari nilai angka ke kalimat
<b>Masukkan Nilai</b>
<br />
Rp. <input id="nominall" onkeyup="terbilang();" type="text" value="1945" />
<br />
<div id="terbilang">
</div>
<script>
function terbilang(){
var bilangan=document.getElementById("nominal").value;