Skip to content

Instantly share code, notes, and snippets.

@saqueib
saqueib / errorHandler.js
Last active February 18, 2026 14:54
Global error handling using axios interceptor for http calls http://www.qcode.in/api-error-handling-in-vue-with-axios
import axios from 'axios'
import toast from './toast'
function errorResponseHandler(error) {
// check for errorHandle config
if( error.config.hasOwnProperty('errorHandle') && error.config.errorHandle === false ) {
return Promise.reject(error);
}
// if has response show the error
import json
import os
import urllib.request
def format_message(data):
severity_level = get_severity_level(data['detail']['severity'])
payload = {
'username': 'GuardDuty Finding',
'icon_emoji': ':guardduty:',
'text': '{} GuardDuty Finding in {}'.format(severity_level['mention'], data['detail']['region']),
@fideloper
fideloper / stream_file.php
Last active August 7, 2025 19:55
Stream file from S3 to browser, assume Laravel Filesystem usage
<?php
/*************************************************************************
* Get File Information
*/
// Assuming these come from some data source in your app
$s3FileKey = 's3/key/path/to/file.ext';
$fileName = 'file.ext';