Skip to content

Instantly share code, notes, and snippets.

View JakeGinnivan's full-sized avatar
:shipit:

Jake Ginnivan JakeGinnivan

:shipit:
View GitHub Profile
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Windows]
"ErrorMode"="2"
[HKEY_CURRENT_USER\Software\Microsoft\Windows\Windows Error Reporting]
"DontShowUI"="1"
@JakeGinnivan
JakeGinnivan / gist:4679496
Last active December 11, 2015 23:48
Linqpad script
void Main()
{
DoShiz();
}
public async void DoShiz()
{
var worker = new Worker();
var ex = await ThrowsExceptionAsync<ArgumentException>(async () => await worker.GetMessage(" "));
var ex2 = await ThrowsExceptionAsync<ArgumentException>(() => worker.GetMessage(" "));
public abstract class nsw_police_files : IntegrationTestBase
{
protected abstract void RunTests();
[Fact]
public void Automate()
{
RunTest(Setup, Jurisdictions.NSW);
RunTests();
}
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using Xunit;
public class Fixture
{
[Fact]
public void Should_FactMethodName()
public class SomeScreen
{
public string Text {get;set;} // Will look for a UI element called Text and return it's value
public void Ok() { } // Finds a control called ok, and clicks it
// Other conventions
public string Text2
{
public static void ReturnsValueAsTask<T>(this Task<T> value, T returnThis, params T[] returnThese)
{
Returns(MatchArgs.AsSpecifiedInCall, ToCompletedTask(returnThis), returnThese.Select(ToCompletedTask).ToArray());
}
public static void ReturnsValueAsTask<T>(this Task<T> value, Func<CallInfo, T> returnThis)
{
Returns(MatchArgs.AsSpecifiedInCall, c => ToCompletedTask(returnThis(c)));
}
<Window.InputBindings>
<KeyBinding Modifiers="Ctrl" Key="S" Command="{Binding SaveDocumentCommand}" />
<KeyBinding Modifiers="Ctrl+Shift" Key="S" Command="{Binding SaveAllDocumentsCommand}" />
<KeyBinding Modifiers="Ctrl" Key="N" Command="{Binding NewDocumentCommand}" />
<KeyBinding Modifiers="Ctrl+Shift" Key="P" Command="{Binding PublishDocumentCommand}" />
<KeyBinding Modifiers="Ctrl" Key="O" Command="{Binding OpenDocumentCommand}" />
<KeyBinding Modifiers="Ctrl+Shift" Key="O" Command="{Binding OpenFromWebCommand}" />
<KeyBinding Modifiers="Ctrl" Key="W" Command="{Binding CloseDocumentCommand}" />
<KeyBinding Key="Escape" Command="commands:ShellCommands.Esc" />
public async void SaveDocument()
{
if (IsWorking) return;
var doc = MDI.ActiveItem as DocumentViewModel;
if (doc != null)
{
using (DoingWork(string.Format("Saving {0}", doc.MarkpadDocument.Title)))
{
await doc.Save();
await TaskEx.Delay(5000);
//Need http://nuget.org/packages/Microsoft.Bcl.Async
internal static class WebRequestExtensions
{
internal static Task<WebResponse> GetResponseAsync(this WebRequest request, TimeSpan timeout)
{
var asyncTask = Task.Factory.FromAsync<WebResponse>(request.BeginGetResponse, request.EndGetResponse, null);
var timeoutTask = TaskEx.Delay(timeout);
return TaskEx.WhenAny(asyncTask, timeoutTask)
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union