Skip to content

Instantly share code, notes, and snippets.

View jmtejada's full-sized avatar
🤪

Jonathan Mejía jmtejada

🤪
  • Medellín, Colombia
  • 07:20 (UTC -05:00)
View GitHub Profile
@mikey-t
mikey-t / ConsoleOutputLog.cs
Last active April 5, 2024 13:21
Simple C# utility class to output to both console and a log file at the same time. Use it by simply calling Output.Write() and Output.WriteLine().
public class Output
{
private readonly string LogDirPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logs");
private static Output _outputSingleton;
private static Output OutputSingleton
{
get
{
if (_outputSingleton == null)
@ndc
ndc / HFDashboardAuthFilter.cs
Created September 1, 2018 12:30
Hangfire dashboard authorization filter using basic authentication and relying on browser support to allow user to input username and password.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Hangfire.Annotations;
using Hangfire.Dashboard;
using Microsoft.AspNetCore.Http;
namespace MyApp.ScheduledTask
{