Skip to content

Instantly share code, notes, and snippets.

View shiftkey's full-sized avatar
🌴
Not checking notifications, for realsies

Brendan Forster shiftkey

🌴
Not checking notifications, for realsies
View GitHub Profile
@shiftkey
shiftkey / talks.md
Last active December 20, 2015 22:09
Talk Ideas for NDC London

Reactive Extensions for Mere Mortals

The Reactive Extensions framework (Rx) is a collection of libraries to make it easy to work with asynchronous sources of data. But was it made just for academics and those who like to wear hypercolour shirts?

In this talk I'll run through:

  • what IObservable and IObserver are and how they differ to IEnumerable
  • how it differs from async/await - and where it's a better fit
  • explain some of the common patterns that work well with Rx
  • how desktop developers can use Rx (with ReactiveUI)
@shiftkey
shiftkey / view_history.sh
Created July 20, 2013 03:45
Display a rolling command history from zsh
rm ~/.zsh_history
clear
touch ~/.zsh_history
tail -f ~/.zsh_history | sed -e 's/^:[[:space:]][0-9]*\:0;//g' -e '/tail*/d' -e '/clear/d'
Different license terms apply to different file types:
- Source code files are governed by the MICROSOFT PUBLIC LICENSE (Ms-PL) (INCLUDED BELOW).
- Binary files are governed by MSDN CODE GALLERY BINARY LICENSE (INCLUDED BELOW).
- Documentation files are governed by CREATIVE COMMONS ATTRIBUTION 3.0 LICENSE (INCLUDED BELOW).
MICROSOFT PUBLIC LICENSE (Ms-PL)
This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.
@shiftkey
shiftkey / noted.md
Created June 27, 2013 02:47
Updating a Windows 8 Project to Windows 8.1

Library Project

  • <Project ToolsVersion="12.0" - was 4.0
  • <ProjectGuid>{DF7DEFA5-13DE-4B22-9D77-8817EB6C153A}</ProjectGuid> - was <ProjectGuid>{166FB620-192D-46A9-9F8D-5536C678AED0}</ProjectGuid>
  • New parameter: <TargetPlatformVersion>8.1</TargetPlatformVersion>
  • New parameter: <MinimumVisualStudioVersion>12</MinimumVisualStudioVersion>
  • <VisualStudioVersion>12.0</VisualStudioVersion> - was 11.0
@shiftkey
shiftkey / WebApplication45.vstemplate
Created May 29, 2013 03:27
Project Template Magic
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
<TemplateData>
<Name Package="{39c9c826-8ef8-4079-8c95-428f5b1c323f}" ID="3008" />
<Description Package="{39c9c826-8ef8-4079-8c95-428f5b1c323f}" ID="3383"/>
<Icon Package="{39c9c826-8ef8-4079-8c95-428f5b1c323f}" ID="4701"/>
<TemplateID>Microsoft.Web.CSharp.WebApplication45</TemplateID>
<ProjectType>Web</ProjectType>
<ProjectSubType>CSharp</ProjectSubType>
<SortOrder>10</SortOrder>
<RequiredFrameworkVersion>4.5</RequiredFrameworkVersion>
@shiftkey
shiftkey / main.cs
Last active December 16, 2015 16:39
LINQ-splaining
public static void Main() {
var found = elements.Where(e => e == "foo");
// could be described as:
// - found is elements where e equals foo
// - found equals elements where e equals foo
var match = elements.FirstOrDefault(e => e > 0);
// could be described as:
// - match equals elements first or default where e is greater than 0
@shiftkey
shiftkey / Snippet.cs
Created March 27, 2013 08:55
Set a proxy on HttpClient
var proxy = new WebProxy {Address = new Uri("http://someurl/")};
var handler = new WebRequestHandler {Proxy = proxy};
var client = new HttpClient(handler);
client.SendAsync(new HttpRequestMessage(HttpMethod.Get, "http://otherurl/"));
@shiftkey
shiftkey / Program.cs
Last active December 15, 2015 09:09
Test Harness for a regex that is giving me hell right now
using System;
using System.Text.RegularExpressions;
namespace RegexTester
{
class Program
{
private static void Main(string[] args)
{
var allText = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<doc>\r\n<!-- code start foo csharp -->\r\n<foo />\r\n<bar />\r\n<!-- end code foo -->\r\n<baz />\r\n</doc>";
@shiftkey
shiftkey / nancy.csx
Last active December 15, 2015 00:19
Investigating a scriptcs issue with the latest dev build (SHA 3325398)
D:\Code\github\scriptcs\scriptcs-samples\nancy [master +1 ~0 -0 !]> scriptcs sta
rt.csx
Found assembly reference: D:\Code\github\scriptcs\scriptcs-samples\nancy\package
s\Nancy.0.16.1\lib\net40\Nancy.dll
Found assembly reference: D:\Code\github\scriptcs\scriptcs-samples\nancy\package
s\Nancy.Hosting.Self.0.16.1\lib\net40\Nancy.Hosting.Self.dll
Found assembly reference: D:\Code\github\scriptcs\scriptcs-samples\nancy\package
s\Nancy.Bootstrappers.Autofac.0.16.1\lib\net40\Nancy.Bootstrappers.Autofac.dll
Found assembly reference: D:\Code\github\scriptcs\scriptcs-samples\nancy\package
s\Autofac.2.6.3.862\lib\NET40\Autofac.Configuration.dll
@shiftkey
shiftkey / duchess.md
Last active December 14, 2015 01:38
Some words about a project idea codenamed Duchess - the goal is to make a replacement for Sandcastle and make creating documentation for open source project cool again

Burn Sandcastle to the Ground

Addressing The Documentation Problem

I've had lots of discussions with people over the past few days around how open source projects in the .NET space have poor documentation (if it exists). So how do we fix this?

At a high-level, I've got these goals in mind:

  • make it easy
  • make it cool