Skip to content

Instantly share code, notes, and snippets.

View aepnat's full-sized avatar
🏠
Working from home

Saepul Bahri aepnat

🏠
Working from home
View GitHub Profile
@fgilio
fgilio / axios-catch-error.js
Last active June 18, 2025 11:09
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@gilbitron
gilbitron / after.sh
Last active March 1, 2023 22:06
Laravel Homestead daily database backup cron provision (after.sh)
#!/bin/sh
# If you would like to do some extra provisioning you may
# add any commands you wish to this file and they will
# be run after the Homestead machine is provisioned.
if [ ! -f /etc/cron.daily/database-backup ]; then
sudo bash -c "cat > /etc/cron.daily/database-backup" <<EOL
#!/bin/bash
@grumpysi
grumpysi / Install Imagemagick PHP 7.0
Last active January 28, 2020 13:58
Install Imagemagick on Laravel Homestead box Ubuntu 14 + PHP 7.0
sudo apt-get update && sudo apt-get install -y imagemagick php-imagick && sudo service php7.0-fpm restart && sudo service apache2 restart