Skip to content

Instantly share code, notes, and snippets.

Avatar

Patrick Westerhoff poke

View GitHub Profile
@poke
poke / microsoft-docs-force-english.user.js
Last active Jan 17, 2020
[User script] Microsoft Docs: Force English
View microsoft-docs-force-english.user.js
// ==UserScript==
// @id microsoft-docs-force-english@poke
// @name Microsoft Docs: Force English
// @description Force Microsoft Docs to be displayed in English, regardless of the browser’s locale settings.
// @namespace poke
// @version 1.0.0
// @author Patrick Westerhoff
// @grant none
// @include https://docs.microsoft.com/*
// @homepageURL https://gist.github.com/poke/443691326ead282667e12ddb3165f103
@poke
poke / NanoKestrel.cs
Created Feb 7, 2018
NanoKestrel: Running Kestrel in a console application with as minimum code as possible, i.e. avoiding all the WebHost stuff
View NanoKestrel.cs
using System;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting.Internal;
using Microsoft.AspNetCore.Hosting.Server;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal;
@poke
poke / ForwardSectionRazorPageExtensions.cs
Created Sep 20, 2017
[ASP.NET Core] RazorPage.ForwardSection extension to forward sections in intermediate layouts to the base layout
View ForwardSectionRazorPageExtensions.cs
using Microsoft.AspNetCore.Mvc.Razor;
namespace AspNetCoreUtilities
{
public static class ForwardSectionRazorPageExtensions
{
/// <summary>
/// Forward a section to the parent layout. This allows views to define
/// sections that are rendered in a parent layout without intermediate
/// layouts having to render and re-define the sections themselves.
@poke
poke / stackexchange-responsive-post-width.user.js
Last active Feb 10, 2018
[User script] StackExchange: Responsive post width
View stackexchange-responsive-post-width.user.js
// ==UserScript==
// @id stackexchange-responsive-post-width@poke
// @name StackExchange: Responsive post width
// @description Make the post width responsive
// @namespace poke
// @version 1.0.1
// @author Patrick Westerhoff
// @include *://*.stackexchange.com/questions/*
// @include *://meta.serverfault.com/questions/*
// @include *://meta.stackoverflow.com/questions/*
@poke
poke / ApplicationHost.cs
Created Jul 7, 2017
Running ASP.NET Core as Windows Service with Topshelf
View ApplicationHost.cs
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting.Server.Features;
using Microsoft.AspNetCore.Server.Kestrel;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.IO;
namespace ExampleApp
{
@poke
poke / hammer-icon-no.png
Last active Apr 14, 2020
[User script] StackExchange: Close hammer warning
@poke
poke / EllipsisButtonControl.xaml
Last active Apr 26, 2017
StackOverflow 43623601 – Example code for answer http://stackoverflow.com/a/43628625/216074
View EllipsisButtonControl.xaml
<ContentControl
x:Class="WpfTest.EllipsisButtonControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WpfTest"
d:DesignHeight="30" d:DesignWidth="300" mc:Ignorable="d">
<ContentControl.Template>
<ControlTemplate TargetType="ContentControl">
@poke
poke / stackexchange-diff-color-toggle.user.js
Last active Feb 10, 2018
[User script] StackExchange: Show revision diff color toggle
View stackexchange-diff-color-toggle.user.js
// ==UserScript==
// @id stackexchange-diff-color-toggle@poke
// @name StackExchange: Show revision diff color toggle
// @namespace poke
// @version 1.1.1
// @author Patrick Westerhoff
// @include *://*.stackexchange.com/*/revisions
// @include *://*.stackexchange.com/review/suggested-edits/*
// @include *://meta.serverfault.com/*/revisions
// @include *://meta.serverfault.com/review/suggested-edits/*
@poke
poke / gw2-item-search.html
Created Jan 13, 2016
Guild Wars 2: Item search
View gw2-item-search.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Guild Wars 2: Item search</title>
</head>
<body>
<div id="loader">Loading…</div>
<div id="app" style="display: none;">
@poke
poke / git-backdate.ps1
Created Nov 29, 2015
git-backdate to create a repository from a folder, creating a commit for each file backdated to its file modification date
View git-backdate.ps1
Param([string] $Folder)
Write-Host 'Backdating files in folder' $Folder -ForegroundColor Green
Push-Location $Folder
git init
git commit --allow-empty -m 'Initialize repository'
Write-Host 'Looking for files: ' -NoNewLine -ForegroundColor Blue
$files = Get-ChildItem * -Recurse | ? { !$_.PSIsContainer } | sort LastWriteTime
Write-Host $files.Length -NoNewLine -ForegroundColor Yellow
You can’t perform that action at this time.