Skip to content

Instantly share code, notes, and snippets.

View stripathi669's full-sized avatar

Shivam Mani Tripathi stripathi669

View GitHub Profile
@stripathi669
stripathi669 / jquery-file-download.js
Created March 31, 2021 11:26
jQuery File Download from URL
// if you have url pointing to a file and you want to download a file with a click, normally you can do <a href='url'>.
// But this doesn't work if serving domain and file url domain are not same. This is browser secuirty measure
//For those case, you can use the code below
function downloadFileFromURL(url, filename) {
$.ajax({
type: "POST",
url: url,
data: params,
success: function(response, status, xhr) {
@stripathi669
stripathi669 / settings.py
Last active March 4, 2019 04:05
Slack Error logger for Django
...
# Slack error handling
from django.utils.log import DEFAULT_LOGGING
LOGGING = DEFAULT_LOGGING
LOGGING['handlers']['slack_admins'] = {
'level': 'ERROR',
'filters': ['require_debug_false'], # Remove this fileter (make empty array) to test on debug