Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Hartmann danielstgt

View GitHub Profile
@danielstgt
danielstgt / axios-interceptor.js
Last active Aug 18, 2020
axios interceptor for expired sessions with SweetAlert
View axios-interceptor.js
axios.interceptors.response.use(response => {
return response;
}, error => {
if (error.response.status === 401) {
Swal.fire({
title: 'Session expired',
text: 'Please sign in again!',
type: 'error',
}).then(result => {
if (result.value) {
@danielstgt
danielstgt / FormattedDate.php
Created May 13, 2020
Eloquent DateTime Formatted Trait (Example for Germany)
View FormattedDate.php
<?php
namespace App\Traits;
trait FormattedDate
{
public function initializeFormattedDate()
{
$this->append('formatted_created_at');
$this->append('formatted_created_at_date');
@danielstgt
danielstgt / imagick3.4.4-PHP7.4-forge.sh
Last active Nov 18, 2020
Install ImageMagick / Imagick 3.4.4 on PHP 7.4 server (Laravel Forge)
View imagick3.4.4-PHP7.4-forge.sh
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
apt-get install pkg-config libmagickwand-dev -y
cd /tmp
wget https://pecl.php.net/get/imagick-3.4.4.tgz
tar xvzf imagick-3.4.4.tgz
@danielstgt
danielstgt / ie-detect.js
Created Jan 7, 2019
Detect Internet Explorer
View ie-detect.js
function isIE() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf('MSIE ');
var trident = ua.indexOf('Trident/');
return (msie > 0 || trident > 0);
}
if (isIE()) {
document.getElementById('ie-notice').style.display = 'block';
@danielstgt
danielstgt / imagick3.4.3-PHP7.3-forge.sh
Last active Nov 18, 2020 — forked from rostockahoi/imagick3.4.3-PHP7.2-forge.sh
Install Imagick 3.4.3 on PHP 7.3 server (Laravel Forge)
View imagick3.4.3-PHP7.3-forge.sh
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
apt-get install pkg-config libmagickwand-dev -y
cd /tmp
wget https://pecl.php.net/get/imagick-3.4.3.tgz
tar xvzf imagick-3.4.3.tgz
You can’t perform that action at this time.