Skip to content

Instantly share code, notes, and snippets.

@dradovic
dradovic / download-pdf.js
Last active July 4, 2020 00:05 — forked from devloco/download-pdf.js
Download a PDF via POST with Fetch API
let fnGetFileNameFromContentDispostionHeader = function (header) {
let contentDispostion = header.split(';');
const fileNameToken = `filename*=UTF-8''`;
let fileName = 'downloaded.pdf';
for (let thisValue of contentDispostion) {
if (thisValue.trim().indexOf(fileNameToken) === 0) {
fileName = decodeURIComponent(thisValue.trim().replace(fileNameToken, ''));
break;
}
@dradovic
dradovic / Program.cs
Created February 21, 2019 10:37
How to use the ManifestEmbeddedFileProvider with a Satellite Assembly
using System;
using System.IO;
using System.Reflection;
using Microsoft.Extensions.FileProviders;
namespace ReadingEmbeddedResource
{
class Program
{
static void Main(string[] args)
@dradovic
dradovic / DeleteExcludedFiles.ps1
Last active January 2, 2018 00:24 — forked from mikesigs/DeleteExcludedFiles.ps1
PowerShell Script to Find (and delete) all excluded files in a Visual Studio Solution
<#
.SYNOPSIS
Find all files excluded from a Visual Studio solution with options to delete.
.DESCRIPTION
Finds all excluded files in all projects in the provided Visual Studio solution with options to delete the files.
.PARAMETER Solution
The path to the .sln file
class Program
{
static void Main(string[] args)
{
const int count = 1000000;
DateTime date = new DateTime(2015, 5, 14);
int dateAsInt;
DateTime deserialized;
Stopwatch watch = new Stopwatch();