Skip to content

Instantly share code, notes, and snippets.

View BeniFreitag's full-sized avatar

Benjamin Freitag BeniFreitag

View GitHub Profile
@jstangroome
jstangroome / ConvertFrom-IISW3CLog.ps1
Created August 8, 2013 23:06
Function to convert lines in an IIS W3C log file to PowerShell objects
function ConvertFrom-IISW3CLog {
[CmdletBinding()]
param (
[Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
[Alias('PSPath')]
[string[]]
$Path
)
process {
@chaoaretasty
chaoaretasty / WebAPI HttpContext for Autofac
Created October 14, 2013 16:53
Hackily enable HttpContext in WebAPI and Autofac
/*
While generally using HttpContext, and all of the related properties such as
Cookies and Session, in WebAPI is not the right way sometimes it needs to be
done, especially when migrating existing code before doing a full rewrite but
could happen in any legacy MVC project you want to bring WebAPI into.
When using Autofac there is the AutofacWebTypesModule which allows you to resolve
these dependencies, all of which come from resolving HttpContextBase.
WebAPI doesn't provide HttpContext directly but if hosted in IIS rather than
@jwilson8767
jwilson8767 / es6-element-ready.js
Last active July 12, 2024 05:01
Wait for an element to exist. ES6, Promise, MutationObserver
// MIT Licensed
// Author: jwilson8767
/**
* Waits for an element satisfying selector to exist, then resolves promise with the element.
* Useful for resolving race conditions.
*
* @param selector
* @returns {Promise}
*/