Skip to content

Instantly share code, notes, and snippets.

@h09shais
h09shais / CorsHandler.cs
Created November 6, 2020 10:33 — forked from Kashkovsky/CorsHandler.cs
CORS delegating handler for Web API
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
//Add to Global.asax -- GlobalConfiguration.Configuration.MessageHandlers.Add(new CorsHandler());
namespace Common.Helpers
{
public class CorsHandler : DelegatingHandler
@h09shais
h09shais / proxy.ashx
Created November 4, 2020 12:12 — forked from kai5263499/proxy.ashx
A simple proxy in C# which persists the entire request to the target
<%@ WebHandler Language="C#" CodeBehind="proxy.ashx.cs" Class="PIPE.Host.proxy" %>
@h09shais
h09shais / JS-LINQ.js
Created June 16, 2020 12:03 — forked from DanDiplo/JS-LINQ.js
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// JS array equivalents to C# LINQ methods - by Dan B.
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
{ name: "Judy", age: 42 },
{ name: "Tim", age: 8 }
@h09shais
h09shais / FileSystemCache.cs
Created February 26, 2020 08:44 — forked from kocubinski/FileSystemCache.cs
A simple write-invalidated cache for JSON on the file system.
public interface ICache<out T>
{
T Get(string key);
}
public class CacheObject<T>
{
public T Value { get; set; }
public DateTime CachedDate { get; set; }
@h09shais
h09shais / Extract-TarGz.ps1
Last active September 16, 2019 11:47 — forked from jermdavis/Extract-TarGz.ps1
A PowerShell script that can extract .tar.gz files on Windows - with minimal dependencies to make it easy to use on servers.
[cmdletbinding(SupportsShouldProcess=$True)]
param(
# What .tar.gz file should be extracted? Must exist.
[Parameter(Mandatory=$True)]
[string]$FileToExtract,
# What folder should the files be extracted into? Does not need to exist
[Parameter(Mandatory=$True)]
[string]$TargetFolder,