Skip to content

Instantly share code, notes, and snippets.

View SeyamMs's full-sized avatar
🎯
Focusing

Mohammed Seyam SeyamMs

🎯
Focusing
View GitHub Profile
@akhileshdarjee
akhileshdarjee / scheduling mysql backups with laravel.php
Created April 22, 2019 14:10
Scheduling MySQL backups with Laravel
To manually dump the database you can run the following one-liner code
mysqldump -u[user] -p[pass] [db] > [file_path]
But what if you want to automate the process, here are the steps:
1. Setup cron entry to your server
* * * * * php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1
2. Create a command BackupDatabase by running the following code:
@JaySunSyn
JaySunSyn / index.js
Created January 21, 2018 12:48
Firebase functions Dynamic OG-Tags
exports.host = functions.https.onRequest((req, res) => {
const userAgent = req.headers['user-agent'].toLowerCase();
let indexHTML = fs.readFileSync('./hosting/index.html').toString();
const path = req.path ? req.path.split('/') : req.path;
const ogPlaceholder = '<meta name="functions-insert-dynamic-og">';
const metaPlaceholder = '<meta name="functions-insert-dynamic-meta">';
const isBot = userAgent.includes('googlebot') ||
userAgent.includes('yahoou') ||
userAgent.includes('bingbot') ||
@josephilipraja
josephilipraja / countries.php
Last active April 17, 2024 05:42
List of Countries with Country code & Telephone (Dial) Code as a PHP Array. Bonus: PHP function to list all Countries as HTML Select Tag Options with their 2 character Country code as values
<?php
$countryArray = array(
'AD'=>array('name'=>'ANDORRA','code'=>'376'),
'AE'=>array('name'=>'UNITED ARAB EMIRATES','code'=>'971'),
'AF'=>array('name'=>'AFGHANISTAN','code'=>'93'),
'AG'=>array('name'=>'ANTIGUA AND BARBUDA','code'=>'1268'),
'AI'=>array('name'=>'ANGUILLA','code'=>'1264'),
'AL'=>array('name'=>'ALBANIA','code'=>'355'),
'AM'=>array('name'=>'ARMENIA','code'=>'374'),
'AN'=>array('name'=>'NETHERLANDS ANTILLES','code'=>'599'),